Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / TAO / tao / CSD_Framework / CSD_Strategy_Base.inl
blob2849a1bb0f8512ae30b6c6de5ac8c57ff47b5a4b
1 // -*- C++ -*-
2 #include "tao/debug.h"
4 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
6 ACE_INLINE
7 TAO::CSD::Strategy_Base::Strategy_Base()
8   : poa_activated_(false)
12 ACE_INLINE
13 void
14 TAO::CSD::Strategy_Base::dispatch_request
15                          (TAO_ServerRequest& server_request,
16                           TAO::Portable_Server::Servant_Upcall& upcall)
18   DispatchResult result;
20   if (server_request.collocated())
21     {
22       result = this->dispatch_collocated_request_i(server_request,
23                                                    upcall.user_id(),
24                                                    this->poa_.in(),
25                                                    server_request.operation(),
26                                                    upcall.servant());
27     }
28   else
29     {
30       result = this->dispatch_remote_request_i(server_request,
31                                                upcall.user_id(),
32                                                this->poa_.in(),
33                                                server_request.operation(),
34                                                upcall.servant());
35     }
37   switch (result)
38     {
39       case DISPATCH_HANDLED:
40         // Do nothing.  Everything has been handled.
41         break;
43       case DISPATCH_REJECTED:
44         if (server_request.collocated ())
45           {
46              CORBA::NO_IMPLEMENT ex;
47              ex._raise ();
48           }
49         else
50           {
51             // Raise an appropriate SystemException if the request is expecting
52             // a reply.
53             if (!server_request.sync_with_server() &&
54                 server_request.response_expected() &&
55                 !server_request.deferred_reply())
56               {
57                 CORBA::NO_IMPLEMENT ex;
58                 server_request.tao_send_reply_exception(ex);
59               }
60           }
61         break;
63       case DISPATCH_DEFERRED:
64         // Perform the "default" dispatching strategy logic for this request
65         // right now, using the current thread.
66         upcall.servant()->_dispatch(server_request, &upcall);
67         break;
69       default:
70         if (TAO_debug_level > 0)
71           TAOLIB_ERROR((LM_ERROR,
72                      ACE_TEXT("(%P|%t) Unknown result (%d) from call to ")
73                      ACE_TEXT("dispatch_remote_request_i().\n"), result));
74         // Since we do not know what to do here, just do the minimum, which
75         // treats this case just like the DISPATCH_HANDLED case, for better
76         // or worse.  Hitting this default case means a coding error.
77         break;
78     }
82 ACE_INLINE
83 bool
84 TAO::CSD::Strategy_Base::poa_activated_event(TAO_ORB_Core& orb_core)
86   // Notify the subclass of the event, saving the result.
87   this->poa_activated_ = this->poa_activated_event_i(orb_core);
89   // Return the result
90   return this->poa_activated_;
93 ACE_INLINE
94 void
95 TAO::CSD::Strategy_Base::poa_deactivated_event()
97   if (this->poa_activated_)
98     {
99       this->poa_activated_ = false;
101       // Notify the subclass of the event.
102       this->poa_deactivated_event_i();
104       // Reset the poa to nil to decrement the reference count.
105       // This will break the circular dependency of the deletion
106       // of the CSD POA.
107       this->poa_ = 0;
108     }
111 ACE_INLINE
112 void
113 TAO::CSD::Strategy_Base::servant_activated_event
114                                 (PortableServer::Servant servant,
115                                  const PortableServer::ObjectId& oid)
117   this->servant_activated_event_i(servant, oid);
120 ACE_INLINE
121 void
122 TAO::CSD::Strategy_Base::servant_deactivated_event
123                                 (PortableServer::Servant servant,
124                                  const PortableServer::ObjectId& oid)
126   this->servant_deactivated_event_i(servant, oid);
129 TAO_END_VERSIONED_NAMESPACE_DECL