[omniORB] interim patch for persistent object keys (omniORB 2.8.0 pre1)
Wil_Evers@doosys.com
Wil_Evers@doosys.com
Thu, 22 Jul 1999 11:00:20 GMT
--0__=cgcAktZQNa2KvTl2PERStSfdtGPZcA56RFb5GAiBYf8fGjNWp5UhZzkp
Content-type: text/plain; charset=us-ascii
Hi,
For those interested, attached to this message is a patch implementing
persistent, user-specified object keys for omniORB 2.8.0 pre-release 1.
Please beware that this patch is only meant as an interim solution until
omniORB supports the POA spec, which is expected to happen soon. For this
reason, the omniORB maintainers indicated it will probably not be
integrated in any official omniORB distribution.
The interface to the mechanism is declared in a new class called
omniORB::persistentLoader (header file omniORB.h), which has an interface
similar to omniORB::loader. omniORB::persistentLoader contains two static
member functions:
- a function (createPersistentObjectReference) to create a persistent
object reference for a CORBA object identified by interface repo id, TCP
host name (or stringified IP number), TCP port number, virtual server name,
and a user-specified, variable length object id. Note that this function
does NOT create an implementation object, only an object reference.
- a function (called 'set') to install a user-defined persistent loader
function that is called when a persistent object reference is detected by
the incoming message handler (GIOP driver). The job of the persistent
loader function is to examine the supplied virtual server name and object
id, and return a reference to another object, to which any requests will be
redirected. As for omniORB::loader::set(), the replacement object does not
have to live in the server's address space - it may even be another
persistent object reference. Returning a nil object reference causes a
CORBA::OBJECT_NOT_EXIST exception to be raised on the client side. Any
CORBA system exception (CORBA::TRANSIENT comes to mind) thrown from the
loader function is simply passed on to the client. The persistent loader
function is not thread safe: it may be called concurrently from multiple
threads.
The patch makes no attempt to retain the association between the incoming
persistent object keys and the user-supplied replacement objects.
So far, it has only been tested on RedHat Linux 5.2 with egcs 1.1.2.
Enjoy,
- Wil
Wil Evers, DOOSYS IT Consultants, Maarssen, Holland
(See attached file: pk280pr1.pat)
--0__=cgcAktZQNa2KvTl2PERStSfdtGPZcA56RFb5GAiBYf8fGjNWp5UhZzkp
Content-type: application/octet-stream;
name="pk280pr1.pat"
Content-Disposition: attachment; filename="pk280pr1.pat"
Content-transfer-encoding: base64
ZGlmZiAtYyAtTi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