|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jms.listener.serversession.SimpleServerSessionFactory
public class SimpleServerSessionFactory
The simplest possible implementation of the ServerSessionFactory SPI: creating a new ServerSession with a new JMS Session every time. This is the default used by ServerSessionMessageListenerContainer.
The execution of a ServerSession (and its MessageListener) gets delegated to a TaskExecutor. By default, a SimpleAsyncTaskExecutor will be used, creating a new Thread for every execution attempt. Alternatives are a TimerTaskExecutor, sharing a single Thread for the execution of all ServerSessions, or a TaskExecutor implementation backed by a thread pool.
To reuse JMS Sessions and/or to limit the number of concurrent ServerSession executions, consider using a pooling ServerSessionFactory: for example, CommonsPoolServerSessionFactory.
TaskExecutor
,
SimpleAsyncTaskExecutor
,
TimerTaskExecutor
,
CommonsPoolServerSessionFactory
,
ServerSessionMessageListenerContainer
Field Summary | |
---|---|
static String |
DEFAULT_THREAD_NAME_PREFIX
Default thread name prefix: "SimpleServerSessionFactory-". |
Constructor Summary | |
---|---|
SimpleServerSessionFactory()
|
Method Summary | |
---|---|
void |
close(ListenerSessionManager sessionManager)
This implementation is empty, as there is no state held for each ListenerSessionManager. |
ServerSession |
getServerSession(ListenerSessionManager sessionManager)
Creates a new SimpleServerSession with a new JMS Session for every call. |
protected TaskExecutor |
getTaskExecutor()
Return the TaskExecutor to use for executing ServerSessions. |
void |
setTaskExecutor(TaskExecutor taskExecutor)
Specify the TaskExecutor to use for executing ServerSessions (and consequently, the underlying MessageListener). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEFAULT_THREAD_NAME_PREFIX
Constructor Detail |
---|
public SimpleServerSessionFactory()
Method Detail |
---|
public void setTaskExecutor(TaskExecutor taskExecutor)
Default is a SimpleAsyncTaskExecutor, creating a new Thread for every execution attempt. Alternatives are a TimerTaskExecutor, sharing a single Thread for the execution of all ServerSessions, or a TaskExecutor implementation backed by a thread pool.
SimpleAsyncTaskExecutor
,
TimerTaskExecutor
protected TaskExecutor getTaskExecutor()
public ServerSession getServerSession(ListenerSessionManager sessionManager) throws JMSException
getServerSession
in interface ServerSessionFactory
sessionManager
- the session manager to use for
creating and executing new listener sessions
(implicitly indicating the target listener to invoke)
JMSException
- if retrieval failedpublic void close(ListenerSessionManager sessionManager)
close
in interface ServerSessionFactory
sessionManager
- the session manager used for
creating and executing new listener sessions
(implicitly indicating the target listener)
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |