Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   * Copyright 2010, Red Hat, Inc., and individual contributors
   * by the @authors tag. See the copyright.txt in the distribution for a
   * full listing of individual contributors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
  * http://www.apache.org/licenses/LICENSE-2.0
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
 package javax.enterprise.context;

Allows the application to manage the conversation context by marking the current conversation as transient or long-running, specifying a conversation identifier, or setting the conversation timeout.

An instance may be injected:

 @Inject
 Conversation conversation;
 

The conversation timeout is a hint to the container that a conversation should not be destroyed if it has been active within the last given interval in milliseconds.

Author(s):
Pete Muir
Gavin King
See also:
ConversationScoped &.064;ConversationScoped
 
 public interface Conversation {

    

Mark the current transient conversation long-running. A conversation identifier is generated by the container.

Throws:
java.lang.IllegalStateException if the current conversation is already marked long-running.
 
     public void begin();

    

Mark the current transient conversation long-running, with a specified identifier.

Throws:
java.lang.IllegalStateException if the current conversation is already marked long-running.
java.lang.IllegalArgumentException if a conversation with the specified identifier already exists.
 
     public void begin(String id);

    

Marks the current long-running conversation transient.

Throws:
java.lang.IllegalStateException if the current conversation is already marked transient.
 
     public void end();

    

Get the identifier of the current long-running conversation.

Returns:
the identifier of the current long-running conversation, or a null value if the current conversation is transient.
 
     public String getId();

    

Get the timeout of the current conversation.

Returns:
the current timeout in milliseconds.
 
     public long getTimeout();

    

Set the timeout of the current conversation.

Parameters:
milliseconds the new timeout in milliseconds.
    public void setTimeout(long milliseconds);

    

Determine if the conversation is marked transient or long-running.

Returns:
true if the conversation is marked transient, or falseif it is marked long-running.
    public boolean isTransient();
New to GrepCode? Check out our FAQ X