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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
#ifndef ICE_GRID_NODE_I_H
#define ICE_GRID_NODE_I_H
#include <IceUtil/Timer.h>
#include <IceGrid/Internal.h>
#include <IceGrid/PlatformInfo.h>
#include <IceGrid/UserAccountMapper.h>
#include <IceGrid/FileCache.h>
#include <set>
namespace IceGrid
{
class TraceLevels;
typedef IceUtil::Handle<TraceLevels> TraceLevelsPtr;
class Activator;
typedef IceUtil::Handle<Activator> ActivatorPtr;
class ServerI;
typedef IceUtil::Handle<ServerI> ServerIPtr;
class ServerCommand;
typedef IceUtil::Handle<ServerCommand> ServerCommandPtr;
class NodeSessionManager;
class NodeI;
typedef IceUtil::Handle<NodeI> NodeIPtr;
class NodeI : public Node, public IceUtil::Monitor<IceUtil::Mutex>
{
public:
class Update : public virtual IceUtil::Shared
{
public:
Update(const NodeIPtr&, const NodeObserverPrx&);
virtual ~Update();
virtual bool send() = 0;
void finished(bool);
void completed(const Ice::AsyncResultPtr&);
protected:
const NodeIPtr _node;
const NodeObserverPrx _observer;
};
typedef IceUtil::Handle<Update> UpdatePtr;
NodeI(const Ice::ObjectAdapterPtr&, NodeSessionManager&, const ActivatorPtr&, const IceUtil::TimerPtr&,
const TraceLevelsPtr&, const NodePrx&, const std::string&, const UserAccountMapperPrx&, const std::string&);
virtual ~NodeI();
virtual void loadServer_async(const AMD_Node_loadServerPtr&,
const InternalServerDescriptorPtr&,
const std::string&,
const Ice::Current&);
virtual void loadServerWithoutRestart_async(const AMD_Node_loadServerWithoutRestartPtr&,
const InternalServerDescriptorPtr&,
const std::string&,
const Ice::Current&);
virtual void destroyServer_async(const AMD_Node_destroyServerPtr&,
const std::string&,
const std::string&,
int,
const std::string&,
const Ice::Current&);
virtual void destroyServerWithoutRestart_async(const AMD_Node_destroyServerWithoutRestartPtr&,
const std::string&,
const std::string&,
int,
const std::string&,
const Ice::Current&);
virtual void registerWithReplica(const InternalRegistryPrx&, const Ice::Current&);
virtual void replicaInit(const InternalRegistryPrxSeq&, const Ice::Current&);
virtual void replicaAdded(const InternalRegistryPrx&, const Ice::Current&);
virtual void replicaRemoved(const InternalRegistryPrx&, const Ice::Current&);
virtual std::string getName(const Ice::Current&) const;
virtual std::string getHostname(const Ice::Current&) const;
virtual LoadInfo getLoad(const Ice::Current&) const;
virtual int getProcessorSocketCount(const Ice::Current&) const;
virtual void shutdown(const Ice::Current&) const;
virtual Ice::Long getOffsetFromEnd(const std::string&, int, const Ice::Current&) const;
virtual bool read(const std::string&, Ice::Long, int, Ice::Long&, Ice::StringSeq&, const Ice::Current&) const;
void shutdown();
IceUtil::TimerPtr getTimer() const;
Ice::CommunicatorPtr getCommunicator() const;
Ice::ObjectAdapterPtr getAdapter() const;
ActivatorPtr getActivator() const;
TraceLevelsPtr getTraceLevels() const;
UserAccountMapperPrx getUserAccountMapper() const;
PlatformInfo& getPlatformInfo() const;
FileCachePtr getFileCache() const;
NodePrx getProxy() const;
const PropertyDescriptorSeq& getPropertiesOverride() const;
const std::string& getInstanceName() const;
std::string getOutputDir() const;
bool getRedirectErrToOut() const;
bool allowEndpointsOverride() const;
NodeSessionPrx registerWithRegistry(const InternalRegistryPrx&);
void checkConsistency(const NodeSessionPrx&);
NodeSessionPrx getMasterNodeSession() const;
void addObserver(const NodeSessionPrx&, const NodeObserverPrx&);
void removeObserver(const NodeSessionPrx&);
void observerUpdateServer(const ServerDynamicInfo&);
void observerUpdateAdapter(const AdapterDynamicInfo&);
void queueUpdate(const NodeObserverPrx&, const UpdatePtr&);
void dequeueUpdate(const NodeObserverPrx&, const UpdatePtr&, bool);
void addServer(const ServerIPtr&, const std::string&);
void removeServer(const ServerIPtr&, const std::string&);
Ice::Identity createServerIdentity(const std::string&) const;
std::string getServerAdminCategory() const;
bool canRemoveServerDirectory(const std::string&);
private:
std::vector<ServerCommandPtr> checkConsistencyNoSync(const Ice::StringSeq&);
std::set<ServerIPtr> getApplicationServers(const std::string&) const;
std::string getFilePath(const std::string&) const;
void loadServer(const AMD_Node_loadServerPtr&, const InternalServerDescriptorPtr&, const std::string&, bool,
const Ice::Current&);
void destroyServer(const AMD_Node_destroyServerPtr&, const std::string&, const std::string&, int,
const std::string&, bool, const Ice::Current&);
const Ice::CommunicatorPtr _communicator;
const Ice::ObjectAdapterPtr _adapter;
NodeSessionManager& _sessions;
const ActivatorPtr _activator;
const IceUtil::TimerPtr _timer;
const TraceLevelsPtr _traceLevels;
const std::string _name;
const NodePrx _proxy;
const std::string _outputDir;
const bool _redirectErrToOut;
const bool _allowEndpointsOverride;
const Ice::Int _waitTime;
const std::string _instanceName;
const UserAccountMapperPrx _userAccountMapper;
mutable PlatformInfo _platform;
const std::string _dataDir;
const std::string _serversDir;
const std::string _tmpDir;
const FileCachePtr _fileCache;
PropertyDescriptorSeq _propertiesOverride;
unsigned long _serial;
bool _consistencyCheckDone;
IceUtil::Mutex _observerMutex;
std::map<NodeSessionPrx, NodeObserverPrx> _observers;
std::map<std::string, ServerDynamicInfo> _serversDynamicInfo;
std::map<std::string, AdapterDynamicInfo> _adaptersDynamicInfo;
std::map<NodeObserverPrx, std::deque<UpdatePtr> > _observerUpdates;
IceUtil::Mutex _serversLock;
std::map<std::string, std::set<ServerIPtr> > _serversByApplication;
};
typedef IceUtil::Handle<NodeI> NodeIPtr;
}
#endif
|