blob: 7a253b6dc1605a2e448858861ad7bceab297bf3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
// -*- C++ -*-
#include "LifespanStrategyPersistent.h"
ACE_RCSID (PortableServer,
Lifespan_Strategy,
"$Id$")
#include "Root_POA.h"
#include "POAManager.h"
#include "ImR_Client_Adapter.h"
#include "tao/ORB_Core.h"
#include "ace/OS_NS_sys_time.h"
#include "ace/Dynamic_Service.h"
#include "ace/Service_Config.h"
namespace TAO
{
namespace Portable_Server
{
bool
LifespanStrategyPersistent::validate (
CORBA::Boolean is_persistent,
const TAO::Portable_Server::Temporary_Creation_Time& /*creation_time*/) const
{
return is_persistent;
}
char
LifespanStrategyPersistent::key_type (void) const
{
return 'P';
}
CORBA::Boolean
LifespanStrategyPersistent::is_persistent (void) const
{
return true;
}
void
LifespanStrategyPersistent::create_key (
CORBA::Octet *buffer,
CORBA::ULong& starting_at)
{
// Copy the persistence byte.
buffer[starting_at] = static_cast<CORBA::Octet> (this->key_type ());
starting_at += this->key_type_length ();
}
CORBA::ULong
LifespanStrategyPersistent::key_length () const
{
return this->key_type_length ();
}
void
LifespanStrategyPersistent::notify_startup (ACE_ENV_SINGLE_ARG_DECL)
{
ImR_Client_Adapter *adapter =
ACE_Dynamic_Service<ImR_Client_Adapter>::instance (
TAO_Root_POA::imr_client_adapter_name ()
);
#if !defined (TAO_AS_STATIC_LIBS)
// In case we build shared, try to load the ImR Client library, in a
// static build we just can't do this, so don't try it, lower layers
// output an error then.
if (adapter == 0)
{
ACE_Service_Config::process_directive (
#if !defined ACE_HAS_XML_SVC_CONF
ACE_TEXT("dynamic ImR_Client_Adapter Service_Object *")
ACE_TEXT("TAO_ImR_Client:_make_ImR_Client_Adapter_Impl()")
#else
ACE_TEXT("<ACE_Svc_Conf>")
ACE_TEXT("<dynamic id=\"ImR_Client_Adapter\" type=\"Service_Object\">")
ACE_TEXT("<initializer path=\"TAO_ImR_Client\"")
ACE_TEXT(" init=\"_make_ImR_Client_Adapter_Impl\"")
ACE_TEXT(" params=\"\"/>")
ACE_TEXT("</dynamic>")
ACE_TEXT("</ACE_Svc_Conf>")
#endif
);
adapter =
ACE_Dynamic_Service<ImR_Client_Adapter>::instance (
TAO_Root_POA::imr_client_adapter_name ());
}
#endif /* !TAO_AS_STATIC_LIBS */
if (adapter != 0)
{
bool old_use_imr = this->use_imr_;
this->use_imr_ = false;
adapter->imr_notify_startup (this->poa_ ACE_ENV_ARG_PARAMETER);
ACE_CHECK;
this->use_imr_ = old_use_imr;
}
}
void
LifespanStrategyPersistent::notify_shutdown (ACE_ENV_SINGLE_ARG_DECL)
{
ImR_Client_Adapter *adapter =
ACE_Dynamic_Service<ImR_Client_Adapter>::instance (
TAO_Root_POA::imr_client_adapter_name ()
);
if (adapter != 0)
{
adapter->imr_notify_shutdown (this->poa_ ACE_ENV_ARG_PARAMETER);
}
}
LifespanStrategyPersistent::LifespanStrategyPersistent() :
use_imr_ (true)
{
}
void
LifespanStrategyPersistent::check_state (ACE_ENV_SINGLE_ARG_DECL)
{
this->poa_->tao_poa_manager().check_state (ACE_ENV_SINGLE_ARG_PARAMETER);
}
::PortableServer::LifespanPolicyValue
LifespanStrategyPersistent::type() const
{
return ::PortableServer::PERSISTENT;
}
bool
LifespanStrategyPersistent::use_imr () const
{
return use_imr_;
}
} /* namespace Portable_Server */
} /* namespace TAO */
|