站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > Spring Framework 2.0.5 API 文档英文版

SingleConnectionFactory102 (Spring Framework API 2.0) - Spring Framework 2.0.5 API 文档英文版

The Spring Framework

org.springframework.jms.connection
Class SingleConnectionFactory102

java.lang.Object
  extended by org.springframework.jms.connection.SingleConnectionFactory
      extended by org.springframework.jms.connection.SingleConnectionFactory102
All Implemented Interfaces:
ConnectionFactory, ExceptionListener, QueueConnectionFactory, TopicConnectionFactory, DisposableBean, InitializingBean

public class SingleConnectionFactory102
extends SingleConnectionFactory

A subclass of SingleConnectionFactory that uses the JMS 1.0.2 specification, rather than the JMS 1.1 methods used by SingleConnectionFactory itself. This class can be used for JMS 1.0.2 providers, offering the same API as SingleConnectionFactory does for JMS 1.1 providers.

You need to set the "pubSubDomain" property accordingly, as this class will always create either a QueueConnection or a TopicConnection.

Since:
1.1
Author:
Juergen Hoeller
See Also:
SingleConnectionFactory.setTargetConnectionFactory(javax.jms.ConnectionFactory), setPubSubDomain(boolean)

Field Summary
 
Fields inherited from class org.springframework.jms.connection.SingleConnectionFactory
logger
 
Constructor Summary
SingleConnectionFactory102()
          Create a new SingleConnectionFactory102 for bean-style usage.
SingleConnectionFactory102(ConnectionFactory connectionFactory, boolean pubSubDomain)
          Create a new SingleConnectionFactory102 that always returns a single Connection that it will lazily create via the given target ConnectionFactory.
 
Method Summary
 void afterPropertiesSet()
          In addition to checking whether the target ConnectionFactory is set, make sure that the supplied factory is of the appropriate type for the specified destination type: QueueConnectionFactory for queues, TopicConnectionFactory for topics.
protected  Connection doCreateConnection()
          This implementation overrides the superclass method to use JMS 1.0.2 API.
 boolean isPubSubDomain()
          Return whether the Publish/Subscribe domain (Topics) is used.
 void setPubSubDomain(boolean pubSubDomain)
          Configure the factory with knowledge of the JMS domain used.
 
Methods inherited from class org.springframework.jms.connection.SingleConnectionFactory
closeConnection, createConnection, createConnection, createQueueConnection, createQueueConnection, createTopicConnection, createTopicConnection, destroy, getClientId, getExceptionListener, getSharedConnectionProxy, getTargetConnectionFactory, initConnection, isReconnectOnException, onException, prepareConnection, resetConnection, setClientId, setExceptionListener, setReconnectOnException, setTargetConnectionFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SingleConnectionFactory102

public SingleConnectionFactory102()
Create a new SingleConnectionFactory102 for bean-style usage.


SingleConnectionFactory102

public SingleConnectionFactory102(ConnectionFactory connectionFactory,
                                  boolean pubSubDomain)
Create a new SingleConnectionFactory102 that always returns a single Connection that it will lazily create via the given target ConnectionFactory.

Parameters:
connectionFactory - the target ConnectionFactory
pubSubDomain - whether the Publish/Subscribe domain (Topics) or Point-to-Point domain (Queues) should be used
Method Detail

setPubSubDomain

public void setPubSubDomain(boolean pubSubDomain)
Configure the factory with knowledge of the JMS domain used. This tells the JMS 1.0.2 provider which class hierarchy to use for creating Connections. Default is Point-to-Point (Queues).

Parameters:
pubSubDomain - true for Publish/Subscribe domain (Topics), false for Point-to-Point domain (Queues)

isPubSubDomain

public boolean isPubSubDomain()
Return whether the Publish/Subscribe domain (Topics) is used. Otherwise, the Point-to-Point domain (Queues) is used.


afterPropertiesSet

public void afterPropertiesSet()
In addition to checking whether the target ConnectionFactory is set, make sure that the supplied factory is of the appropriate type for the specified destination type: QueueConnectionFactory for queues, TopicConnectionFactory for topics.

Specified by:
afterPropertiesSet in interface InitializingBean
Overrides:
afterPropertiesSet in class SingleConnectionFactory

doCreateConnection

protected Connection doCreateConnection()
                                 throws JMSException
This implementation overrides the superclass method to use JMS 1.0.2 API.

Overrides:
doCreateConnection in class SingleConnectionFactory
Returns:
the new JMS Connection
Throws:
JMSException - if thrown by JMS API methods

The Spring Framework

Copyright © 2002-2007 The Spring Framework.