diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-10-12 22:22:31 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1997-10-12 22:22:31 +0000 |
commit | a5871ecd93cff36516638a5a1e028bc134c54354 (patch) | |
tree | 81a6d84197f45df4e3d1dd8f649f5ca412639ce7 /TAO | |
parent | a033a40ff39c2172b517fa6413ea4902f6cd20c2 (diff) | |
download | ATCD-a5871ecd93cff36516638a5a1e028bc134c54354.tar.gz |
*** empty log message ***
Diffstat (limited to 'TAO')
-rw-r--r-- | TAO/ChangeLog-98c | 23 | ||||
-rw-r--r-- | TAO/tao/client_factory.h | 12 | ||||
-rw-r--r-- | TAO/tao/client_factory.i | 2 | ||||
-rw-r--r-- | TAO/tao/corba.h | 1 | ||||
-rw-r--r-- | TAO/tao/default_client.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/default_client.h | 8 | ||||
-rw-r--r-- | TAO/tao/default_server.cpp | 9 | ||||
-rw-r--r-- | TAO/tao/giop.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/orbobj.cpp | 78 | ||||
-rw-r--r-- | TAO/tao/orbobj.h | 46 |
10 files changed, 119 insertions, 64 deletions
diff --git a/TAO/ChangeLog-98c b/TAO/ChangeLog-98c index 1947d496bd3..a2de007edbe 100644 --- a/TAO/ChangeLog-98c +++ b/TAO/ChangeLog-98c @@ -1,3 +1,26 @@ +Sun Oct 12 15:38:35 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu> + + * tao/orbobj.cpp (perform_work): Updated the run() and perform_work() + methods to take optional ACE_Time_Value *'s and to return error + flags if things go wrong. + + * tao/orbobj.h (CORBA_ORB): Changed the set_up_for_listening() + call to open(), which is more consistent with other usage in + ACE/TAO. + + * tao/orbobj: Changed the name client_acceptor_ to peer_acceptor_ + to reflect the fact that the connection model is more generic + than the notion of client/server interactions (which really take + place as the result of particular communication roles). + + * tao/corba.h: Moved the order of #includes around so that + "connect.h" is included before "client_factory.h" + + * tao/connect.h: Moved the typedef of the ACE_Strategy_Connector<> + from the TAO_Client_Strategy_Factory into the global space and + renamed it TAO_CONNECTOR file so that it will be equivalent with + the TAO_ACCEPTOR. + Thu Oct 9 23:17:37 1997 Douglas C. Schmidt <schmidt@merengue.cs.wustl.edu> * tao/giop.cpp (invoke): If an error occurs, make sure to mark the diff --git a/TAO/tao/client_factory.h b/TAO/tao/client_factory.h index 9b861ea1f11..ce00e786607 100644 --- a/TAO/tao/client_factory.h +++ b/TAO/tao/client_factory.h @@ -31,8 +31,8 @@ class TAO_Client_Connection_Handler : public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_NULL_SYNCH> // = TITLE - // <Svc_Handler> used on the client side and returned - // by the <TAO_Client_Factory::CONNECTOR>. + // <Svc_Handler> used on the client side and returned by the + // <TAO_CONNECTOR>. // @@ Should this be in here or in the default_client.*? { public: @@ -55,6 +55,10 @@ private: // True value indicates that something is using this handler. }; +// This is equivalent to the TAO_ACCEPTOR. +typedef ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR> + TAO_CONNECTOR; + class TAO_Client_Strategy_Factory : public ACE_Service_Object // = TITLE // Abstract factory used by the client to manufacture various @@ -69,8 +73,6 @@ public: // Destructor // = Client-side strategy types. - typedef ACE_Strategy_Connector<TAO_Client_Connection_Handler, ACE_SOCK_CONNECTOR> - CONNECTOR; typedef ACE_NOOP_Creation_Strategy<TAO_Client_Connection_Handler> NULL_CREATION_STRATEGY; @@ -82,7 +84,7 @@ public: virtual CONCURRENCY_STRATEGY *concurrency_strategy (void); #endif /* TAO_HAS_CLIENT_CONCURRENCY */ - virtual CONNECTOR *connector (void); + virtual TAO_CONNECTOR *connector (void); // Return a pointer to a connector using appropriate strategies. }; diff --git a/TAO/tao/client_factory.i b/TAO/tao/client_factory.i index d6809f0fcee..18024d7a668 100644 --- a/TAO/tao/client_factory.i +++ b/TAO/tao/client_factory.i @@ -15,7 +15,7 @@ TAO_Client_Connection_Handler::in_use (CORBA::Boolean flag) in_use_ = flag; } -ACE_INLINE TAO_Client_Strategy_Factory::CONNECTOR * +ACE_INLINE TAO_CONNECTOR * TAO_Client_Strategy_Factory::connector (void) { return 0; diff --git a/TAO/tao/corba.h b/TAO/tao/corba.h index 90f53e346a2..32b14c79208 100644 --- a/TAO/tao/corba.h +++ b/TAO/tao/corba.h @@ -70,7 +70,6 @@ #include "tao/boa.h" #include "tao/params.h" -//#include "tao/factories.h" #include "tao/client_factory.h" #include "tao/client_factory.h" #include "tao/server_factory.h" diff --git a/TAO/tao/default_client.cpp b/TAO/tao/default_client.cpp index b0d45a2bb5f..5affd8ab1ca 100644 --- a/TAO/tao/default_client.cpp +++ b/TAO/tao/default_client.cpp @@ -48,7 +48,7 @@ TAO_Default_Client_Strategy_Factory::init (int argc, char *argv[]) return this->parse_args (argc, argv); } -TAO_Client_Strategy_Factory::CONNECTOR * +TAO_CONNECTOR * TAO_Default_Client_Strategy_Factory::connector (void) { return &this->connector_; diff --git a/TAO/tao/default_client.h b/TAO/tao/default_client.h index 7e304157cc3..6e8ec64c99f 100644 --- a/TAO/tao/default_client.h +++ b/TAO/tao/default_client.h @@ -52,7 +52,7 @@ public: ACE_SYNCH_RW_MUTEX> CACHED_CONNECT_STRATEGY; - virtual TAO_Client_Strategy_Factory::CONNECTOR *connector (void); + virtual TAO_CONNECTOR *connector (void); // Return a pointer to a connector using appropriate strategies. // = Service Configurator hooks. @@ -64,8 +64,6 @@ public: private: - // @@ Chris, please add comments to these members. - #if defined (TAO_HAS_CLIENT_CONCURRENCY) // @@ Chris, shouldn't this always be "potentially" the case, even // if a client didn't want to use it? @@ -73,7 +71,9 @@ private: CONCURRENCY_STRATEGY *concurrency_strategy_; #endif /* TAO_HAS_CLIENT_CONCURRENCY */ - CONNECTOR connector_; + // @@ Chris, please add comments to these members. + + TAO_CONNECTOR connector_; NULL_CREATION_STRATEGY null_creation_strategy_; diff --git a/TAO/tao/default_server.cpp b/TAO/tao/default_server.cpp index 9e85cbde5b0..3200a1dbddf 100644 --- a/TAO/tao/default_server.cpp +++ b/TAO/tao/default_server.cpp @@ -107,11 +107,12 @@ TAO_Default_Server_Strategy_Factory::tokenize (char *flag_string) int TAO_Default_Server_Strategy_Factory::init (int argc, char *argv[]) { - TAO_ORB_Core *orb_core = TAO_ORB_Core_instance(); + TAO_ORB_Core *orb_core = TAO_ORB_Core_instance (); - if ((this->parse_args (argc, argv) == 0) - && (reactive_strategy_.open (orb_core->reactor ()) == 0) - && (threaded_strategy_.open (orb_core->thr_mgr (), this->thread_flags_) == 0)) + if (this->parse_args (argc, argv) == 0 + && reactive_strategy_.open (orb_core->reactor ()) == 0 + && threaded_strategy_.open (orb_core->thr_mgr (), + this->thread_flags_) == 0) return 0; else return -1; diff --git a/TAO/tao/giop.cpp b/TAO/tao/giop.cpp index 2098fbc1cc6..a3bf37ca6f7 100644 --- a/TAO/tao/giop.cpp +++ b/TAO/tao/giop.cpp @@ -635,7 +635,7 @@ TAO_GIOP_Invocation::start (CORBA::Environment &env) // Get a reference to the client connector // TAO_Client_Factory::CONNECTOR* con = 0; - TAO_Client_Strategy_Factory::CONNECTOR* con = 0; + TAO_CONNECTOR *con = 0; con = orb->client_factory ()->connector (); // Determine the object key and the address to which we'll need a diff --git a/TAO/tao/orbobj.cpp b/TAO/tao/orbobj.cpp index 94091fb0e33..10703aa7500 100644 --- a/TAO/tao/orbobj.cpp +++ b/TAO/tao/orbobj.cpp @@ -49,7 +49,7 @@ DEFINE_GUID (IID_STUB_Object, 0xa201e4c7, 0xf258, 0x11ce, 0x95, 0x98, 0x0, 0x0, 0xc0, 0x7c, 0xa8, 0x98); CORBA_ORB::CORBA_ORB (void) - : set_up_for_listening_called_(CORBA::B_FALSE), + : open_called_(CORBA::B_FALSE), client_factory_ (0), client_factory_from_service_config_ (CORBA::B_FALSE), server_factory_ (0), @@ -72,27 +72,30 @@ CORBA_ORB::~CORBA_ORB (void) // assert (refcount_ == 0); } -void -CORBA_ORB::set_up_for_listening (void) +int +CORBA_ORB::open (void) { - if (this->set_up_for_listening_called_) - return; + if (this->open_called_) + return -1; - this->set_up_for_listening_called_ = CORBA::B_TRUE; + this->open_called_ = CORBA::B_TRUE; TAO_Server_Strategy_Factory *f = this->server_factory (); // Initialize the endpoint ... or try! - if (this->client_acceptor_.open (this->params()->addr (), - TAO_ORB_Core_instance()->reactor(), - f->creation_strategy (), - f->accept_strategy (), - f->concurrency_strategy (), - f->scheduling_strategy ()) == -1) + if (this->peer_acceptor_.open (this->params()->addr (), + TAO_ORB_Core_instance()->reactor(), + f->creation_strategy (), + f->accept_strategy (), + f->concurrency_strategy (), + f->scheduling_strategy ()) == -1) // @@ CJC Need to return an error somehow!! Maybe set do_exit? - ; + return -1; + + if (this->peer_acceptor_.acceptor ().get_local_addr (this->addr_) == -1) + return -1; - client_acceptor_.acceptor ().get_local_addr (addr_); + return 0; } TAO_Client_Strategy_Factory * @@ -506,30 +509,47 @@ CORBA_ORB::BOA_init (int &argc, return rp; } -void -CORBA_ORB::perform_work (void) +int +CORBA_ORB::perform_work (ACE_Time_Value *tv) { - TAO_ORB_Core_instance ()->reactor ()->handle_events (); + return TAO_ORB_Core_instance ()->reactor ()->handle_events (tv); } -void -CORBA_ORB::run (void) +int +CORBA_ORB::run (ACE_Time_Value *tv) { - ACE_Reactor* r = TAO_ORB_Core_instance ()->reactor (); + ACE_Reactor *r = TAO_ORB_Core_instance ()->reactor (); // This method should only be called by servers, so now we set up // for listening! - this->set_up_for_listening (); + if (this->open () == -1) + return -1; - while (1) - { - int result = r->handle_events (); + // Loop "forever" handling client requests. + + for (;;) + switch (r->handle_events (tv)) + { + case 0: // Timed out, so we return to caller. + return 0; + /* NOTREACHED */ + case -1: // Something else has gone wrong, so return to caller. + return -1; + /* NOTREACHED */ + default: // Some handlers were dispatched, so keep on processing + // requests until we're told to shutdown . +#if 0 + // @@ How can we figure out how to get the right POA pointer + // to shutdown the ORB here? + if (poa->shutting_down ()) + return 1; +#endif /* 0 */ + break; + /* NOTREACHED */ + } - if (result == -1) - return; - } /* NOTREACHED */ - return; + return 0; } #if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION) @@ -540,4 +560,4 @@ template class ACE_Strategy_Acceptor<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTO #pragma instantiate ACE_Dynamic_Service<TAO_Server_Strategy_Factory> #pragma instantiate ACE_Dynamic_Service<TAO_Client_Strategy_Factory> #pragma instantiate ACE_Strategy_Acceptor<TAO_OA_Connection_Handler, ACE_SOCK_ACCEPTOR> -#endif +#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */ diff --git a/TAO/tao/orbobj.h b/TAO/tao/orbobj.h index 842c7b5af0e..5556341ad22 100644 --- a/TAO/tao/orbobj.h +++ b/TAO/tao/orbobj.h @@ -64,22 +64,29 @@ public: // Returns an indication of whether the ORB needs the <{main thread}> to // perform some work. - void perform_work (void); + int perform_work (ACE_Time_Value * = 0); // If called by the <{main thread}>, this operation performs an // implementation-defined unit of work. Otherwise, it does nothing. // - // It is platform specific how the application and ORB arrange to + // It is platform-specific how the application and ORB arrange to // use compatible threading primitives. - void run (void); - // Instructs the ORB to run its event loop in the current thread, - // not returning until the ORB has shut down. <{Note that this - // differs from the POA specification, which is reproduced below:}> + int run (ACE_Time_Value *tv = 0); + // Instructs the ORB to initialize itself and run its event loop in + // the current thread, not returning until the ORB has shut down. + // If an error occurs during initialization or a run-time this + // method will return -1. If <tv> is non-NULL then if no requests + // arrive at this thread before the timeout elapses we return to the + // caller with a value of 0 (this allows timeouts). Otherwise, if + // we've returned since we've been asked to shut down the value of 1 + // is returned. // - // Returns when the ORB has shut down. Different from the If called - // by the main thread, it enables the ORB to perform work using the - // main thread. Otherwise, it simply waits until the ORB has shut - // down. + // <{Note that this interface differs from the POA specification, + // which is reproduced below:}> + // + // Returns when the ORB has shut down. If called by the main + // thread, it enables the ORB to perform work using the main + // thread. Otherwise, it simply waits until the ORB has shut down. // // This operation can be used instead of perform_work() to give the // main thread to the ORB if there are no other activities that need @@ -89,13 +96,12 @@ public: void shutdown (CORBA::Boolean wait_for_completion); // This operation instructs the ORB to shut down. Shutting down the - // ORB causes all object adapters to be shut down. If the + // ORB causes all Object Adapters to be shut down. If the // wait_for_completion parameter is TRUE, this operation blocks // until all ORB processing (including request processing and object // deactivation or other operations associated with object adapters) // has completed. - // = <IUnknown> Support // // Stuff required for COM IUnknown support ... this class is @@ -112,9 +118,11 @@ public: TAO_Client_Strategy_Factory *client_factory (void); TAO_Server_Strategy_Factory *server_factory (void); TAO_ORB_Parameters *params (void); - void set_up_for_listening (void); + + int open (void); // Set up the internal acceptor to listen on the - // previously-specified port for requests. + // previously-specified port for requests. Returns -1 on failure, + // else 0. protected: CORBA_ORB (void); @@ -123,7 +131,7 @@ protected: private: ACE_SYNCH_MUTEX lock_; u_int refcount_; - CORBA::Boolean set_up_for_listening_called_; + CORBA::Boolean open_called_; // @@ Quite possibly everything btw ORB_CORE_STUFF should go into // the TAO_ORB_Core class... @@ -145,9 +153,11 @@ private: // The address of the endpoint on which we're listening for // connections and requests. - TAO_ACCEPTOR client_acceptor_; - // The acceptor listening for requests. - // ORB_CORE_STUFF + TAO_ACCEPTOR peer_acceptor_; + // The acceptor passively listening for connection requests. + + TAO_CONNECTOR peer_connector_; + // The connector actively initiating connection requests. // = NON-PROVIDED METHODS CORBA_ORB (const CORBA_ORB &); |