diff options
author | smcqueen <smcqueen@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-10-17 12:42:16 +0000 |
---|---|---|
committer | smcqueen <smcqueen@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2008-10-17 12:42:16 +0000 |
commit | 94a5ed4c9dacc23d00d0e4586f3f40c79250794b (patch) | |
tree | 09a2f62a0ee339edbeff2b24f2201a0be59eb98c /TAO | |
parent | cc2b8264bf8c01e2f8df8aaba808ba4af0687359 (diff) | |
download | ATCD-94a5ed4c9dacc23d00d0e4586f3f40c79250794b.tar.gz |
ChangeLogTag: Fri Oct 17 12:33:42 UTC 2008 Simon McQueen <sm@prismtech.com>
Diffstat (limited to 'TAO')
6 files changed, 113 insertions, 95 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog index ef3d132da3e..27021046efc 100644 --- a/TAO/ChangeLog +++ b/TAO/ChangeLog @@ -1,3 +1,13 @@ +Fri Oct 17 12:33:42 UTC 2008 Simon McQueen <sm@prismtech.com> + + * orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.h: + * orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.cpp: + * orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.h: + * orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.cpp: + * orbsvcs/tests/Bug_3215_Regression/server.cpp: + + Fix windows access violations. + Fri Oct 17 10:35:00 UTC 2008 Simon Massey <sma at prismtech dot com> * orbsvcs/orsvcs/Naming/Naming_Context_Interface.cpp: diff --git a/TAO/orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.cpp b/TAO/orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.cpp index 10fca204f29..df3b9bad0f6 100644 --- a/TAO/orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.cpp +++ b/TAO/orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.cpp @@ -8,12 +8,16 @@ #include "tao/Exception.h" +Server_ORBInitializer2::Server_ORBInitializer2 (void) + : sri_ (0) +{ +} + void Server_ORBInitializer2::pre_init ( PortableInterceptor::ORBInitInfo_ptr ) { - } void @@ -21,9 +25,7 @@ Server_ORBInitializer2::post_init ( PortableInterceptor::ORBInitInfo_ptr info ) { - this->register_server_request_interceptors (info - ); - + this->register_server_request_interceptors (info); } void @@ -31,19 +33,21 @@ Server_ORBInitializer2::register_server_request_interceptors ( PortableInterceptor::ORBInitInfo_ptr info ) { - PortableInterceptor::ServerRequestInterceptor_ptr sri = - PortableInterceptor::ServerRequestInterceptor::_nil (); - + TAO249_ServerRequest_Interceptor2 *sri = 0; ACE_NEW_THROW_EX (sri, TAO249_ServerRequest_Interceptor2, CORBA::NO_MEMORY ()); PortableInterceptor::ServerRequestInterceptor_var server_interceptor = sri; + this->sri_ = sri; - info->add_server_request_interceptor (server_interceptor.in () - ); - + info->add_server_request_interceptor (server_interceptor.in ()); } - +void +Server_ORBInitializer2::set_server_iogr (CORBA::Object_ptr obj) +{ + if (this->sri_) + this->sri_->server_iogr_ = CORBA::Object::_duplicate (obj); +} diff --git a/TAO/orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.h b/TAO/orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.h index 088c8343ac8..eba911281cc 100644 --- a/TAO/orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.h +++ b/TAO/orbsvcs/tests/Bug_3215_Regression/ServerORBInitializer2.h @@ -20,6 +20,8 @@ #include "tao/LocalObject.h" +class TAO249_ServerRequest_Interceptor2; + /// RTCORBA ORB initializer. class Server_ORBInitializer2 : public virtual PortableInterceptor::ORBInitializer, @@ -27,12 +29,16 @@ class Server_ORBInitializer2 : { public: + Server_ORBInitializer2 (void); + virtual void pre_init (PortableInterceptor::ORBInitInfo_ptr info ); virtual void post_init (PortableInterceptor::ORBInitInfo_ptr info ); + void set_server_iogr (CORBA::Object_ptr obj); + private: /// Register the necessary interceptors. @@ -40,9 +46,10 @@ private: PortableInterceptor::ORBInitInfo_ptr info ); + // Private temprorary pointer + TAO249_ServerRequest_Interceptor2 *sri_; }; #include /**/ "ace/post.h" #endif /* TAO249_SERVER_ORBINITIALIZER2_H */ - diff --git a/TAO/orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.cpp b/TAO/orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.cpp index bdf9b182b3a..c3869c793ce 100644 --- a/TAO/orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.cpp +++ b/TAO/orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.cpp @@ -21,9 +21,6 @@ ACE_RCSID (FaultTolerance, TAO249_ServerRequest_Interceptor2, "$Id$") -CORBA::Object_var -TAO249_ServerRequest_Interceptor2::server_iogr_ = CORBA::Object::_nil (); - TAO249_ServerRequest_Interceptor2::TAO249_ServerRequest_Interceptor2 (void) : orb_ (0), expired_ (0) @@ -81,8 +78,8 @@ TAO249_ServerRequest_Interceptor2::receive_request ( if ((cdr >> ACE_InputCDR::to_boolean (byte_order)) == 0) { - throw CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, - CORBA::COMPLETED_NO); + throw (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, + CORBA::COMPLETED_NO)); } @@ -91,8 +88,8 @@ TAO249_ServerRequest_Interceptor2::receive_request ( FT::FTRequestServiceContext ftrsc; if ((cdr >> ftrsc) == 0) - throw CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, - CORBA::COMPLETED_NO); + throw (CORBA::BAD_PARAM (CORBA::OMGVMCID | 28, + CORBA::COMPLETED_NO)); TimeBase::TimeT now = get_now (); @@ -103,7 +100,7 @@ TAO249_ServerRequest_Interceptor2::receive_request ( if (expired_) { // The client has retried more than once after the expiration time. This is a regression - ACE_DEBUG ((LM_ERROR, "Test Failed - REGRESSION !!! Client ORB is still retrying LOCATION_FORWARDs / TRANSIENTS after the expiration time as re-invocation # %d has been received!!\n", invocation_count + 1)); + ACE_DEBUG ((LM_ERROR, "Test Failed - REGRESSION !!! Client ORB is still retrying LOCATION_FORWARDs / TRANSIENTS after the expiration time on invocation # %d !!\n", invocation_count + 1)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Expiration time : %Q\n"), ftrsc.expiration_time)); ACE_DEBUG ((LM_DEBUG, ACE_TEXT("Time now : %Q\n"), now)); @@ -125,22 +122,23 @@ TAO249_ServerRequest_Interceptor2::receive_request ( if (invocation_count == 0) { ++invocation_count; - - ACE_DEBUG ((LM_DEBUG, "On [re-]invocation #%d throwing a ForwardRequest back to the client\n", invocation_count)); - + if (expired_) + { + ACE_DEBUG ((LM_DEBUG, "On invocation #%d throwing a ForwardRequest back to the client\n", invocation_count)); + } // Throw a forward back to ourselves on the first try // This means that we are testing the exception handling after a forward perm... - throw PortableInterceptor::ForwardRequest (server_iogr_.in ()); + throw (PortableInterceptor::ForwardRequest (server_iogr_.in ())); } else { ++invocation_count; - if (expired_ || invocation_count % 1000 == 0) + if (expired_) { - ACE_DEBUG ((LM_DEBUG, "On re-invocation #%d throwing a TRANSIENT back to the client\n", invocation_count)); + ACE_DEBUG ((LM_DEBUG, "On invocation #%d throwing a TRANSIENT back to the client\n", invocation_count)); } // Thaen throw a transient on all subsequent invocations - throw CORBA::TRANSIENT (0, CORBA::COMPLETED_NO); + throw (CORBA::TRANSIENT (0, CORBA::COMPLETED_NO)); } } @@ -180,4 +178,3 @@ TAO249_ServerRequest_Interceptor2::send_other ( ) { } - diff --git a/TAO/orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.h b/TAO/orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.h index cdeb9e083ac..0f48024748b 100644 --- a/TAO/orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.h +++ b/TAO/orbsvcs/tests/Bug_3215_Regression/ServerRequest_Interceptor2.h @@ -30,57 +30,57 @@ class TAO249_ServerRequest_Interceptor2 { public: -/// Constructor. -TAO249_ServerRequest_Interceptor2 (void); - -/// Destructor. -~TAO249_ServerRequest_Interceptor2 (void); - -/** - * @name Methods Required by the Server Request Interceptor - * Interface - * - * These are methods that must be implemented since they are pure - * virtual in the abstract base class. They are the canonical - * methods required for all server request interceptors. - */ -//@{ -/// Return the name of this ServerRequestinterceptor. -virtual char * name (); - -virtual void destroy (); - -virtual void receive_request_service_contexts ( - PortableInterceptor::ServerRequestInfo_ptr ri - ); - -virtual void receive_request ( + /// Constructor. + TAO249_ServerRequest_Interceptor2 (void); + + /// Destructor. + ~TAO249_ServerRequest_Interceptor2 (void); + + /** + * @name Methods Required by the Server Request Interceptor + * Interface + * + * These are methods that must be implemented since they are pure + * virtual in the abstract base class. They are the canonical + * methods required for all server request interceptors. + */ + //@{ + /// Return the name of this ServerRequestinterceptor. + virtual char * name (); + + virtual void destroy (); + + virtual void receive_request_service_contexts ( PortableInterceptor::ServerRequestInfo_ptr ri ); -virtual void send_reply ( - PortableInterceptor::ServerRequestInfo_ptr ri - ); + virtual void receive_request ( + PortableInterceptor::ServerRequestInfo_ptr ri + ); -virtual void send_exception ( - PortableInterceptor::ServerRequestInfo_ptr ri - ); + virtual void send_reply ( + PortableInterceptor::ServerRequestInfo_ptr ri + ); -virtual void send_other ( - PortableInterceptor::ServerRequestInfo_ptr ri - ); -//@} + virtual void send_exception ( + PortableInterceptor::ServerRequestInfo_ptr ri + ); + + virtual void send_other ( + PortableInterceptor::ServerRequestInfo_ptr ri + ); + //@} -static CORBA::Object_var server_iogr_; + CORBA::Object_var server_iogr_; protected: TimeBase::TimeT get_now (void); private: -CORBA::ORB_var orb_; + CORBA::ORB_var orb_; -CORBA::Boolean expired_; + CORBA::Boolean expired_; }; #endif /* TAO249_SERVER_REQUEST_INTERCEPTOR2_H */ diff --git a/TAO/orbsvcs/tests/Bug_3215_Regression/server.cpp b/TAO/orbsvcs/tests/Bug_3215_Regression/server.cpp index 23a3c8cf4dd..a321f4d6d21 100644 --- a/TAO/orbsvcs/tests/Bug_3215_Regression/server.cpp +++ b/TAO/orbsvcs/tests/Bug_3215_Regression/server.cpp @@ -54,7 +54,7 @@ make_iogr (const char* domain_id, CORBA::ULongLong group_id, CORBA::ULong group_ TAO_IOP::TAO_IOR_Manipulation::IORList iors (1); iors.length(1); iors [0] = CORBA::Object::_duplicate (ref); - + CORBA::Object_var new_ref = iorm->merge_iors (iors ); @@ -130,34 +130,34 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) PortableServer::POAManager_var poa_manager = root_poa->the_POAManager (); - - + + CORBA::PolicyList policies (2); policies.length (2); policies[0] = root_poa->create_id_assignment_policy (PortableServer::USER_ID ); - + policies[1] = root_poa->create_lifespan_policy (PortableServer::PERSISTENT ); - + PortableServer::POA_var my_poa = root_poa->create_POA ("my_poa", poa_manager.in (), policies ); - + // Creation of the new POA is over, so destroy the Policy_ptr's. for (CORBA::ULong i = 0; i < policies.length (); ++i) { CORBA::Policy_ptr policy = policies[i]; policy->destroy (); - + } @@ -168,44 +168,45 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_NEW_RETURN (hello_impl, Hello (orb.in (), Test::Hello::_nil ()), 1); - PortableServer::ServantBase_var owner (hello_impl); - + PortableServer::ServantBase_var holder (hello_impl); + PortableServer::ObjectId_var server_id = PortableServer::string_to_ObjectId ("server_id"); my_poa->activate_object_with_id (server_id.in (), hello_impl ); - + CORBA::Object_var hello = my_poa->id_to_reference (server_id.in () ); - - + + CORBA::String_var ior = orb->object_to_string (hello.in () ); - - + + // Get a ref to the IORManipulation object CORBA::Object_var IORM = orb->resolve_initial_references (TAO_OBJID_IORMANIPULATION, 0 ); - + // Narrow iorm = TAO_IOP::TAO_IOR_Manipulation::_narrow (IORM.in() ); - CORBA::Object_var server = orb->string_to_object (ior.in ()); - - CORBA::Object_var iogr = make_iogr ("Domain_1", 1, 1, server.in ()); - - + CORBA::Object_var iortmp = + orb->string_to_object (ior.in ()); + + CORBA::Object_var iogr = make_iogr ("Domain_1", 1, 1, iortmp.in ()); + + CORBA::String_var iorgr_string = orb->object_to_string (iogr.in () ); - - + + // Output the IOR to the <ior_output_file> FILE *output_file= ACE_OS::fopen (ior_output_file, "w"); if (output_file == 0) @@ -216,21 +217,20 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) ACE_OS::fprintf (output_file, "%s", iorgr_string.in ()); ACE_OS::fclose (output_file); - TAO249_ServerRequest_Interceptor2::server_iogr_ = CORBA::Object::_duplicate (iogr.in ()); - + temp_initializer->set_server_iogr (iogr.in ()); + poa_manager->activate (); - + orb->run (); - + ACE_DEBUG ((LM_DEBUG, "(%P|%t) server - event loop finished\n")); root_poa->destroy (1, 1 ); - + orb->destroy (); - } catch (const CORBA::Exception& ex) { @@ -238,7 +238,7 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[]) "Exception caught:"); return 1; } - + return 0; } |