2 #include "tao/PortableServer/LifespanStrategyTransient.h"
3 #include "ace/OS_NS_sys_time.h"
4 #include "ace/OS_NS_string.h"
5 #include "tao/PortableServer/POAManager.h"
6 #include "tao/PortableServer/Root_POA.h"
7 #include "tao/ORB_Constants.h"
8 #include "tao/PortableServer/Creation_Time.h"
10 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
14 namespace Portable_Server
16 LifespanStrategyTransient::LifespanStrategyTransient () :
17 creation_time_ (ACE_OS::gettimeofday ())
22 LifespanStrategyTransient::notify_startup ()
27 LifespanStrategyTransient::notify_shutdown ()
32 LifespanStrategyTransient::is_persistent () const
38 LifespanStrategyTransient::validate (CORBA::Boolean is_persistent
,
39 const TAO::Portable_Server::
40 Temporary_Creation_Time
43 return (!is_persistent
&& this->creation_time_
== creation_time
);
47 LifespanStrategyTransient::key_length () const
49 CORBA::ULong keylength
= sizeof (char);
51 #if (POA_NO_TIMESTAMP == 0)
52 // Calculate the space required for the timestamp.
53 keylength
+= TAO::Portable_Server::Creation_Time::creation_time_length
55 #endif /* POA_NO_TIMESTAMP */
61 LifespanStrategyTransient::create_key (CORBA::Octet
*buffer
,
62 CORBA::ULong
&starting_at
)
64 // Copy the persistence byte.
65 buffer
[starting_at
] = (CORBA::Octet
)this->key_type ();
66 starting_at
+= this->key_type_length ();
68 #if (POA_NO_TIMESTAMP == 0)
69 // Then copy the timestamp for transient POAs.
70 ACE_OS::memcpy (&buffer
[starting_at
],
71 this->creation_time_
.creation_time (),
72 TAO::Portable_Server::Creation_Time::creation_time_length
74 starting_at
+= TAO::Portable_Server::Creation_Time::creation_time_length
76 #endif /* POA_NO_TIMESTAMP */
80 LifespanStrategyTransient::key_type () const
86 LifespanStrategyTransient::check_state ()
88 if (this->poa_
->tao_poa_manager ().get_state_i () ==
89 PortableServer::POAManager::INACTIVE
)
91 throw ::CORBA::OBJECT_NOT_EXIST (CORBA::OMGVMCID
| 4, CORBA::COMPLETED_NO
);
95 this->poa_
->tao_poa_manager ().check_state ();
100 LifespanStrategyTransient::use_imr () const
106 LifespanStrategyTransient::imr_key_to_object (const TAO::ObjectKey
&,
109 return CORBA::Object::_nil();
111 } /* namespace Portable_Server */
112 } /* namespace TAO */
114 TAO_END_VERSIONED_NAMESPACE_DECL