com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl Class Reference

This class represents the logical connection between a com.pcbsys.nirvana.client.nSession and a realm server. More...

Inherits com.pcbsys.nirvana.base.clientimpl.ClientConnectionManager.

Public Member Functions

void addReconnectHandler (nReconnectHandler handler)
 Registers a handler to monitor the state of this connection. More...
 
 ClientConnectionManagerImpl (String myUniqueClientAllocatedID, nSession session, SessionAttributes sessionAttributes, nThreadManager threadManager, nQueueReaderManagerHelper queueReaderManagerHelper, nDataGroupManagerHelper dataGroupManagerHelper, nChannelIteratorHelper channelIteratorManagerHelper, nRedirectManagerHelper redirectManagerHelper, nStoreManagerHelper storeManagerHelper, nDurableHelper durableManagerHelper, String username, String password, boolean isAdminApi)
 The constructor of connection manager. More...
 
void close ()
 Closes all state related to this connection.
 
void configureMultiplexManager (ClientConnectionManager myConnectionManager)
 This method will add a multiplex manager. More...
 
String getLocalHostAndPort () throws nSessionNotConnectedException
 Creates a string of the current host and port we are bound to locally. More...
 
String getServerProvidedRealmName () throws nSessionNotConnectedException
 Returns the currently connected to realms' name. More...
 
List< fConnectionDetails > getSessionAttributesList ()
 Flattens the list of lists into a single connection details list. More...
 
String getThirdPartyCookies () throws nSessionNotConnectedException
 When using URL drivers there was desire to be able to access the cookie being provided, very limited use cases. More...
 
nDataStream initialise (nDataStreamListener streamListener, EventHandlerInitialiser eventHandlerInitialiser, boolean disconnectOnClusterFailure, boolean sessionThreadsDaemon) throws nRealmUnreachableException, nSessionNotConnectedException, nSecurityException
 This will start fDriver connections thus begining this connections life. More...
 
void registerExtensionCallback (nServerExtensionCallback callback)
 A API used only by terracotta CLC, once we confirm its dead we can remove this. More...
 
void releaseRequests ()
 This method will release all outstanding events waiting for response from the server, it is detramental to those outstanding events state so use carefully.
 
void removeReconnectHandler (nReconnectHandler handler)
 Removes the handler if registered to monitor the state of this connection. More...
 
void setHTTPURLParameters (String parameter)
 This is a very bad hack to set headers, we really need to remove the static nature of this and set it on a individual session basis. More...
 
void setKeepAliveTimeOnCurrentConnection (long time)
 Used to update the keep alive interval. More...
 
void unblockThread (String name)
 Used when a thread is being asked to stop and has an outstanding request from the server, it is detrimental to that event instance state however we are usually closing. More...
 
- Public Member Functions inherited from com.pcbsys.nirvana.base.clientimpl.ClientConnectionManager
nDataStream initialise (nDataStreamListener streamListener, EventHandlerInitialiser eventHandlerInitialser, boolean disconnectOnClusterFailure, boolean sessionThreadsDaemon) throws nRealmUnreachableException, nSessionNotConnectedException, nSecurityException
 This will start fDriver connections thus begining this connections life. More...
 

Detailed Description

This class represents the logical connection between a com.pcbsys.nirvana.client.nSession and a realm server.

It encompasses all stores, handlers and state that has context between a fConnection and a server as opposed to a nSession.

Constructor & Destructor Documentation

com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.ClientConnectionManagerImpl ( String  myUniqueClientAllocatedID,
nSession  session,
SessionAttributes  sessionAttributes,
nThreadManager  threadManager,
nQueueReaderManagerHelper  queueReaderManagerHelper,
nDataGroupManagerHelper  dataGroupManagerHelper,
nChannelIteratorHelper  channelIteratorManagerHelper,
nRedirectManagerHelper  redirectManagerHelper,
nStoreManagerHelper  storeManagerHelper,
nDurableHelper  durableManagerHelper,
String  username,
String  password,
boolean  isAdminApi 
)

The constructor of connection manager.

Parameters
myUniqueClientAllocatedIDThis is the unique session ID allocated to this complete nSessions life time
sessionthe nSession this manager belongs too.
sessionAttributesthe attributes this connection manager will use to to configure the connection
threadManagerthe thread pool allocated for use by this connection manager it is used for stores, callbacks etc
queueReaderManagerHelperUsed to bypass package restrictions without exposing API
dataGroupManagerHelperUsed to bypass package restrictions without exposing API
channelIteratorManagerHelperUsed to bypass package restrictions without exposing API
redirectManagerHelperUsed to bypass package restrictions without exposing API
storeManagerHelperUsed to bypass package restrictions without exposing API
durableManagerHelperUsed to bypass package restrictions without exposing API
usernameThe username to use for logging to the realm
passwordThe password to use for logging to the realm

Member Function Documentation

void com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.addReconnectHandler ( nReconnectHandler  handler)

Registers a handler to monitor the state of this connection.

Parameters
handlerthe object used when callbacks happen
void com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.configureMultiplexManager ( ClientConnectionManager  myConnectionManager)

This method will add a multiplex manager.

Parameters
myConnectionManagerthe connection manager to add the fConnections
String com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.getLocalHostAndPort ( ) throws nSessionNotConnectedException

Creates a string of the current host and port we are bound to locally.

Returns
string of the current connection locally
Exceptions
nSessionNotConnectedExceptionif we are currently not connected
String com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.getServerProvidedRealmName ( ) throws nSessionNotConnectedException

Returns the currently connected to realms' name.

Returns
string equal to the currently connected realm name
Exceptions
nSessionNotConnectedExceptionif the session is not currently connected
List<fConnectionDetails> com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.getSessionAttributesList ( )

Flattens the list of lists into a single connection details list.

Returns
list of all connection details
String com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.getThirdPartyCookies ( ) throws nSessionNotConnectedException

When using URL drivers there was desire to be able to access the cookie being provided, very limited use cases.

Think JPMM

Returns
string representing the cookie we received
Exceptions
nSessionNotConnectedExceptionif we are currently not connected
nDataStream com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.initialise ( nDataStreamListener  streamListener,
EventHandlerInitialiser  eventHandlerInitialiser,
boolean  disconnectOnClusterFailure,
boolean  sessionThreadsDaemon 
) throws nRealmUnreachableException, nSessionNotConnectedException, nSecurityException

This will start fDriver connections thus begining this connections life.

Parameters
streamListenerwill allo data stream events into this session if set otherwise they are not enabled for DG
eventHandlerInitialiserThis method will configure event handlers for events we receive from the server
disconnectOnClusterFailureThis is a temporary hack as the two methods in nSession setting these must go
sessionThreadsDaemonThis is a temporary hack as the two methods in nSession setting these must go
Returns
the data stream object that this connection will use
Exceptions
nRealmUnreachableExceptionIf we cannot connect to any realm in the provided list
nSessionNotConnectedExceptionIf after creating the fConnection but before finishing the handshake we are disconnected, this could be for many reasons like ACL's networks etc
nSecurityExceptionIf we do not have permission to connect to this realm, its considered a permanent failure
void com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.registerExtensionCallback ( nServerExtensionCallback  callback)

A API used only by terracotta CLC, once we confirm its dead we can remove this.

Parameters
callbackthe callback to use for this api
void com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.removeReconnectHandler ( nReconnectHandler  handler)

Removes the handler if registered to monitor the state of this connection.

Parameters
handlerthe object to remove
void com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.setHTTPURLParameters ( String  parameter)

This is a very bad hack to set headers, we really need to remove the static nature of this and set it on a individual session basis.

Parameters
parameterthe new HTTPURLParameter to set
void com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.setKeepAliveTimeOnCurrentConnection ( long  time)

Used to update the keep alive interval.

Parameters
timethe interval to set if possible
void com.pcbsys.nirvana.base.clientimpl.singleconnection.ClientConnectionManagerImpl.unblockThread ( String  name)

Used when a thread is being asked to stop and has an outstanding request from the server, it is detrimental to that event instance state however we are usually closing.

Parameters
namethe name of the thread we want to interrupt