diff options
Diffstat (limited to 'TAO/examples/POA/Forwarding/Servant_Activator.cpp')
-rw-r--r-- | TAO/examples/POA/Forwarding/Servant_Activator.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/TAO/examples/POA/Forwarding/Servant_Activator.cpp b/TAO/examples/POA/Forwarding/Servant_Activator.cpp new file mode 100644 index 00000000000..49f4d0825bd --- /dev/null +++ b/TAO/examples/POA/Forwarding/Servant_Activator.cpp @@ -0,0 +1,40 @@ +// $Id$ + +#include "Servant_Activator.h" +#include "test_i.h" + +ACE_RCSID(Forwarding, Servant_Activator, "$Id$") + + ServantActivator::ServantActivator (CORBA::ORB_ptr orb, + CORBA::Object_ptr forward_to) + : orb_ (CORBA::ORB::_duplicate (orb)), + forward_to_ (CORBA::Object::_duplicate (forward_to)) +{ +} + +PortableServer::Servant +ServantActivator::incarnate (const PortableServer::ObjectId &, + PortableServer::POA_ptr) +{ + this->orb_->shutdown (0); + + // Throw forward exception + throw PortableServer::ForwardRequest (this->forward_to_.in ()); +} + +void +ServantActivator::etherealize (const PortableServer::ObjectId &, + PortableServer::POA_ptr, + PortableServer::Servant servant, + CORBA::Boolean, + CORBA::Boolean) +{ + delete servant; +} + +void +ServantActivator::forward_requests (void) +{ + if (CORBA::is_nil (this->forward_to_.in ())) + throw test::Cannot_Forward (); +} |