org.openorb.orb.iiop
Class IIOPClientChannel

java.lang.Object
  |
  +--org.openorb.orb.iiop.IIOPClientChannel
All Implemented Interfaces:
Channel, ClientChannel

public class IIOPClientChannel
extends java.lang.Object
implements ClientChannel

Implements the ClientChannel interface for IIOP.

Version:
$Revision: 1.17 $ $Date: 2004/08/12 12:54:23 $
Author:
Chris Wood

Fields inherited from interface org.openorb.orb.net.ClientChannel
STATE_CLOSED, STATE_CONNECTED, STATE_PAUSED
 
Method Summary
 int active_requests()
          Active request count.
 int channel_age()
          Indication of channel age.
 void close(boolean kill_requests, org.omg.CORBA.SystemException ex)
          Change to the CLOSED state and reject new requests by throwing a system exception with status COMPLETED_NO.
protected  boolean connectionSCAdd(org.openorb.orb.iiop.IIOPClientRequest req)
          Add any neccicary conneciton SCs, and set the status to pending.
protected  void connectionSCCanceled()
          Change the status of any pending connection SCs to unsent.
protected  void connectionSCReset()
          Change the status of all connection SCs to unsent.
protected  void connectionSCSent()
          Change the status of any pending connection SCs to sent.
 ClientRequest create_locate_request(org.omg.CORBA.Object target, Address address)
          Create a locate request.
 ClientRequest create_request(org.omg.CORBA.Object target, Address address, java.lang.String operation, boolean response_expected)
          Create a request.
protected  void finalize()
          Finalize method closes channel.
 java.util.Map getActiveRequestMap()
          Return the array with active requests.
 int getChannelAge()
          Return the age of the channel.
 SocketQueue getSocketQueue()
          Return the socket queue.
 java.lang.Object getSyncState()
          Return the synchronization state of the client channel.
 int getTCSC()
          returns the selected char codeset.
 int getTCSW()
          Returns the selected wide char codeset.
 org.omg.CORBA.ORB orb()
          An orb reference.
 void pause()
          Begin the pausing sequence, enter the PAUSED state.
 boolean recv(int timeout)
          Wait the specified amount of time for an incoming message.
 void run_recv()
          Donate a thread for recieving messages.
 void setCloseException(org.omg.CORBA.SystemException closeex)
          Set the closing exception.
static void setIIOPClientRecvTimeout(int timeout)
          Set the IIOP client receive timeout.
 void setPendingClose()
          Set the channel to a closing state..
 void setServerPeer(IIOPServerChannel srvchan)
          Set this client's peer, which is usually the server.
 void setState(int state)
          Sets the state of the channel.
 void setTCSC(int tcsc)
          Sets the selected char codeset.
 void setTCSW(int tcsw)
          Sets the selected wide char codeset.
 int state()
          Connection state.
 java.lang.String toString()
          Returns a stringified representation of this class.
 Transport transport()
          Obtain the transport which created this channel.
 org.omg.IIOP.Version version()
          Return the GIOP/IIOP version
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

transport

public Transport transport()
Obtain the transport which created this channel.
Specified by:
transport in interface Channel
Returns:
The Transport which created this channel.

setIIOPClientRecvTimeout

public static void setIIOPClientRecvTimeout(int timeout)
Set the IIOP client receive timeout.
Parameters:
timeout - The new timeout value.

getActiveRequestMap

public java.util.Map getActiveRequestMap()
Return the array with active requests.
Returns:
The active requests.

getSocketQueue

public SocketQueue getSocketQueue()
Return the socket queue.
Returns:
The socket queue.

getSyncState

public java.lang.Object getSyncState()
Return the synchronization state of the client channel.
Returns:
The synchronization state.

getChannelAge

public int getChannelAge()
Return the age of the channel.
Returns:
The channel's age.

setServerPeer

public void setServerPeer(IIOPServerChannel srvchan)
Set this client's peer, which is usually the server.
Parameters:
srvchan - The server channel.

setCloseException

public void setCloseException(org.omg.CORBA.SystemException closeex)
Set the closing exception.
Parameters:
closeex -  

getTCSC

public int getTCSC()
returns the selected char codeset.
Returns:
The char codeset.

setTCSC

public void setTCSC(int tcsc)
Sets the selected char codeset.
Parameters:
tcsc - The char codest.

getTCSW

public int getTCSW()
Returns the selected wide char codeset.
Returns:
The wide char codeset.

setTCSW

public void setTCSW(int tcsw)
Sets the selected wide char codeset.
Parameters:
tcsw - The wide char codeset.

setPendingClose

public void setPendingClose()
Set the channel to a closing state..

orb

public org.omg.CORBA.ORB orb()
Description copied from interface: ClientChannel
An orb reference.
Specified by:
orb in interface ClientChannel

state

public int state()
Connection state. Note that state values are 0x1000000 apart, Allowing this value to be ORed with the binding priority.
Specified by:
state in interface ClientChannel

setState

public void setState(int state)
Sets the state of the channel.
Parameters:
state - The state to switch this channel into.

toString

public java.lang.String toString()
Returns a stringified representation of this class.
Overrides:
toString in class java.lang.Object
Returns:
A string representation of useful information of this class.

version

public org.omg.IIOP.Version version()
Return the GIOP/IIOP version

active_requests

public int active_requests()
Active request count. This is the number of requests which have not yet been sent or are still expecting a reply.
Specified by:
active_requests in interface Channel

channel_age

public int channel_age()
Indication of channel age. This will result in a call to peek_request_id if active_requests would be non-zero, otherwise it returns whatever peek_request_id returned the last time active_requests dropped to zero.
Specified by:
channel_age in interface Channel

pause

public void pause()
Begin the pausing sequence, enter the PAUSED state. As soon as work_pending returns false this will close the connection.
Specified by:
pause in interface ClientChannel

close

public void close(boolean kill_requests,
                  org.omg.CORBA.SystemException ex)
Change to the CLOSED state and reject new requests by throwing a system exception with status COMPLETED_NO. If kill_requests is true, call cancel on any active ClientRequests, otherwise wait until they complete before closing.
Specified by:
close in interface ClientChannel

create_request

public ClientRequest create_request(org.omg.CORBA.Object target,
                                    Address address,
                                    java.lang.String operation,
                                    boolean response_expected)
                             throws RebindChannelException
Create a request. If this is the first request on this channel then client_connect will be called on all ChannelInterceptor before returning the request. This may throw a system exception if the channel cannot establish a connection for some reason, for example INV_POLICY if client side policies prevent a successfull invocation, COMM_FAILURE if a communication problem occours, or REBIND if channel is temporaraly closed and a NO_REBIND policy is in effect.
Specified by:
create_request in interface ClientChannel
Parameters:
target - The target of the request.
address - The target address. If the target has been redirected this may not correspond to the target's ior.

create_locate_request

public ClientRequest create_locate_request(org.omg.CORBA.Object target,
                                           Address address)
                                    throws RebindChannelException
Create a locate request. This may throw a system exception if the channel cannot establish a connection for some reason, for example INV_POLICY if client side policies prevent a successfull invocation, COMM_FAILURE if a communication problem occours, or REBIND if channel is temporaraly closed and a NO_REBIND policy is in effect.
Specified by:
create_locate_request in interface ClientChannel
Parameters:
target - The target of the request.
address - The target address. If the target has been redirected this may not correspond to the target's ior.

connectionSCAdd

protected boolean connectionSCAdd(org.openorb.orb.iiop.IIOPClientRequest req)
Add any neccicary conneciton SCs, and set the status to pending.
Returns:
true if a connection SC is now pending

connectionSCSent

protected void connectionSCSent()
Change the status of any pending connection SCs to sent.

connectionSCCanceled

protected void connectionSCCanceled()
Change the status of any pending connection SCs to unsent.

connectionSCReset

protected void connectionSCReset()
Change the status of all connection SCs to unsent.

recv

public boolean recv(int timeout)
Wait the specified amount of time for an incoming message.
Specified by:
recv in interface Channel
Returns:
false if the channel is closed.

run_recv

public void run_recv()
Donate a thread for recieving messages. This function returns when interrupt is called on the thread or the channel is closed.
Specified by:
run_recv in interface Channel

finalize

protected void finalize()
                 throws java.lang.Throwable
Finalize method closes channel.
Overrides:
finalize in class java.lang.Object