Top Description Methods
jakarta.enterprise.context

public Interface Conversation


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.

CDI Lite implementations are not required to provide support for conversations.

Authors
Pete Muir, Gavin King
See Also
@ConversationScoped

Method Summary

Modifier and TypeMethod and Description
public void
begin()

Mark the current transient conversation long-running.

public void
begin(String
conversation id
id
)

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

public void
end()

Marks the current long-running conversation transient.

public String

Returns:

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

Get the identifier of the current long-running conversation.

public long

Returns:

the current timeout in milliseconds.
getTimeout
()

Get the timeout of the current conversation.

public boolean

Returns:

true if the conversation is marked transient, or falseif it is marked long-running.
isTransient
()

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

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

Set the timeout of the current conversation.

Method Detail

beginback to summary
public void begin()

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

Exceptions
IllegalStateException:
if the current conversation is already marked long-running.
beginback to summary
public void begin(String id)

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

Parameters
id:String

conversation id

Exceptions
IllegalStateException:
if the current conversation is already marked long-running.
IllegalArgumentException:
if a conversation with the specified identifier already exists.
endback to summary
public void end()

Marks the current long-running conversation transient.

Exceptions
IllegalStateException:
if the current conversation is already marked transient.
getIdback to summary
public String getId()

Get the identifier of the current long-running conversation.

Returns:String

the identifier of the current long-running conversation, or a null value if the current conversation is transient.

getTimeoutback to summary
public long getTimeout()

Get the timeout of the current conversation.

Returns:long

the current timeout in milliseconds.

isTransientback to summary
public boolean isTransient()

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

Returns:boolean

true if the conversation is marked transient, or falseif it is marked long-running.

setTimeoutback to summary
public void setTimeout(long milliseconds)

Set the timeout of the current conversation.

Parameters
milliseconds:long

the new timeout in milliseconds.