javax.enterprise.context.Conversation Maven / Gradle / Ivy
Show all versions of weld-servlet-shaded Show documentation
/*
* 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 {@linkplain javax.enterprise.context.ConversationScoped 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.
*
*
* @see javax.enterprise.context.ConversationScoped @ConversationScoped
*
* @author Pete Muir
* @author Gavin King
*
*/
public interface Conversation {
/**
*
* Mark the current transient conversation long-running. A conversation identifier is generated by the container.
*
*
* @throws IllegalStateException if the current conversation is already marked long-running.
*/
public void begin();
/**
*
* Mark the current transient conversation long-running, with a specified identifier.
*
*
* @param id conversation id
* @throws IllegalStateException if the current conversation is already marked long-running.
* @throws IllegalArgumentException if a conversation with the specified identifier already exists.
*/
public void begin(String id);
/**
*
* Marks the current long-running conversation transient.
*
*
* @throws IllegalStateException if the current conversation is already marked transient.
*/
public void end();
/**
*
* Get the identifier of the current long-running conversation.
*
*
* @return 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.
*
*
* @return the current timeout in milliseconds.
*/
public long getTimeout();
/**
*
* Set the timeout of the current conversation.
*
*
* @param milliseconds the new timeout in milliseconds.
*/
public void setTimeout(long milliseconds);
/**
*
* Determine if the conversation is marked transient or long-running.
*
*
* @return true if the conversation is marked transient, or falseif it is marked long-running.
*/
public boolean isTransient();
}