org.openorb.iiop
Class IIOPClientChannel

java.lang.Object
  |
  +--org.openorb.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.20 $ $Date: 2002/09/26 08:16:45 $
Author:
Chris Wood

Fields inherited from interface org.openorb.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, SystemException ex)
          Change to the CLOSED state and reject new requests by throwing a system exception with status COMPLETED_NO.
 ClientRequest create_locate_request(Object target, Address address, java.lang.Object tpAssc)
          Create a locate request.
 ClientRequest create_request(Object target, Address address, java.lang.Object tpAssc, java.lang.String operation, boolean response_expected)
          Create a request.
 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.
 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(SystemException closeex)
          Set the closing exception.
 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.
 Version version()
          Return the GIOP/IIOP version
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

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(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 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 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,
                  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(Object target,
                                    Address address,
                                    java.lang.Object tpAssc,
                                    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(Object target,
                                           Address address,
                                           java.lang.Object tpAssc)
                                    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.

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