org.jboss.narayana.blacktie.jatmibroker.xatmi.impl
Class ConnectionImpl

java.lang.Object
  extended by org.jboss.narayana.blacktie.jatmibroker.xatmi.impl.ConnectionImpl
All Implemented Interfaces:
Connection

public class ConnectionImpl
extends Object
implements Connection

This is the connection to remote BlackTie services. It must be created using the ConnectionFactory.

See Also:
ConnectionFactoryImpl#getConnection()

Field Summary
 
Fields inherited from interface org.jboss.narayana.blacktie.jatmibroker.xatmi.Connection
TPCONV, TPEBADDESC, TPEBLOCK, TPEEVENT, TPEINVAL, TPEITYPE, TPELIMIT, TPEMATCH, TPENOENT, TPEOS, TPEOTYPE, TPEPROTO, TPESVCERR, TPESVCFAIL, TPESYSTEM, TPETIME, TPETRAN, TPEV_DISCONIMM, TPEV_SENDONLY, TPEV_SVCERR, TPEV_SVCFAIL, TPEV_SVCSUCC, TPFAIL, TPGETANY, TPGOTSIG, TPNOBLOCK, TPNOCHANGE, TPNOREPLY, TPNOTIME, TPNOTRAN, TPRECVONLY, TPSENDONLY, TPSIGRSTRT, TPSUCCESS, TPTRAN, XATMI_SERVICE_NAME_LENGTH
 
Constructor Summary
ConnectionImpl(ConnectionFactory connectionFactory, Properties properties)
          The connection
 
Method Summary
 void close()
          Close any resources associated with this connection
 SessionImpl createServiceSession(String name, int cd, Object replyTo)
          Used by the service side to create a session for handling the client request.
 boolean hasOpenSessions()
          Does this connection have any open sessions? Used to determine if a service has unanswered requests prior to a tpreturn.
 int tpacall(String svc, Buffer toSend, int flags)
          Asynchronous call
 Buffer tpalloc(String type, String subtype)
          Allocate a new buffer
 Response tpcall(String svc, Buffer buffer, int flags)
          Synchronous call.
 int tpcancel(int cd)
          Cancel the outstanding asynchronous call.
 Session tpconnect(String svc, Buffer toSend, int flags)
          Handle the initiation of a conversation with the server.
 Response tpgetrply(int cd, int flags)
          Get the reply for an asynchronous call.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionImpl

public ConnectionImpl(ConnectionFactory connectionFactory,
                      Properties properties)
               throws org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException
The connection

Parameters:
connectionFactory - The connection factory that created this connection.
properties - The properties that this connection was created with.
Throws:
org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException
Method Detail

tpalloc

public Buffer tpalloc(String type,
                      String subtype)
               throws ConnectionException,
                      org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException
Allocate a new buffer

Specified by:
tpalloc in interface Connection
Parameters:
type - The type of the buffer
subtype - The subtype of the buffer
Returns:
The new buffer
Throws:
ConnectionException - If the buffer was unknown or invalid.
org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException

tpcall

public Response tpcall(String svc,
                       Buffer buffer,
                       int flags)
                throws ConnectionException,
                       org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException
Synchronous call.

Specified by:
tpcall in interface Connection
Parameters:
svc - The name of the service to call
buffer - The inbound data
flags - The flags to use
Returns:
The returned buffer
Throws:
ConnectionException - If the service cannot be contacted.
org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException

tpacall

public int tpacall(String svc,
                   Buffer toSend,
                   int flags)
            throws ConnectionException
Asynchronous call

Specified by:
tpacall in interface Connection
Parameters:
svc - The name of the service to call
toSend - The inbound data
flags - The flags to use
Returns:
The connection descriptor
Throws:
ConnectionException - If the service cannot be contacted.

tpcancel

public int tpcancel(int cd)
             throws ConnectionException
Cancel the outstanding asynchronous call.

Specified by:
tpcancel in interface Connection
Parameters:
cd - The connection descriptor
Throws:
ConnectionException - If the client cannot be cleaned up.

tpgetrply

public Response tpgetrply(int cd,
                          int flags)
                   throws ConnectionException,
                          org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException
Get the reply for an asynchronous call.

Specified by:
tpgetrply in interface Connection
Parameters:
cd - The connection descriptor to use
flags - The flags to use
Returns:
The response from the server
Throws:
ConnectionException - If the service cannot be contacted.
org.jboss.narayana.blacktie.jatmibroker.core.conf.ConfigurationException

tpconnect

public Session tpconnect(String svc,
                         Buffer toSend,
                         int flags)
                  throws ConnectionException
Handle the initiation of a conversation with the server.

Specified by:
tpconnect in interface Connection
Parameters:
svc - The name of the service
toSend - The outbound buffer
flags - The flags to use
Returns:
The connection descriptor
Throws:
ConnectionException - If the service cannot be contacted.

close

public void close()
           throws ConnectionException
Close any resources associated with this connection

Specified by:
close in interface Connection
Throws:
ConnectionException - If an open session cannot be cancelled or disconnected.

createServiceSession

public SessionImpl createServiceSession(String name,
                                        int cd,
                                        Object replyTo)
                                 throws ConnectionException
Used by the service side to create a session for handling the client request.

Parameters:
name - The name of the service.
cd - The connection descriptor
replyTo - The client to respond to
Returns:
The session to use for the service invocation
Throws:
ConnectionException - In case the transport cannot be established.

hasOpenSessions

public boolean hasOpenSessions()
Does this connection have any open sessions? Used to determine if a service has unanswered requests prior to a tpreturn.

Returns:
True, if there are open conversations or asynchronous XATMI calls open.


Copyright © 2013. All Rights Reserved.