Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.springframework.jms.listener.serversession
Class SimpleServerSessionFactory

    java.lang.Object
      org.springframework.jms.listener.serversession.SimpleServerSessionFactory

All Implemented Interfaces:
  ServerSessionFactory

    public class SimpleServerSessionFactory

extends Object
implements ServerSessionFactory

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.

Since:
  2.0
Author:
  Juergen Hoeller
See Also:
  `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

### DEFAULT_THREAD_NAME_PREFIX

    public static final String DEFAULT_THREAD_NAME_PREFIX

  Default thread name prefix: "SimpleServerSessionFactory-".

Constructor Detail

### SimpleServerSessionFactory

    public SimpleServerSessionFactory()

Method Detail

### setTaskExecutor

    public void setTaskExecutor(TaskExecutor taskExecutor)

  Specify the TaskExecutor to use for executing ServerSessions (and consequently, the underlying MessageListener).

  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.

  See Also:
    `SimpleAsyncTaskExecutor`, `TimerTaskExecutor`

### getTaskExecutor

    protected TaskExecutor getTaskExecutor()

  Return the TaskExecutor to use for executing ServerSessions.

### getServerSession

    public ServerSession getServerSession(ListenerSessionManager sessionManager)
                                   throws JMSException

  Creates a new SimpleServerSession with a new JMS Session for every call.

  Specified by:
    `getServerSession` in interface `ServerSessionFactory`
  Parameters:
    `sessionManager` - the session manager to use for creating and executing new listener sessions (implicitly indicating the target listener to invoke)
  Returns:
    the JMS ServerSession
  Throws:
    `JMSException` - if retrieval failed

### close

    public void close(ListenerSessionManager sessionManager)

  This implementation is empty, as there is no state held for each ListenerSessionManager.

  Specified by:
    `close` in interface `ServerSessionFactory`
  Parameters:
    `sessionManager` - the session manager used for creating and executing new listener sessions (implicitly indicating the target listener)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| The Spring Framework
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2007 The Spring Framework.