summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-11 19:54:01 +0000
committeralex <alex@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-11 19:54:01 +0000
commit15002c71cc3ee2ee7fe207430c1408da25ad85a2 (patch)
treef868c3ac0b082764d6da5e037e6bc5ca6a625eaa
parentf78e52233d94a9da7d3349894bd190d122ab7a06 (diff)
downloadATCD-15002c71cc3ee2ee7fe207430c1408da25ad85a2.tar.gz
ChangeLogTag : Sun Jul 11 14:45:31 1999 Alexander Babu Arulanthu <alex@cs.wustl.edu>
-rw-r--r--TAO/tao/Invocation.cpp38
-rw-r--r--TAO/tao/Invocation.h17
-rw-r--r--TAO/tao/Pluggable.cpp6
-rw-r--r--TAO/tao/Pluggable.h3
-rw-r--r--TAO/tao/Reply_Dispatcher.cpp16
-rw-r--r--TAO/tao/Reply_Dispatcher.h16
-rw-r--r--TAO/tao/Wait_Strategy.cpp45
-rw-r--r--TAO/tao/Wait_Strategy.h19
8 files changed, 98 insertions, 62 deletions
diff --git a/TAO/tao/Invocation.cpp b/TAO/tao/Invocation.cpp
index 7b1e280ed0e..a0b2cd32232 100644
--- a/TAO/tao/Invocation.cpp
+++ b/TAO/tao/Invocation.cpp
@@ -84,8 +84,6 @@ TAO_GIOP_Invocation::TAO_GIOP_Invocation (TAO_Stub *stub,
TAO_GIOP_Invocation::~TAO_GIOP_Invocation (void)
{
- if (this->transport_ != 0)
- this->transport_->idle_after_reply ();
}
// The public API involves creating an invocation, starting it, filling
@@ -393,6 +391,12 @@ TAO_GIOP_Invocation::location_forward (TAO_InputCDR &inp_stream,
// ****************************************************************
+TAO_GIOP_Twoway_Invocation::~TAO_GIOP_Twoway_Invocation (void)
+{
+ if (this->transport_ != 0)
+ this->transport_->idle_after_reply ();
+}
+
void
TAO_GIOP_Twoway_Invocation::start (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
@@ -638,17 +642,18 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV)
}
int reply_error =
- this->transport_->wait_for_reply (this->max_wait_time_);
+ this->transport_->wait_for_reply (this->max_wait_time_,
+ this->rd_.reply_received ());
// Do the wait loop till we receive the reply for this invocation.
- // while (reply_error != -1 &&
+ // while (reply_error != -1 &&
// this->transport_->reply_received (this->request_id_) != 1)
// {
// // @@ Hack to init the Leader-Follower state, so that we can
// // wait again. (Alex).
// // this->transport_->wait_strategy ()->sending_request (this->orb_core_,
// // 1);
- //
+ //
// // Wait for reply.
// reply_error = this->transport_->wait_for_reply ();
// }
@@ -767,6 +772,12 @@ TAO_GIOP_Twoway_Invocation::invoke_i (CORBA::Environment &ACE_TRY_ENV)
// ****************************************************************
+TAO_GIOP_Oneway_Invocation::~TAO_GIOP_Oneway_Invocation (void)
+{
+ if (this->transport_ != 0)
+ this->transport_->idle_after_reply ();
+}
+
void
TAO_GIOP_Oneway_Invocation::start (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
@@ -785,7 +796,13 @@ TAO_GIOP_Oneway_Invocation::start (CORBA::Environment &ACE_TRY_ENV)
// ****************************************************************
-// Send request, block until any reply comes back.
+TAO_GIOP_Locate_Request_Invocation::~TAO_GIOP_Locate_Request_Invocation (void)
+{
+ if (this->transport_ != 0)
+ this->transport_->idle_after_reply ();
+}
+
+// Send request, block until any reply comes back.
void
TAO_GIOP_Locate_Request_Invocation::start (CORBA::Environment &ACE_TRY_ENV)
ACE_THROW_SPEC ((CORBA::SystemException))
@@ -860,15 +877,16 @@ TAO_GIOP_Locate_Request_Invocation::invoke (CORBA::Environment &ACE_TRY_ENV)
// Wait for the reply.
int reply_error =
- this->transport_->wait_for_reply (this->max_wait_time_);
+ this->transport_->wait_for_reply (this->max_wait_time_,
+ this->rd_.reply_received ());
- // // Do the wait loop, till we receive the reply for this invocation.
- // while (reply_error != -1 &&
+ // // Do the wait loop, till we receive the reply for this invocation.
+ // while (reply_error != -1 &&
// this->transport_->reply_received (this->request_id_) != 1)
// {
// reply_error = this->transport_->wait_for_reply ();
// }
-
+
// Check the reply error.
if (reply_error == -1)
{
diff --git a/TAO/tao/Invocation.h b/TAO/tao/Invocation.h
index 00f7da7d519..47648c22431 100644
--- a/TAO/tao/Invocation.h
+++ b/TAO/tao/Invocation.h
@@ -11,7 +11,7 @@
//
// = DESCRIPTION
// Encapsulate the logic for remote invocations, oneways or
-// twoways.
+// twoways.
//
// THREADING NOTE: Threads should never manipulate another
// thread's invocations. In this implementation, all data
@@ -22,7 +22,7 @@
//
// = AUTHOR
// Carlos O'Ryan <coryan@cs.wustl.edu> and Alexander Babu Arulanthu
-// <alex@cs.wustl.edu>
+// <alex@cs.wustl.edu>
//
// ============================================================================
@@ -57,22 +57,25 @@ class TAO_Export TAO_GIOP_Invocation
{
// = TITLE
// Encapsulates common behavior for both oneway and twoway
- // invocations.
+ // invocations.
//
// = DESCRIPTION
// This class connects (or lookups a connection from the cache)
// to the remote server, builds the CDR stream for the Request,
// send the CDR stream and expects the response and interprets
- // the incoming CDR stream.
-
+ // the incoming CDR stream.
+
public:
TAO_GIOP_Invocation (TAO_Stub *data,
const char *operation,
TAO_ORB_Core* orb_core);
// Constructor.
-
+
virtual ~TAO_GIOP_Invocation (void);
- // Destructor. This is virtual so that we can have
+ // This destructor is virtual so that the derived synchronous
+ // invocation classes can call <idle> method on the <Transport>, if
+ // they want to. All the synchronous invocations <idle> the
+ // Transport, but asynchronous invocations do not do that.
void put_param (CORBA::TypeCode_ptr tc,
void *value,
diff --git a/TAO/tao/Pluggable.cpp b/TAO/tao/Pluggable.cpp
index 52c82100e1a..77953791ddd 100644
--- a/TAO/tao/Pluggable.cpp
+++ b/TAO/tao/Pluggable.cpp
@@ -215,9 +215,11 @@ TAO_Transport::bind_reply_dispatcher (CORBA::ULong request_id,
}
int
-TAO_Transport::wait_for_reply (ACE_Time_Value *max_wait_time)
+TAO_Transport::wait_for_reply (ACE_Time_Value *max_wait_time,
+ int &reply_received)
{
- return this->ws_->wait (max_wait_time);
+ return this->ws_->wait (max_wait_time,
+ reply_received);
}
// Read and handle the reply. Returns 0 when there is Short Read on
diff --git a/TAO/tao/Pluggable.h b/TAO/tao/Pluggable.h
index caed29651b1..5e1a6300b8b 100644
--- a/TAO/tao/Pluggable.h
+++ b/TAO/tao/Pluggable.h
@@ -167,7 +167,8 @@ public:
TAO_Reply_Dispatcher *rd);
// Bind the reply dispatcher with the TMS object.
- virtual int wait_for_reply (ACE_Time_Value *max_wait_time);
+ virtual int wait_for_reply (ACE_Time_Value *max_wait_time,
+ int &reply_received);
// Wait for the reply depending on the strategy.
virtual int handle_client_input (int block = 0,
diff --git a/TAO/tao/Reply_Dispatcher.cpp b/TAO/tao/Reply_Dispatcher.cpp
index 372cc7e3061..2424db07777 100644
--- a/TAO/tao/Reply_Dispatcher.cpp
+++ b/TAO/tao/Reply_Dispatcher.cpp
@@ -25,12 +25,6 @@ TAO_Reply_Dispatcher::message_state (void) const
return 0;
}
-// int
-// TAO_Reply_Dispatcher::reply_received (void) const
-// {
-// return reply_received_;
-// }
-
// *********************************************************************
// Constructor.
@@ -38,7 +32,8 @@ TAO_Synch_Reply_Dispatcher::TAO_Synch_Reply_Dispatcher (TAO_ORB_Core *orb_core)
: message_state_ (0),
reply_cdr_ (orb_core->create_input_cdr_data_block (ACE_CDR::DEFAULT_BUFSIZE),
TAO_ENCAP_BYTE_ORDER,
- orb_core)
+ orb_core),
+ reply_received_ (0)
{
}
@@ -54,7 +49,7 @@ TAO_Synch_Reply_Dispatcher::dispatch_reply (CORBA::ULong reply_status,
TAO_GIOP_ServiceContextList &reply_ctx,
TAO_GIOP_Message_State *message_state)
{
- // this->reply_received_ = 1;
+ this->reply_received_ = 1;
this->reply_status_ = reply_status;
this->version_ = version;
@@ -85,6 +80,11 @@ TAO_Synch_Reply_Dispatcher::reply_cdr (void)
return this->reply_cdr_;
}
+int &
+TAO_Synch_Reply_Dispatcher::reply_received (void)
+{
+ return reply_received_;
+}
// *********************************************************************
#if defined (TAO_HAS_CORBA_MESSAGING) && defined (TAO_POLLER)
diff --git a/TAO/tao/Reply_Dispatcher.h b/TAO/tao/Reply_Dispatcher.h
index 78f1812d06e..e8039931313 100644
--- a/TAO/tao/Reply_Dispatcher.h
+++ b/TAO/tao/Reply_Dispatcher.h
@@ -50,13 +50,6 @@ public:
virtual TAO_GIOP_Message_State *message_state (void) const;
// Get the Message State into which the reply has been read.
-
- // virtual int reply_received (void) const;
- // Return the reply received flag.
-
- // protected:
- // int reply_received_;
- // Reply received flag.
};
// *********************************************************************
@@ -101,6 +94,12 @@ public:
virtual TAO_InputCDR &reply_cdr (void);
// Return the reply CDR.
+ virtual int &reply_received (void);
+ // Return the reference to the reply received flag. This will not
+ // make sense in the Asynch Reply Dispatcher case, since the
+ // reply will be dispatched as soon as it is available and the
+ // dispatcher will go away immediately after that.
+
private:
CORBA::ULong reply_status_;
// Reply or LocateReply status.
@@ -118,6 +117,9 @@ private:
TAO_InputCDR reply_cdr_;
// CDR where the reply message is placed.
+
+ int reply_received_;
+ // Flag that indicates the reply has been received.
};
// *********************************************************************
diff --git a/TAO/tao/Wait_Strategy.cpp b/TAO/tao/Wait_Strategy.cpp
index 6fcd47d5026..d781dd66d1e 100644
--- a/TAO/tao/Wait_Strategy.cpp
+++ b/TAO/tao/Wait_Strategy.cpp
@@ -29,8 +29,8 @@ TAO_Wait_Strategy::sending_request (TAO_ORB_Core * /* orb_core */,
// Constructor.
TAO_Wait_On_Reactor::TAO_Wait_On_Reactor (TAO_Transport *transport)
- : TAO_Wait_Strategy (transport),
- reply_received_ (0)
+ : TAO_Wait_Strategy (transport)
+ // reply_received_ (0)
{
}
@@ -40,29 +40,30 @@ TAO_Wait_On_Reactor::~TAO_Wait_On_Reactor (void)
}
int
-TAO_Wait_On_Reactor::wait (ACE_Time_Value *max_wait_time)
+TAO_Wait_On_Reactor::wait (ACE_Time_Value *max_wait_time,
+ int &reply_received)
{
// Reactor does not change inside the loop.
ACE_Reactor* reactor =
this->transport_->orb_core ()->reactor ();
// Do the event loop, till we fully receive a reply.
-
+
int result = 1; // So the first iteration works...
- this->reply_received_ = 0;
- while (this->reply_received_ == 0 && result > 0)
+ // this->reply_received_ = 0;
+ while (reply_received == 0 && result > 0)
{
result = reactor->handle_events (max_wait_time);
}
- if (result == -1 || this->reply_received_ == -1)
+ if (result == -1 || reply_received == -1)
return -1;
- // Return an error if there was a problem receiving the reply...
+ // Return an error if there was a problem receiving the reply.
if (max_wait_time != 0)
{
- if (this->reply_received_ != 1
- && *max_wait_time == ACE_Time_Value::zero)
+ if (reply_received != 1 &&
+ *max_wait_time == ACE_Time_Value::zero)
{
result = -1;
errno = ETIME;
@@ -71,7 +72,7 @@ TAO_Wait_On_Reactor::wait (ACE_Time_Value *max_wait_time)
else
{
result = 0;
- if (this->reply_received_ == -1)
+ if (reply_received == -1)
result = -1;
}
@@ -85,14 +86,14 @@ TAO_Wait_On_Reactor::handle_input (void)
if (result == 1)
{
- this->reply_received_ = 1;
+ // this->reply_received_ = 1;
result = 0;
}
- if (result == -1)
- this->reply_received_ = -1;
+ // if (result == -1)
+ // reply_received = -1;
- return result;
+ return result;
}
// Register the handler with the Reactor.
@@ -149,7 +150,7 @@ TAO_Wait_On_Leader_Follower::sending_request (TAO_ORB_Core *orb_core,
// Register the handler.
this->transport_->register_handler ();
-
+
// Send the request.
int result =
this->TAO_Wait_Strategy::sending_request (orb_core,
@@ -171,7 +172,8 @@ TAO_Wait_On_Leader_Follower::sending_request (TAO_ORB_Core *orb_core,
}
int
-TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time)
+TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time,
+ int &)
{
// Cache the ORB core, it won't change and is used multiple times
// below:
@@ -248,7 +250,7 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time)
if (this->reply_received_ == 1)
{
// But first reset our state in case we are invoked
- // again...
+ // again...
this->reply_received_ = 0;
this->expecting_response_ = 0;
this->calling_thread_ = ACE_OS::NULL_thread;
@@ -258,7 +260,7 @@ TAO_Wait_On_Leader_Follower::wait (ACE_Time_Value *max_wait_time)
else if (this->reply_received_ == -1)
{
// But first reset our state in case we are invoked
- // again...
+ // again...
this->reply_received_ = 0;
this->expecting_response_ = 0;
this->calling_thread_ = ACE_OS::NULL_thread;
@@ -362,7 +364,7 @@ TAO_Wait_On_Leader_Follower::handle_input (void)
// Obtain the lock.
ACE_GUARD_RETURN (ACE_SYNCH_MUTEX, ace_mon,
- orb_core->leader_follower ().lock (),
+ orb_core->leader_follower ().lock (),
-1);
// ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - reading reply <%x>\n",
@@ -477,7 +479,8 @@ TAO_Wait_On_Read::~TAO_Wait_On_Read (void)
// Wait on the read operation.
int
-TAO_Wait_On_Read::wait (ACE_Time_Value * max_wait_time)
+TAO_Wait_On_Read::wait (ACE_Time_Value * max_wait_time,
+ int &)
{
int reply_complete = 0;
while (reply_complete != 1)
diff --git a/TAO/tao/Wait_Strategy.h b/TAO/tao/Wait_Strategy.h
index 1433b5bd5cf..d32d72e605d 100644
--- a/TAO/tao/Wait_Strategy.h
+++ b/TAO/tao/Wait_Strategy.h
@@ -48,8 +48,10 @@ public:
// variables because the reply may arrive *before* the user calls
// wait.
- virtual int wait (ACE_Time_Value *max_wait_time) = 0;
- // Base class virtual method.
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ int &reply_received) = 0;
+ // Base class virtual method. Wait till the <reply_received> flag is
+ // true or the time expires.
virtual int handle_input (void) = 0;
// Handle the input.
@@ -86,12 +88,13 @@ public:
// = Documented in TAO_Wait_Strategy.
- virtual int wait (ACE_Time_Value *max_wait_time);
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ int &reply_received);
virtual int handle_input (void);
virtual int register_handler (void);
private:
- int reply_received_;
+ // int reply_received_;
// This flag indicates if a *complete* reply has been received. Used
// to exit the event loop.
};
@@ -118,7 +121,8 @@ public:
virtual int sending_request (TAO_ORB_Core *orb_core,
int two_way);
- virtual int wait (ACE_Time_Value *max_wait_time);
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ int &reply_received);
virtual int handle_input (void);
virtual int register_handler (void);
@@ -162,7 +166,10 @@ public:
virtual ~TAO_Wait_On_Read (void);
// Destructor.
- virtual int wait (ACE_Time_Value *max_wait_time);
+ // = Documented in TAO_Wait_Strategy.
+
+ virtual int wait (ACE_Time_Value *max_wait_time,
+ int &reply_received);
virtual int handle_input (void);
virtual int register_handler (void);
};