org.jacorb.orb.giop
Class GIOPConnection

java.lang.Object
  extended by java.io.OutputStream
      extended by org.jacorb.orb.giop.GIOPConnection
All Implemented Interfaces:
java.io.Closeable, java.io.Flushable
Direct Known Subclasses:
ClientGIOPConnection, ServerGIOPConnection

public abstract class GIOPConnection
extends java.io.OutputStream

GIOPConnection.java Created: Sun Aug 12 21:30:48 2002 Configuration parameters:
jacorb.debug.dump_incoming_messages=[on|off], default=off
jacorb.connection.client.connect_timeout=N, default=0
jacorb.connection.statistics_providers={classnames}, default=(empty)

Version:
$Id: GIOPConnection.java,v 1.66 2007/02/06 19:27:28 andre.spiegel Exp $
Author:
Nicolas Noffke

Field Summary
protected  java.lang.Object connect_sync
           
protected  ConnectionListener connection_listener
           
protected  boolean discard_messages
           
protected  boolean do_close
           
protected  org.apache.avalon.framework.logger.Logger logger
           
protected  java.lang.Object pendingUndecidedSync
           
protected  Profile profile
          Profile describing the remote endpoint of this connection.
protected  StatisticsProvider statistics_provider
           
protected  org.jacorb.orb.giop.StatisticsProviderAdapter statistics_provider_adapter
           
protected  Connection transport
           
 
Constructor Summary
GIOPConnection(Profile profile, Connection transport, RequestListener request_listener, ReplyListener reply_listener, StatisticsProvider statistics_provider)
           
 
Method Summary
static int allocate_cubby_id()
           
 void close()
           
 void configure(org.apache.avalon.framework.configuration.Configuration configuration)
           
 void decPendingMessages()
           
 void flush()
           
 java.lang.Object get_cubby(int id)
           
protected  RequestListener getRequestListener()
          Get the value of request_listener.
 StatisticsProvider getStatisticsProvider()
          Get the statistics provider for transport usage statistics that can be used in conjunction with the SelectionStrategy.
 StatisticsProvider getStatisticsProvider(int no)
          Return the StatissticsProvider, given the cardinality number
protected  org.jacorb.orb.giop.StatisticsProviderAdapter getStatisticsProviderAdapter()
          Get an instance of StatisticsProvider derivative, for updating the transport usage statistics.
 int getTCS()
           
 int getTCSW()
           
 Connection getTransport()
           
protected  void getWriteLock()
           
 boolean hasPendingMessages()
           
 void incPendingMessages()
           
 boolean isSSL()
           
 boolean isTCSNegotiated()
           
 void markTCSNegotiated()
           
protected abstract  void readTimedOut()
          Called by this.getMessage() to signal that the attempt to read a message resulted in a timeout.
 void receiveMessages()
           
protected  void releaseWriteLock()
           
 void sendReply(MessageOutputStream out)
           
 void sendRequest(MessageOutputStream out, boolean expect_reply)
           
 void set_cubby(int id, java.lang.Object obj)
           
 void setCodeSets(int TCS, int TCSW)
           
 void setConnectionListener(ConnectionListener connection_listener)
           
 void setReplyListener(ReplyListener listener)
          Set the value of reply_listener.
 void setRequestListener(RequestListener listener)
          Set the value of request_listener.
protected abstract  void streamClosed()
          Called by this.getMessage() to signal that the underlying transport was closed while attempting to read a message.
 void write(byte[] value)
           
 void write(byte[] fragment, int start, int size)
          write (a fragment of) the message (passes it on to the wire)
 void write(int value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

profile

protected final Profile profile
Profile describing the remote endpoint of this connection.


transport

protected Connection transport

connection_listener

protected ConnectionListener connection_listener

connect_sync

protected java.lang.Object connect_sync

logger

protected org.apache.avalon.framework.logger.Logger logger

discard_messages

protected boolean discard_messages

pendingUndecidedSync

protected java.lang.Object pendingUndecidedSync

do_close

protected boolean do_close

statistics_provider

protected StatisticsProvider statistics_provider

statistics_provider_adapter

protected org.jacorb.orb.giop.StatisticsProviderAdapter statistics_provider_adapter
Constructor Detail

GIOPConnection

public GIOPConnection(Profile profile,
                      Connection transport,
                      RequestListener request_listener,
                      ReplyListener reply_listener,
                      StatisticsProvider statistics_provider)
Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
               throws org.apache.avalon.framework.configuration.ConfigurationException
Throws:
org.apache.avalon.framework.configuration.ConfigurationException

setCodeSets

public final void setCodeSets(int TCS,
                              int TCSW)

getTCS

public final int getTCS()

getTCSW

public final int getTCSW()

markTCSNegotiated

public final void markTCSNegotiated()

isTCSNegotiated

public final boolean isTCSNegotiated()

getRequestListener

protected final RequestListener getRequestListener()
Get the value of request_listener.

Returns:
value of request_listener.

setRequestListener

public final void setRequestListener(RequestListener listener)
Set the value of request_listener.

Parameters:
listener - Value to assign to request_listener.

setReplyListener

public final void setReplyListener(ReplyListener listener)
Set the value of reply_listener.

Parameters:
listener - Value to assign to reply_listener.

setConnectionListener

public final void setConnectionListener(ConnectionListener connection_listener)

getTransport

public final Connection getTransport()

readTimedOut

protected abstract void readTimedOut()
Called by this.getMessage() to signal that the attempt to read a message resulted in a timeout. This method is implemented differently on the client and server side.


streamClosed

protected abstract void streamClosed()
Called by this.getMessage() to signal that the underlying transport was closed while attempting to read a message. This method is implemented differently on the client and server side.


receiveMessages

public final void receiveMessages()
                           throws java.io.IOException
Throws:
java.io.IOException

getWriteLock

protected final void getWriteLock()

releaseWriteLock

protected final void releaseWriteLock()

incPendingMessages

public final void incPendingMessages()

decPendingMessages

public final void decPendingMessages()

hasPendingMessages

public final boolean hasPendingMessages()

write

public final void write(byte[] fragment,
                        int start,
                        int size)
write (a fragment of) the message (passes it on to the wire)

Overrides:
write in class java.io.OutputStream

write

public final void write(int value)
                 throws java.io.IOException
Specified by:
write in class java.io.OutputStream
Throws:
java.io.IOException

write

public final void write(byte[] value)
                 throws java.io.IOException
Overrides:
write in class java.io.OutputStream
Throws:
java.io.IOException

flush

public final void flush()
                 throws java.io.IOException
Specified by:
flush in interface java.io.Flushable
Overrides:
flush in class java.io.OutputStream
Throws:
java.io.IOException

sendRequest

public final void sendRequest(MessageOutputStream out,
                              boolean expect_reply)
                       throws java.io.IOException
Throws:
java.io.IOException

sendReply

public final void sendReply(MessageOutputStream out)
                     throws java.io.IOException
Throws:
java.io.IOException

isSSL

public final boolean isSSL()

close

public void close()
Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.OutputStream

getStatisticsProviderAdapter

protected final org.jacorb.orb.giop.StatisticsProviderAdapter getStatisticsProviderAdapter()
Get an instance of StatisticsProvider derivative, for updating the transport usage statistics.


getStatisticsProvider

public final StatisticsProvider getStatisticsProvider()
Get the statistics provider for transport usage statistics that can be used in conjunction with the SelectionStrategy. This is a special-case provider, usually supplied by, and known to, the concrete SelectionStrategy. To actually update the usage stats use getStatisticsProviderAdapter()


getStatisticsProvider

public StatisticsProvider getStatisticsProvider(int no)
Return the StatissticsProvider, given the cardinality number

Parameters:
no -
Returns:

allocate_cubby_id

public static int allocate_cubby_id()

get_cubby

public java.lang.Object get_cubby(int id)

set_cubby

public void set_cubby(int id,
                      java.lang.Object obj)