public class ClientSessionFactoryImpl extends Object implements ClientSessionFactoryInternal, ConnectionLifeCycleListener
ClientSessionFactory| Modifier and Type | Class and Description |
|---|---|
class |
ClientSessionFactoryImpl.CloseRunnable |
| Modifier and Type | Field and Description |
|---|---|
static Set<ClientSessionFactoryImpl.CloseRunnable> |
CLOSE_RUNNABLES |
Exception |
traceException |
| Modifier and Type | Method and Description |
|---|---|
void |
addFailoverListener(FailoverEventListener listener)
Adds a FailoverEventListener to the session which is notified if a failover event occurs on the session.
|
void |
addFailureListener(SessionFailureListener listener) |
void |
causeExit() |
void |
cleanup()
Opposed to close, will call cleanup only on every created session and children objects.
|
void |
close()
Closes this factory and any session created by it.
|
void |
connect(int initialConnectAttempts,
boolean failoverOnInitialConnection) |
void |
connectionCreated(HornetQComponent component,
Connection connection,
String protocol)
This method is used both by client connector creation and server connection creation through
acceptors.
|
void |
connectionDestroyed(Object connectionID)
Called when a connection is destroyed.
|
void |
connectionException(Object connectionID,
HornetQException me)
Called when an error occurs on the connection.
|
void |
connectionReadyForWrites(Object connectionID,
boolean ready) |
ClientSession |
createSession()
Creates a non-transacted session.
|
ClientSession |
createSession(boolean autoCommitSends,
boolean autoCommitAcks)
Creates a session.
|
ClientSession |
createSession(boolean xa,
boolean autoCommitSends,
boolean autoCommitAcks)
Creates a session.
|
ClientSession |
createSession(boolean xa,
boolean autoCommitSends,
boolean autoCommitAcks,
boolean preAcknowledge)
Creates a session.
|
ClientSession |
createSession(boolean autoCommitSends,
boolean autoCommitAcks,
int ackBatchSize)
Creates a session.
|
ClientSession |
createSession(String username,
String password,
boolean xa,
boolean autoCommitSends,
boolean autoCommitAcks,
boolean preAcknowledge,
int ackBatchSize)
Creates an authenticated session.
|
ClientSession |
createTransactedSession()
Creates a transacted session.
|
ClientSession |
createXASession()
Creates a session with XA transaction semantics.
|
void |
disableFinalizeCheck() |
protected void |
finalize() |
Object |
getBackupConnector() |
ConfirmationWindowWarning |
getConfirmationWindowWarning() |
CoreRemotingConnection |
getConnection()
Returns the code connection used by this session factory.
|
Object |
getConnector() |
TransportConfiguration |
getConnectorConfiguration() |
ServerLocator |
getServerLocator() |
boolean |
isClosed() |
int |
numConnections() |
int |
numSessions() |
boolean |
removeFailoverListener(FailoverEventListener listener)
Removes a FailoverEventListener to the session.
|
boolean |
removeFailureListener(SessionFailureListener listener) |
void |
removeSession(ClientSessionInternal session,
boolean failingOver) |
void |
sendNodeAnnounce(long currentEventID,
String nodeID,
String nodeName,
boolean isBackup,
TransportConfiguration config,
TransportConfiguration backupConfig) |
void |
setBackupConnector(TransportConfiguration live,
TransportConfiguration backUp) |
void |
setReconnectAttempts(int attempts) |
void |
stopPingingAfterOne() |
String |
toString() |
public final Exception traceException
public static final Set<ClientSessionFactoryImpl.CloseRunnable> CLOSE_RUNNABLES
public void disableFinalizeCheck()
disableFinalizeCheck in interface ClientSessionFactoryInternalpublic void connect(int initialConnectAttempts,
boolean failoverOnInitialConnection)
throws HornetQException
connect in interface ClientSessionFactoryInternalHornetQExceptionpublic TransportConfiguration getConnectorConfiguration()
getConnectorConfiguration in interface ClientSessionFactoryInternalpublic void setBackupConnector(TransportConfiguration live, TransportConfiguration backUp)
setBackupConnector in interface ClientSessionFactoryInternalpublic Object getBackupConnector()
getBackupConnector in interface ClientSessionFactoryInternalpublic ClientSession createSession(String username, String password, boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge, int ackBatchSize) throws HornetQException
ClientSessionFactorycreateSession in interface ClientSessionFactoryusername - the user namepassword - the user passwordxa - whether the session support XA transaction semantic or notautoCommitSends - true to automatically commit message sends, false to commit manuallyautoCommitAcks - true to automatically commit message acknowledgement, false to commit manuallypreAcknowledge - true to pre-acknowledge messages on the server, false to let the client acknowledge the messagesHornetQException - if an exception occurs while creating the sessionpublic ClientSession createSession(boolean autoCommitSends, boolean autoCommitAcks, int ackBatchSize) throws HornetQException
ClientSessionFactorycreateSession in interface ClientSessionFactoryautoCommitSends - true to automatically commit message sends, false to commit manuallyautoCommitAcks - true to automatically commit message acknowledgement, false to commit manuallyackBatchSize - the batch size of the acknowledgementsHornetQException - if an exception occurs while creating the sessionpublic ClientSession createXASession() throws HornetQException
ClientSessionFactorycreateXASession in interface ClientSessionFactoryHornetQException - if an exception occurs while creating the sessionpublic ClientSession createTransactedSession() throws HornetQException
ClientSessionFactorycreateTransactedSession in interface ClientSessionFactoryHornetQException - if an exception occurs while creating the sessionClientSession.commit()public ClientSession createSession() throws HornetQException
ClientSessionFactorycreateSession in interface ClientSessionFactoryHornetQException - if an exception occurs while creating the sessionpublic ClientSession createSession(boolean autoCommitSends, boolean autoCommitAcks) throws HornetQException
ClientSessionFactorycreateSession in interface ClientSessionFactoryautoCommitSends - true to automatically commit message sends, false to commit manuallyautoCommitAcks - true to automatically commit message acknowledgement, false to commit manuallyHornetQException - if an exception occurs while creating the sessionpublic ClientSession createSession(boolean xa, boolean autoCommitSends, boolean autoCommitAcks) throws HornetQException
ClientSessionFactorycreateSession in interface ClientSessionFactoryxa - whether the session support XA transaction semantic or notautoCommitSends - true to automatically commit message sends, false to commit manuallyautoCommitAcks - true to automatically commit message acknowledgement, false to commit manuallyHornetQException - if an exception occurs while creating the sessionpublic ClientSession createSession(boolean xa, boolean autoCommitSends, boolean autoCommitAcks, boolean preAcknowledge) throws HornetQException
ClientSessionFactorycreateSession in interface ClientSessionFactoryxa - whether the session support XA transaction semantic or notautoCommitSends - true to automatically commit message sends, false to commit manuallyautoCommitAcks - true to automatically commit message acknowledgement, false to commit manuallypreAcknowledge - true to pre-acknowledge messages on the server, false to let the client acknowledge the messagesHornetQException - if an exception occurs while creating the sessionpublic void connectionCreated(HornetQComponent component, Connection connection, String protocol)
ConnectionLifeCycleListenercomponent parameter is normally passed as
null.
Leaving this method here and adding a different one at
ServerConnectionLifeCycleListener is a compromise for a reasonable split between the
hornetq-server and hornetq-client packages while avoiding to pull too much into hornetq-core.
The pivotal point keeping us from removing the method is ConnectorFactory and the
usage of it.
connectionCreated in interface ConnectionLifeCycleListenercomponent - This will probably be an Acceptor and only used on the server side.connection - the connection that has been createdprotocol - the messaging protocol type this connection usespublic void connectionDestroyed(Object connectionID)
ConnectionLifeCycleListenerconnectionDestroyed in interface ConnectionLifeCycleListenerconnectionID - the connection being destroyed.public void connectionException(Object connectionID, HornetQException me)
ConnectionLifeCycleListenerconnectionException in interface ConnectionLifeCycleListenerconnectionID - the id of the connection.me - the exception.public void removeSession(ClientSessionInternal session, boolean failingOver)
removeSession in interface ClientSessionFactoryInternalpublic void connectionReadyForWrites(Object connectionID, boolean ready)
connectionReadyForWrites in interface ConnectionLifeCycleListenerpublic int numConnections()
numConnections in interface ClientSessionFactoryInternalpublic int numSessions()
numSessions in interface ClientSessionFactoryInternalpublic void addFailureListener(SessionFailureListener listener)
addFailureListener in interface ClientSessionFactoryInternalpublic boolean removeFailureListener(SessionFailureListener listener)
removeFailureListener in interface ClientSessionFactoryInternalpublic void addFailoverListener(FailoverEventListener listener)
ClientSessionFactoryaddFailoverListener in interface ClientSessionFactorylistener - the listener to addpublic boolean removeFailoverListener(FailoverEventListener listener)
ClientSessionFactoryremoveFailoverListener in interface ClientSessionFactorylistener - the listener to removetrue if the listener was removed, false elsepublic void causeExit()
causeExit in interface ClientSessionFactoryInternalpublic void close()
ClientSessionFactoryclose in interface AutoCloseableclose in interface ClientSessionFactorypublic void cleanup()
ClientSessionFactorycleanup in interface ClientSessionFactorypublic boolean isClosed()
isClosed in interface ClientSessionFactorytrue if the factory is closed, false otherwise.public ServerLocator getServerLocator()
getServerLocator in interface ClientSessionFactorypublic void stopPingingAfterOne()
public CoreRemotingConnection getConnection()
ClientSessionFactorygetConnection in interface ClientSessionFactorypublic void sendNodeAnnounce(long currentEventID,
String nodeID,
String nodeName,
boolean isBackup,
TransportConfiguration config,
TransportConfiguration backupConfig)
sendNodeAnnounce in interface ClientSessionFactoryInternalprotected void finalize()
throws Throwable
public void setReconnectAttempts(int attempts)
setReconnectAttempts in interface ClientSessionFactoryInternalpublic Object getConnector()
getConnector in interface ClientSessionFactoryInternalpublic ConfirmationWindowWarning getConfirmationWindowWarning()
getConfirmationWindowWarning in interface ClientSessionFactoryInternalCopyright © 2013 JBoss, a division of Red Hat. All rights reserved.