summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/AdapterCache.h
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2005-07-08 13:47:30 +0000
committerBenoit Foucher <benoit@zeroc.com>2005-07-08 13:47:30 +0000
commit99894938dbde9a0bb10fc1998d9863cae52b8977 (patch)
tree5b68e52e9a62792f11d8a4e2c844d394cd39f496 /cpp/src/IceGrid/AdapterCache.h
parentFixed Ice interoperability issue (diff)
downloadice-99894938dbde9a0bb10fc1998d9863cae52b8977.tar.bz2
ice-99894938dbde9a0bb10fc1998d9863cae52b8977.tar.xz
ice-99894938dbde9a0bb10fc1998d9863cae52b8977.zip
More adapter replication changes.
Diffstat (limited to 'cpp/src/IceGrid/AdapterCache.h')
-rw-r--r--cpp/src/IceGrid/AdapterCache.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/cpp/src/IceGrid/AdapterCache.h b/cpp/src/IceGrid/AdapterCache.h
new file mode 100644
index 00000000000..2922d40f26c
--- /dev/null
+++ b/cpp/src/IceGrid/AdapterCache.h
@@ -0,0 +1,63 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_GRID_ADAPTERCACHE_H
+#define ICE_GRID_ADAPTERCACHE_H
+
+#include <IceUtil/Mutex.h>
+#include <IceUtil/Shared.h>
+#include <IceGrid/Cache.h>
+
+namespace IceGrid
+{
+
+class AdapterCache;
+
+class ServerEntry;
+typedef IceUtil::Handle<ServerEntry> ServerEntryPtr;
+
+class AdapterEntry;
+typedef IceUtil::Handle<AdapterEntry> AdapterEntryPtr;
+
+class AdapterEntry : public IceUtil::Shared, public IceUtil::Mutex
+{
+public:
+
+ AdapterEntry(Cache<std::string, AdapterEntry>&, const std::string&);
+
+ AdapterPrx getProxy(const std::string& = std::string()) const;
+
+ void enableReplication(LoadBalancingPolicy);
+ void disableReplication();
+
+ void addServer(const ServerEntryPtr&);
+ void removeServer(const ServerEntryPtr&);
+
+ bool canRemove();
+
+private:
+
+ Cache<std::string, AdapterEntry>& _cache;
+ const std::string _id;
+ bool _replicated;
+ LoadBalancingPolicy _loadBalancing;
+ std::map<std::string, ServerEntryPtr> _servers;
+};
+typedef IceUtil::Handle<AdapterEntry> AdapterEntryPtr;
+
+class AdapterCache : public CacheByString<AdapterEntry>
+{
+public:
+
+ AdapterEntryPtr get(const std::string&, bool = false) const;
+};
+
+};
+
+#endif