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 AbstractPoolingServerSessionFactory

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

All Implemented Interfaces:
  ServerSessionFactory

Direct Known Subclasses:
  CommonsPoolServerSessionFactory

    public abstract class AbstractPoolingServerSessionFactory

extends Object
implements ServerSessionFactory

Abstract base class for ServerSessionFactory implementations that pool ServerSessionFactory instances.

Provides a factory method that creates a poolable ServerSession (to be added as new instance to a pool), a callback method invoked when a ServerSession finished an execution of its listener (to return an instance to the pool), and a method to destroy a ServerSession instance (after removing an instance from the pool).

Since:
  2.0
Author:
  Juergen Hoeller
See Also:
  `CommonsPoolServerSessionFactory`

Field Summary
`protected Log` | `logger`

Constructor Summary
`AbstractPoolingServerSessionFactory()`

Method Summary
`protected ServerSession` | `createServerSession(ListenerSessionManager sessionManager)` Create a new poolable ServerSession.
`protected void` | `destroyServerSession(ServerSession serverSession)` Destroy the given poolable ServerSession.
`int` | `getMaxSize()` Return the maximum size of the pool.
`protected TaskExecutor` | `getTaskExecutor()` Return the TaskExecutor to use for executing ServerSessions.
`protected abstract void` | `serverSessionFinished(ServerSession serverSession, ListenerSessionManager sessionManager)` Template method called by a ServerSession if it finished execution of its listener and is ready to go back into the pool.
`void` | `setMaxSize(int maxSize)` Set the maximum size of the pool.
`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`

Methods inherited from interface org.springframework.jms.listener.serversession.ServerSessionFactory
`close, getServerSession`

Field Detail

### logger

    protected final Log logger

Constructor Detail

### AbstractPoolingServerSessionFactory

    public AbstractPoolingServerSessionFactory()

Method Detail

### setTaskExecutor

    public void setTaskExecutor(TaskExecutor taskExecutor)

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

  Default is a `TimerTaskExecutor` for each pooled ServerSession, using one Thread per pooled JMS Session. Alternatives are a shared TimerTaskExecutor, sharing a single Thread for the execution of all ServerSessions, or a TaskExecutor implementation backed by a thread pool.

### getTaskExecutor

    protected TaskExecutor getTaskExecutor()

  Return the TaskExecutor to use for executing ServerSessions.

### setMaxSize

    public void setMaxSize(int maxSize)

  Set the maximum size of the pool.

### getMaxSize

    public int getMaxSize()

  Return the maximum size of the pool.

### createServerSession

    protected final ServerSession createServerSession(ListenerSessionManager sessionManager)
                                               throws JMSException

  Create a new poolable ServerSession. To be called when a new instance should be added to the pool.

  Parameters:
    `sessionManager` - the listener session manager to create the poolable ServerSession for
  Returns:
    the new poolable ServerSession
  Throws:
    `JMSException` - if creation failed

### destroyServerSession

    protected final void destroyServerSession(ServerSession serverSession)

  Destroy the given poolable ServerSession. To be called when an instance got removed from the pool.

  Parameters:
    `serverSession` - the poolable ServerSession to destroy

### serverSessionFinished

    protected abstract void serverSessionFinished(ServerSession serverSession,
                                                  ListenerSessionManager sessionManager)

  Template method called by a ServerSession if it finished execution of its listener and is ready to go back into the pool.

  Subclasses should implement the actual returning of the instance to the pool.

  Parameters:
    `serverSession` - the ServerSession that finished its execution
    `sessionManager` - the session manager that the ServerSession belongs to

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.