com.j_spaces.jms
Class GSConnectionFactoryImpl

java.lang.Object
  extended by com.j_spaces.jms.GSConnectionFactoryImpl
All Implemented Interfaces:
Serializable, ConnectionFactory, XAConnectionFactory
Direct Known Subclasses:
GSQueueConnectionFactoryImpl, GSTopicConnectionFactoryImpl

public abstract class GSConnectionFactoryImpl
extends Object
implements ConnectionFactory, XAConnectionFactory, Serializable

Implements the javax.jms.ConnectionFactory interface. It also in charge of the following: - Finding a SpaceProxy according to te provided space url. - Generating connection id's - Managing the gigaspaces space url's used by the jms connections. - Create LocalTransactionManager instance - Creates the ParserManager for selector usage. This implementation is using the GSJMSAdmin, the GigaSpaces Utility class that is in charge of the following:

 - Initiate on demand a first instance of GSTopicConnectionFactoryImpl,
                then return a static reference of it.
 - Initiate on demand a first instance of GSQueueConnectionFactoryImpl,
                then return a static reference of it.
 - Initiate on demand a first JNDI initial context and holds its static reference.
 - Lookup a Topic/Queue
 
 

See Also:
Serialized Form

Field Summary
static int QUEUE_CONNECTION_FAC
           
static int TOPIC_CONNECTION_FAC
           
static int XAQUEUE_CONNECTION_FAC
           
static int XATOPIC_CONNECTION_FAC
           
 
Constructor Summary
GSConnectionFactoryImpl(String spaceURL, int connFacType, IJSpace space)
          Constructor Internal Constructor which is used by the LookupManager to bind initially the connection factory.
 
Method Summary
 Connection createConnection()
          JMS API method
 Connection createConnection(String userName, String password)
          JMS API method
 XAConnection createXAConnection()
           
 XAConnection createXAConnection(String userName, String password)
           
 GSJMSAdmin getAdmin()
           
 int getCnxCounter()
           
 TransactionManager getLocalTransactionManager()
           
 String getSpaceURL()
           
 void initializeConnFactoryServices(String spaceURL, GSJMSAdmin jmsAdminInstance)
          Sets the GigaSpaces space url, jmsAdminInstance and finds the space proxy.
 boolean pingSpace()
          Checks whether the space is alive and accessible.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QUEUE_CONNECTION_FAC

public static final int QUEUE_CONNECTION_FAC
See Also:
Constant Field Values

TOPIC_CONNECTION_FAC

public static final int TOPIC_CONNECTION_FAC
See Also:
Constant Field Values

XAQUEUE_CONNECTION_FAC

public static final int XAQUEUE_CONNECTION_FAC
See Also:
Constant Field Values

XATOPIC_CONNECTION_FAC

public static final int XATOPIC_CONNECTION_FAC
See Also:
Constant Field Values
Constructor Detail

GSConnectionFactoryImpl

public GSConnectionFactoryImpl(String spaceURL,
                               int connFacType,
                               IJSpace space)
                        throws JMSException
Constructor Internal Constructor which is used by the LookupManager to bind initially the connection factory. This const mode will not initiate the LTM etc. nor find for space proxy, which be called later when the jms client calls for connection factory through the GSJMSAdmin. In that case the GSJMSAdmin will set the space URL as per client side configurations.

Parameters:
spaceURL -
logger -
connFacType -
space -
Throws:
JMSException
Method Detail

pingSpace

public boolean pingSpace()
Checks whether the space is alive and accessible.

Returns:
true if the space proxy is alive and accessible, else returns false.

initializeConnFactoryServices

public void initializeConnFactoryServices(String spaceURL,
                                          GSJMSAdmin jmsAdminInstance)
                                   throws JMSException
Sets the GigaSpaces space url, jmsAdminInstance and finds the space proxy. this method called from the GSJMSAdmin while getting conn factory.

Parameters:
spaceURL - might be null, in that case the client did not overwrite the default space url which was binded from the lookupanager during space load.
jmsAdminInstance -
Throws:
JMSException

getSpaceURL

public String getSpaceURL()
Returns:
String m_spaceURL

createConnection

public Connection createConnection()
                            throws JMSException
JMS API method

Specified by:
createConnection in interface ConnectionFactory
Throws:
JMSException

createConnection

public Connection createConnection(String userName,
                                   String password)
                            throws JMSException
JMS API method

Specified by:
createConnection in interface ConnectionFactory
Throws:
JMSException

createXAConnection

public XAConnection createXAConnection()
                                throws JMSException
Specified by:
createXAConnection in interface XAConnectionFactory
Throws:
JMSException

createXAConnection

public XAConnection createXAConnection(String userName,
                                       String password)
                                throws JMSException
Specified by:
createXAConnection in interface XAConnectionFactory
Throws:
JMSException

getCnxCounter

public int getCnxCounter()
Returns:
cnxC the number of connections associated to this factory

getAdmin

public GSJMSAdmin getAdmin()
                    throws JMSException
Returns:
admin
Throws:
JMSException

getLocalTransactionManager

public TransactionManager getLocalTransactionManager()
Returns:
LocalTransactionManager ltm