All of the connection management APIs are encapsulated in IDL.
ORBLink::Junction
:
module ORBLink{ pseudo interface Junction { readonly attribute value socket; unsigned long SecondsIdle(); boolean isOpen(); };
The attributes and operations supported by the ORBLink::Junction
pseudointerface (which is to say, the Lisp class
named orblink:junction
:
socket
attribute of ORBLink::Junction
is an opaque Lisp type corresponding to the
underlying socket stream.
SecondsIdle()
operation gives the number
of seconds the junction has been idle. It is reset to 0
on creation or I/O activity, but information requests do not
result in resetting the idle time.
isOpen()
operation returns T
if and only if the junction is actively forwarding messages, that is if its state is open
. This state can be set to closed by
the ActiveJunction::close()
operation.
module ORBLink {... pseudo interface ActiveJunction : Junction { readonly attribute unsigned long MessagesReceived; readonly attribute string RemoteHost; readonly attribute unsigned long RemotePort; void close(); }; pseudo interface PassiveJunction : Junction {;}; pseudo interface ClientJunction : ActiveJunction {;}; pseudo interface ServerJunction : ActiveJunction {}; }; };Any junction instance is an instance of one of three disjoint classes:
Orblink:ClientJunction
An instance of ORBLink:ClientJunction
is responsible for forwarding
messages, normally request messages, from a CORBA client to a CORBA server.
ORBLink:ServerJunction
An
instance of ORBLink:ServerJunction
is responsible for forwarding
messages, normally replies, from a CORBA server to a CORBA client.
ORBLink:PassiveJunction
.
An
instance of ORBLink:PassiveJunction
is responsible for listening to
connection requests from prospective clients and allocating Server
junctions as necessary to handle the resulting connections.
ActiveJunction
Orblink:ActiveJunction
is either an instance of orblink:clientjunction
or an instance
of orblink:serverjunction
.
The attributes supported by the pseudo-interface ORBLink::ActiveJunction
are:
MessagesReceived
attribute gives the number of messages that have
been received.
RemoteHost
attribute gives the name of the host
to which the active junction is connected.
RemotePort
attribute is
the remote port of the corresponding socket.
An instance of orblink:activejunction
also supports the close
operation. When invoked on a junction, the close
operation:
isOpen()
operation will return nil
socket
attribute if it is an open stream.
An active junction also closes itself if its associated socket
stream signals an I/O error,
including an EOF error.
ServerJunction
is closed, it removes
itself from the list of ServerJunctions maintained by the ORB in its
ServerJunctions
attribute; it cannot be reused.
ClientJunction
junction is closed, however, it is reopened when a new Request
is invoked through that junction.
The ORB itself offers facilities for listing the available junctions and for customizing the behavior of a junction on closure:
module ORBLink { pseudo interface ORB : CORBA::ORB{ readonly attribute ServerJunctionList ServerJunctions; readonly attribute ClientJunctionList ClientJunctions; readonly attribute PassiveJunctionList PassiveJunctions; }; };
The ORBLink::ORB::ServerJunctions
, ORBLink::ORB::ClientJunctions
, and ORBLink::ORB::PassiveJunctions
attributes
contain lists of the operational junctions of the appropriate type.
Thus, the forms:
(op:serverjunctions corba:orb) (op:clientjunctions corba:orb) (op:passivejunctions corba:orb)
Will return lists (or sequences) of the server, client, and passive junctions.
The behavior of junctions on closure is determined by the following pseudo-IDL:
module ORBLink { pseudo interface ORB : CORBA::ORB{ attribute boolean HandleJunctionClosePolicy; void HandleJunctionClose (in Junction j); }
When the value of the HandleJunctionClosePolicy
attribute of the corba:orb
singleton
is nil
, junction closure operates normally.
When the value of the
HandleJunctionClosePolicy
attribute of the corba:orb
singleton is T
, on the other
hand, after a junction j
is closed the HandleJunctionClose
operation
of the CORBA:ORB
object is invoked with parameter of j
. In this case,
the user should override the definition of HandleJunctionClose
.
For example, the following set of definitions will print a message whenever a junction is closed:
(corba:define-method HandleJunctionClose ((orb ORBLink:ORB) junction) (format t "HandleJunctionClose: closed junction: ~s ~%" junction) (force-output) ) (setf (op:HandleJunctionClosePolicy CORBA:ORB) T)
The behavior of the ORB on a server junction error (that is, an I/O error, as contrasted with an error signalled by a servant) is also customizable. It is encapsulated in the ORB IDL:
module ORBLink { pseudo interface ORB : CORBA::ORB{ enum ServerJunctionErrorPolicyType {continue, debug, handle}; attribute ServerJunctionErrorPolicyType ServerJunctionErrorPolicy; }; };Because a junction error results in a junction close, normally customization of the close method is sufficient.
The server junction error handling is determined by the
ServerJunctionErrorPolicy
attribute of CORBA:ORB
:
:continue
, the error is ignored.
:debug
, a debugger is
invoked.
:handle
. the HandleJunctionError
operation
on the CORBA:ORB
object is invoked with parameters the server junction
that caused the error and the error itself.
:continue
.
Client junction errors are normally signalled back to the invoking client; thus, client junction error customization is not exposed in this API.