![]() |
![]() A correction on Events (Chapter 19)
A correction on Events (Chapter 19)
What's really happening is that the event channel asks pull servers for events all the time. If they don't have an event when asked, they block inside the pull () request method until they have an event, at which point they return it. The event channel will then turn right around and ask for another event. This happens to all the pull servers, regardless of how many of them there are. To the client, the behavior is the same as described in the book...
they ask for an event, and if one is available it is given to them. If
one is not, they block, waiting for the next event. If they don't want
to block, they can use the try_pull() method to get an event if one is
available. If one isn't, then a flag is set indicating the try_pull() failed.
Thanks to Michi Henning, Triodia Technologies (michi@triodia.com) for pointing
this out.
Chapter 18 Naming Service... where are the example files?
SimpleNames.h
SimpleNames.java -- in Examples\Chapter8, Examples\Chapter9\NSVersion, Examples\Chapter11, or Examples\Chapter12 (all the same code, exactly. Sorry about that! Also, the example presented in Chapter 14, starting
at page 255, shows how to search a Naming Context as outlined in Chapter
18, page 298, "General Searching"
Exception Handling and DII (Chapter 14)
As suggested in the book, you should always wrap your invoke(), send_oneway(), send_deferred(), poll_response(), and get_response() calls in try/catch blocks so you can catch system exceptions. Server side system exceptions and user-defined exceptions won't ever be thrown when using the DII/DSO. Instead, you must check the environment returned with the results to see if the server raised an exception. The C++ and Java language bindings in the CORBA 2.2 Spec show this in
detail:
// C++ Request_ptr req = anObj->_request("anOp"); req->add_in_arg() <<= anArg; // ... req->invoke(); if (req->env()->exception() == NULL) { // No Exception req->return_value() >>= aResult; }
ExceptionList_ptr is a pointer to an ExceptionList object:
class ExceptionList { public: ULong count(); void add(TypeCode_ptr tc); void add_consume(TypeCode_ptr tc); TypeCode_ptr item(ULong index); Status remove(ULong index); };
req->env()->exception()->item(0);
Object activation with Visibroker for Java (Ch 11)
"-r IDL:Servers/Hello:1.0"
module Servers { interface Hello { string SayHello(); string SayGoodbye(); }; };
<li> <b>Repository Identifier</b> IDL:Servers/Hello:1.0
|