diff options
author | Benoit Foucher <benoit@zeroc.com> | 2002-06-28 19:20:18 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2002-06-28 19:20:18 +0000 |
commit | 75ac12c02d537f38b03567e406cbeccf29226fe0 (patch) | |
tree | 4add4682e2aa8edd9c58f1a23ad3f0ccc8336d02 /java/src/IceInternal/LocatorManager.java | |
parent | Replaced invalid struct name Struct with Structure. (diff) | |
download | ice-75ac12c02d537f38b03567e406cbeccf29226fe0.tar.bz2 ice-75ac12c02d537f38b03567e406cbeccf29226fe0.tar.xz ice-75ac12c02d537f38b03567e406cbeccf29226fe0.zip |
Merged location branch.
Diffstat (limited to 'java/src/IceInternal/LocatorManager.java')
-rw-r--r-- | java/src/IceInternal/LocatorManager.java | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/java/src/IceInternal/LocatorManager.java b/java/src/IceInternal/LocatorManager.java new file mode 100644 index 00000000000..faf7201bd2e --- /dev/null +++ b/java/src/IceInternal/LocatorManager.java @@ -0,0 +1,65 @@ +// ********************************************************************** +// +// Copyright (c) 2001 +// MutableRealms, Inc. +// Huntsville, AL, USA +// +// All Rights Reserved +// +// ********************************************************************** + +package IceInternal; + +public final class LocatorManager +{ + LocatorManager() + { + } + + synchronized void + destroy() + { + _table.clear(); + _adapterTables.clear(); + } + + // + // Returns locator info for a given locator. Automatically creates + // the locator info if it doesn't exist yet. + // + public LocatorInfo + get(Ice.LocatorPrx locator) + { + if(locator == null) + { + return null; + } + + synchronized (this) + { + LocatorInfo info = (LocatorInfo)_table.get(locator); + if(info == null) + { + // + // Rely on locator identity for the adapter table. We want to + // have only one table per locator (not one per locator + // proxy). + // + LocatorAdapterTable adapterTable = (LocatorAdapterTable)_adapterTables.get(locator.ice_getIdentity()); + if(adapterTable == null) + { + adapterTable = new LocatorAdapterTable(); + _adapterTables.put(locator.ice_getIdentity(), adapterTable); + } + + info = new LocatorInfo(locator, adapterTable); + _table.put(locator, info); + } + + return info; + } + } + + private java.util.HashMap _table = new java.util.HashMap(); + private java.util.HashMap _adapterTables = new java.util.HashMap(); +} |