summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2003-09-29 23:52:35 +0000
committerbala <balanatarajan@users.noreply.github.com>2003-09-29 23:52:35 +0000
commit459a571aeb092ffb8e390ca928e088d70b85a22a (patch)
tree4e845d6445861cfd03b90f0d21993aa9be0f7383
parent3d4b9ee0f201b4326549604e3cdc8bca7000659d (diff)
downloadATCD-459a571aeb092ffb8e390ca928e088d70b85a22a.tar.gz
ChangeLogTag:Mon Sep 29 18:39:05 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
-rw-r--r--TAO/ChangeLog38
-rw-r--r--TAO/tao/PortableInterceptor.pidl2
-rw-r--r--TAO/tao/PortableInterceptorC.h13
-rw-r--r--TAO/tao/PortableServer/Object_Adapter.cpp17
-rw-r--r--TAO/tao/PortableServer/ServerInterceptorAdapter.cpp68
-rw-r--r--TAO/tao/PortableServer/ServerInterceptorAdapter.h15
-rw-r--r--TAO/tao/TAO_Server_Request.cpp76
-rw-r--r--TAO/tao/TAO_Server_Request.h15
-rw-r--r--TAO/tao/TAO_Server_Request.i15
9 files changed, 247 insertions, 12 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 8fca287226a..a053562bd0b 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,41 @@
+Mon Sep 29 18:39:05 2003 Balachandran Natarajan <bala@dre.vanderbilt.edu>
+
+
+ A temporary hack for Boris to keep progressing. The aim of this
+ hack in the branch is to add a propreietary interception
+ point. This is what this checkin is all about
+
+ - Added a new interception point, tao_ft_interception_point ()
+ on the server side.
+
+ - This will be called on the server even before the
+ receive_request_service_context () is called
+
+ - The server can use this interception point to send back a
+ reply without dispatching it to the object.
+
+ * tao/PortableInterceptor.pidl:
+ * tao/PortableInterceptorC.h: Added the new interception point. A
+ default implementation is provided, so that application
+ developers don't need to implement the proprietary interception
+ point.
+
+ * tao/TAO_Server_Request.cpp:
+ * tao/TAO_Server_Request.h:
+ * tao/TAO_Server_Request.i: Added a new method which will be used
+ to send cached replies back to the client.
+
+ * tao/PortableServer/Object_Adapter.cpp: Called the proprietary
+ interception point.
+
+ * tao/PortableServer/ServerInterceptorAdapter.cpp:
+ * tao/PortableServer/ServerInterceptorAdapter.h: Added the first
+ interception point to be the tao's proprietary interception
+ point.
+
+ This shouldn't be needed once we merge in 1369. But till then we
+ may need this hack.
+
Mon Sep 29 18:19:51 2003 Steve Totten <totten_s@ociweb.com>
* orbsvcs/orbsvcs/PortableGroup/PG_Utils.cpp:
diff --git a/TAO/tao/PortableInterceptor.pidl b/TAO/tao/PortableInterceptor.pidl
index 16dcfb474b0..d01b33dca5d 100644
--- a/TAO/tao/PortableInterceptor.pidl
+++ b/TAO/tao/PortableInterceptor.pidl
@@ -133,6 +133,8 @@ module PortableInterceptor {
};
local interface ServerRequestInterceptor : Interceptor {
+ /// Proprietary method in TAO for fault tolerance
+ void tao_ft_interception_point (in ServerRequestInfo ri, out CORBA::OctetSeq os) raises (ForwardRequest);
void receive_request_service_contexts (in ServerRequestInfo ri) raises (ForwardRequest);
void receive_request (in ServerRequestInfo ri) raises (ForwardRequest);
void send_reply (in ServerRequestInfo ri);
diff --git a/TAO/tao/PortableInterceptorC.h b/TAO/tao/PortableInterceptorC.h
index 1b387977f61..e7567064142 100644
--- a/TAO/tao/PortableInterceptorC.h
+++ b/TAO/tao/PortableInterceptorC.h
@@ -72,6 +72,7 @@
// TAO_IDL - Generated from
// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_module/module_ch.cpp:48
+
TAO_NAMESPACE PortableInterceptor
{
@@ -1403,6 +1404,18 @@ TAO_NAMESPACE PortableInterceptor
// TAO_IDL - Generated from
// W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_operation/operation_ch.cpp:46
+ virtual void tao_ft_interception_point (
+ PortableInterceptor::ServerRequestInfo_ptr ,
+ CORBA::OctetSeq_out
+ ACE_ENV_ARG_DECL_NOT_USED
+ )
+ ACE_THROW_SPEC ((
+ CORBA::SystemException
+ , PortableInterceptor::ForwardRequest
+ )) {};
+
+ // TAO_IDL - Generated from
+ // W:\ACE_wrappers\TAO\TAO_IDL\be\be_visitor_operation/operation_ch.cpp:46
virtual void receive_request_service_contexts (
PortableInterceptor::ServerRequestInfo_ptr ri
diff --git a/TAO/tao/PortableServer/Object_Adapter.cpp b/TAO/tao/PortableServer/Object_Adapter.cpp
index da385d45a1d..eac6eac56c0 100644
--- a/TAO/tao/PortableServer/Object_Adapter.cpp
+++ b/TAO/tao/PortableServer/Object_Adapter.cpp
@@ -736,6 +736,21 @@ TAO_Object_Adapter::dispatch (TAO::ObjectKey &key,
ACE_TRY
{
+ CORBA::OctetSeq_var ocs;
+ sri_adapter.tao_ft_interception_point (&ri,
+ ocs.out ()
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ /// If we have a cached result, just go ahead and send the reply
+ /// and let us return
+ if (ocs.ptr () != 0)
+ {
+ // request.result_seq (
+ request.send_cached_reply (ocs.inout ());
+
+ return TAO_Adapter::DS_OK;
+ }
// The receive_request_service_contexts() interception point
// must be invoked before the operation is dispatched to the
// servant.
@@ -1716,7 +1731,7 @@ TAO_Object_Adapter::Servant_Upcall::servant_cleanup (void)
ACE_TRY_CHECK;
}
- ACE_CATCHANY
+ ACE_CATCHALL
{
// Ignore errors from servant cleanup ....
}
diff --git a/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp b/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp
index 43b54df9cf2..3d7291f0f87 100644
--- a/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp
+++ b/TAO/tao/PortableServer/ServerInterceptorAdapter.cpp
@@ -22,14 +22,13 @@ TAO_ServerRequestInterceptor_Adapter::
}
void
-TAO_ServerRequestInterceptor_Adapter::
-receive_request_service_contexts (
- TAO_ServerRequestInfo *ri
- ACE_ENV_ARG_DECL)
+TAO_ServerRequestInterceptor_Adapter::tao_ft_interception_point (
+ TAO_ServerRequestInfo *ri,
+ CORBA::OctetSeq_out oc
+ ACE_ENV_ARG_DECL)
{
// This method implements one of the "starting" server side
// interception point.
-
ACE_TRY
{
// Copy the request scope current (RSC) to the thread scope
@@ -39,13 +38,25 @@ receive_request_service_contexts (
TAO_PICurrent_Guard pi_guard (ri->server_request (),
0 /* Copy RSC to TSC */);
+ oc = 0;
+
for (size_t i = 0 ; i < this->len_; ++i)
{
- this->interceptors_[i]->receive_request_service_contexts (
- ri
+ this->interceptors_[i]->tao_ft_interception_point (
+ ri,
+ oc
ACE_ENV_ARG_PARAMETER);
ACE_TRY_CHECK;
+ if (oc != 0)
+ {
+ (void) this->send_other (ri
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ return;
+ }
+
// The starting interception point completed successfully.
// Push the interceptor on to the flow stack.
++this->stack_size_;
@@ -66,6 +77,49 @@ receive_request_service_contexts (
void
TAO_ServerRequestInterceptor_Adapter::
+receive_request_service_contexts (
+ TAO_ServerRequestInfo *ri
+ ACE_ENV_ARG_DECL)
+{
+ // This method implements one of the "intermediate" server side
+ // interception point.
+ if (this->len_ != this->stack_size_)
+ {
+ // This method (i.e. the receive_request() interception point)
+ // should only be invoked if all of the interceptors registered
+ // with the ORB were pushed on to the flow stack by one of the
+ // starting endpoints (such as
+ // receive_request_service_contexts()). If the above condition
+ // evaluates to "true," then it is likely that a starting
+ // interception point was never invoked. This is of course, an
+ // internal error that must be corrected.
+ ACE_THROW (CORBA::INTERNAL ());
+ }
+ ACE_TRY
+ {
+ for (size_t i = 0 ; i < this->stack_size_; ++i)
+ {
+ this->interceptors_[i]->receive_request_service_contexts (
+ ri
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+ }
+ }
+ ACE_CATCH (PortableInterceptor::ForwardRequest, exc)
+ {
+ ri->forward_reference (exc);
+ this->send_other (ri
+ ACE_ENV_ARG_PARAMETER);
+ ACE_TRY_CHECK;
+
+ this->location_forwarded_ = 1;
+ }
+ ACE_ENDTRY;
+ ACE_CHECK;
+}
+
+void
+TAO_ServerRequestInterceptor_Adapter::
receive_request (TAO_ServerRequestInfo *ri
ACE_ENV_ARG_DECL)
{
diff --git a/TAO/tao/PortableServer/ServerInterceptorAdapter.h b/TAO/tao/PortableServer/ServerInterceptorAdapter.h
index de03351ef2c..705fb60403f 100644
--- a/TAO/tao/PortableServer/ServerInterceptorAdapter.h
+++ b/TAO/tao/PortableServer/ServerInterceptorAdapter.h
@@ -62,13 +62,22 @@ public:
* Each of these methods corresponds to a client side interception
* point.
*
- * @todo
- * The "receive_request_service_contexts()" and "send_other()"
- * PortableInterceptor interception points are missing.
*/
//@{
/// This method implements the "starting" server side interception
+ /// point. It will be used as the first interception point and it is
+ /// proprietary to TAO.
+ /// @@ Will go away once Bug 1369 is fixed
+ void tao_ft_interception_point (
+ TAO_ServerRequestInfo *ri ,
+ CORBA::OctetSeq_out oc
+ ACE_ENV_ARG_DECL);
+
+ /// This method implements the "intermediate" server side interception
/// point.
+ /// @@ NOTE: This method should have been the "starting"
+ /// interception point according to the interceptor spec. This will
+ /// be fixed once Bug 1369 is completely done.
void receive_request_service_contexts (
TAO_ServerRequestInfo * ri
ACE_ENV_ARG_DECL);
diff --git a/TAO/tao/TAO_Server_Request.cpp b/TAO/tao/TAO_Server_Request.cpp
index 0bd5b72a3ef..f34c13175d6 100644
--- a/TAO/tao/TAO_Server_Request.cpp
+++ b/TAO/tao/TAO_Server_Request.cpp
@@ -71,6 +71,7 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
#if TAO_HAS_INTERCEPTORS == 1
, interceptor_count_ (0)
, rs_pi_current_ ()
+ , result_seq_ (0)
#endif /* TAO_HAS_INTERCEPTORS == 1 */
{
ACE_FUNCTION_TIMEPROBE (TAO_SERVER_REQUEST_START);
@@ -109,6 +110,7 @@ TAO_ServerRequest::TAO_ServerRequest (TAO_Pluggable_Messaging *mesg_base,
#if TAO_HAS_INTERCEPTORS == 1
, interceptor_count_ (0)
, rs_pi_current_ ()
+ , result_seq_ (0)
#endif /* TAO_HAS_INTERCEPTORS == 1 */
{
this->profile_.object_key (object_key);
@@ -331,3 +333,77 @@ TAO_ServerRequest::tao_send_reply_exception (CORBA::Exception &ex)
ACE_TEXT ("but client is not waiting a response\n")));
}
}
+
+#if TAO_HAS_INTERCEPTORS == 1
+void
+TAO_ServerRequest::send_cached_reply (CORBA::OctetSeq &s)
+{
+ #if defined(ACE_HAS_PURIFY)
+ // Only inititialize the buffer if we're compiling with Purify.
+ // Otherwise, there is no real need to do so, especially since
+ // we can avoid the initialization overhead at run-time if we
+ // are not compiling with Purify support.
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE] = { 0 };
+#else
+ char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
+#endif /* ACE_HAS_PURIFY */
+
+ TAO_OutputCDR output (repbuf,
+ sizeof repbuf,
+ TAO_ENCAP_BYTE_ORDER,
+ this->orb_core_->output_cdr_buffer_allocator (),
+ this->orb_core_->output_cdr_dblock_allocator (),
+ this->orb_core_->output_cdr_msgblock_allocator (),
+ this->orb_core_->orb_params ()->cdr_memcpy_tradeoff (),
+ TAO_DEF_GIOP_MAJOR,
+ TAO_DEF_GIOP_MINOR);
+
+ this->transport_->assign_translators(0,&output);
+
+ // A copy of the reply parameters
+ TAO_Pluggable_Reply_Params_Base reply_params;
+
+ reply_params.request_id_ = this->request_id_;
+
+ reply_params.svc_ctx_.length (0);
+
+ // Send back the empty reply service context.
+ reply_params.service_context_notowned (&this->reply_service_info ());
+
+ // We are going to send some data
+ reply_params.argument_flag_ = 1;
+
+ // Make a default reply status
+ reply_params.reply_status_ = TAO_GIOP_NO_EXCEPTION;
+
+ // Make the reply message
+ if (this->mesg_base_->generate_reply_header (*this->outgoing_,
+ reply_params) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l): ")
+ ACE_TEXT ("could not make cached reply\n")));
+
+ }
+
+ /// Append reply here....
+ this->outgoing_->write_octet_array (
+ s.get_buffer (),
+ s.length ());
+
+ if (!this->outgoing_->good_bit ())
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l): ")
+ ACE_TEXT ("could not marshal reply\n")));
+
+ // Send the message
+ if (this->transport_->send_message (*this->outgoing_,
+ 0,
+ TAO_Transport::TAO_REPLY) == -1)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l): ")
+ ACE_TEXT ("could not send cached reply\n")));
+ }
+}
+#endif /*TAO_HAS_INTERCEPTORS*/
diff --git a/TAO/tao/TAO_Server_Request.h b/TAO/tao/TAO_Server_Request.h
index e3f409fa61c..2a975649a72 100644
--- a/TAO/tao/TAO_Server_Request.h
+++ b/TAO/tao/TAO_Server_Request.h
@@ -139,7 +139,6 @@ public:
void send_no_exception_reply (void);
// CORBA::Principal_ptr principal (void) const;
-
TAO::ObjectKey &object_key (void);
/**
@@ -207,6 +206,17 @@ public:
CORBA::Boolean argument_flag (void);
#if TAO_HAS_INTERCEPTORS == 1
+ /// Send cached reply. Used in scenarios where the FTORB thinks that
+ /// this request is a duplicate
+ void send_cached_reply (CORBA::OctetSeq &ocs);
+
+ /// Return the octet sequence pointer through which the FTORB would
+ /// send the reply back.
+ void result_seq (CORBA::OctetSeq &ocs);
+
+ /// Check whether we got the result.
+ int got_result (void);
+
/// Return a reference to the number of interceptors pushed on to
/// the current interceptor flow stack.
/**
@@ -297,6 +307,9 @@ private:
/// The "Request Scope Current" (RSC) object, as required by
/// Portable Interceptors.
TAO_PICurrent_Impl rs_pi_current_;
+
+ /// Used by the FTORB
+ CORBA::OctetSeq_var result_seq_;
#endif /* TAO_HAS_INTERCEPTORS == 1 */
};
diff --git a/TAO/tao/TAO_Server_Request.i b/TAO/tao/TAO_Server_Request.i
index d399dc5f17e..67c11d3c8f4 100644
--- a/TAO/tao/TAO_Server_Request.i
+++ b/TAO/tao/TAO_Server_Request.i
@@ -201,4 +201,19 @@ TAO_ServerRequest::rs_pi_current (void)
{
return this->rs_pi_current_;
}
+
+ACE_INLINE int
+TAO_ServerRequest::got_result (void)
+{
+ if (this->result_seq_.ptr () == 0)
+ return 0;
+
+ return 1;
+}
+
+ACE_INLINE void
+TAO_ServerRequest::result_seq (CORBA::OctetSeq &ocs)
+{
+ this->result_seq_ = ocs;
+}
#endif /* TAO_HAS_INTERCEPTORS == 1 */