diff options
author | tworm <tworm@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-04 14:23:13 +0000 |
---|---|---|
committer | tworm <tworm@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-05-04 14:23:13 +0000 |
commit | dafafdddbcce29557f589a57af4485c15d1105d4 (patch) | |
tree | ad4791f61c4a01422086ae528fa4b9e717798f40 /TAO/orbsvcs/orbsvcs/Concurrency | |
parent | 770eddece2a5a7f12dc42a9b471ce16378043ecf (diff) | |
download | ATCD-dafafdddbcce29557f589a57af4485c15d1105d4.tar.gz |
First version
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/Concurrency')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Concurrency/Concurrency_Utils.cpp | 97 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/Concurrency/Concurrency_Utils.h | 65 |
2 files changed, 162 insertions, 0 deletions
diff --git a/TAO/orbsvcs/orbsvcs/Concurrency/Concurrency_Utils.cpp b/TAO/orbsvcs/orbsvcs/Concurrency/Concurrency_Utils.cpp new file mode 100644 index 00000000000..4e091c60467 --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Concurrency/Concurrency_Utils.cpp @@ -0,0 +1,97 @@ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/orbsvcs/Concurrency_Service +// +// = FILENAME +// Concurrency_Utils.cpp +// +// = DESCRIPTION +// +// +// +// = AUTHOR +// Torben Worm <tworm@cs.wustl.edu> +// +// ============================================================================ + +#include "ace/streams.h" +#include "orbsvcs/CosConcurrencyControlC.h" +#include "tao/corba.h" +#include "Concurrency_Utils.h" + +// Default constructor + +TAO_Concurrency_Server::TAO_Concurrency_Server (void) +{ +} + +// Constructor which takes an ORB and POA. + +TAO_Concurrency_Server::TAO_Concurrency_Server (CORBA::ORB_var &orb, + PortableServer::POA_var &poa) +{ + this->init (orb, poa); +} + +// Function to initialize the concurrency server object under the passed orb +// and poa + +int +TAO_Concurrency_Server::init (CORBA::ORB_var &orb, + PortableServer::POA_var &poa) +{ + TAO_TRY + { + // Get the naming context ptr to NameService. + TAO_CHECK_ENV; + + PortableServer::ObjectId_var id = + PortableServer::string_to_ObjectId ("ConcurrencyService"); + + poa->activate_object_with_id (id.in (), + &lock_set_factory_, + TAO_TRY_ENV); + TAO_CHECK_ENV; + + // Stringify the objref we'll be implementing, and print it to + // stdout. Someone will take that string and give it to a + // client. Then release the object. + CORBA::Object_var obj = + poa->id_to_reference (id.in (), + TAO_TRY_ENV); + TAO_CHECK_ENV; + + CORBA::String_var str = + orb->object_to_string (obj.in (), + TAO_TRY_ENV); + TAO_CHECK_ENV; + + ACE_DEBUG ((LM_DEBUG, + "listening as object <%s>\n", + str.in ())); + } + TAO_CATCHANY + { + TAO_TRY_ENV.print_exception ("Concurrency Service"); + } + TAO_ENDTRY; + return 0; +} + +// Get the lock set factory +CC_LockSetFactory * +TAO_Concurrency_Server::GetLockSetFactory(void) +{ + return &this->lock_set_factory_; +} + +// Destructor. + +TAO_Concurrency_Server::~TAO_Concurrency_Server (void) +{ +} + + diff --git a/TAO/orbsvcs/orbsvcs/Concurrency/Concurrency_Utils.h b/TAO/orbsvcs/orbsvcs/Concurrency/Concurrency_Utils.h new file mode 100644 index 00000000000..5f2599a078e --- /dev/null +++ b/TAO/orbsvcs/orbsvcs/Concurrency/Concurrency_Utils.h @@ -0,0 +1,65 @@ +/* -*- C++ -*- */ +// $Id$ + +// ============================================================================ +// +// = LIBRARY +// TAO/orbsvcs/Concurrency_Service +// +// = FILENAME +// Concurrency_Utils.h +// +// = DESCRIPTION +// This class implements a Concurrency Server wrapper class which holds +// a number of lock sets +// The server must run in the thread per request concurrency model in +// order to let the clients block on the semaphores. +// +// = AUTHORS +// Torben Worm <tworm@cs.wustl.edu> +// +// ============================================================================ + +#if !defined (_CONCURRENCY_SERVER_H) +#define _CONCURRENCY_SERVER_H + +#include "tao/corba.h" +#include "orbsvcs/CosConcurrencyControlC.h" +#include "CC_LockSetFactory.h" + +class TAO_ORBSVCS_Export TAO_Concurrency_Server +{ + // = TITLE + // Defines a wrapper class for the implementation of the + // concurrency server. + // + // = DESCRIPTION + // + // + // + // +public: + TAO_Concurrency_Server (void); + //Default constructor. + + TAO_Concurrency_Server (CORBA::ORB_var &orb, + PortableServer::POA_var &poa); + // Takes the POA under which to register the Concurrency Service + // implementation object. + + int init (CORBA::ORB_var &orb, + PortableServer::POA_var &poa); + // Initialize the concurrency server under the given ORB and POA. + + CC_LockSetFactory *GetLockSetFactory(void); + // Get the lock set factory + + ~TAO_Concurrency_Server (void); + // Destructor. + +private: + CC_LockSetFactory lock_set_factory_; +}; + +#endif /* _CONCURRENCY_SERVER_H */ + |