2 // Ossama Othman <ossama@uci.edu>
4 #include "ace/Log_Msg.h"
5 #include "ace/Process_Manager.h"
6 #include "Push_Iterator_Handler.h"
7 #include "Callback_i.h"
9 Push_Iterator_Handler::Push_Iterator_Handler (void)
10 : callback_servant_ (0),
17 Push_Iterator_Handler::~Push_Iterator_Handler (void)
23 Push_Iterator_Handler::register_callback
24 (const Web_Server::Metadata_Type
&metadata
)
26 this->callback_servant_
->metadata (metadata
);
28 // This handler is no longer needed, so deactivate it.
33 Push_Iterator_Handler::run (int *request_count
,
35 Web_Server::Iterator_Factory_ptr factory
)
37 ACE_NEW_THROW_EX (this->callback_servant_
,
38 Callback_i (request_count
),
41 // Pass ownership of the Callback servant to the POA.
42 PortableServer::ServantBase_var
tmp (this->callback_servant_
);
44 // Activate the Callback.
46 this->callback_servant_
->_this ();
48 // Activate this Reply Handler.
52 // Register the client callback with the server asynchronously.
53 factory
->sendc_register_callback (this->ami_handler_
.in (),
55 this->callback_
.in ());
59 Push_Iterator_Handler::deactivate (void)
61 // Get the POA used when activating the Reply Handler object.
62 PortableServer::POA_var poa
= this->_default_POA ();
64 // Get the object ID associated with this servant.
65 PortableServer::ObjectId_var oid
=
66 poa
->servant_to_id (this);
68 // Now deactivate the AMI_CallbackHandler object.
69 poa
->deactivate_object (oid
.in ());