summaryrefslogtreecommitdiff
path: root/js/src/Ice/LocatorManager.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/Ice/LocatorManager.js')
-rw-r--r--js/src/Ice/LocatorManager.js132
1 files changed, 66 insertions, 66 deletions
diff --git a/js/src/Ice/LocatorManager.js b/js/src/Ice/LocatorManager.js
index e7389b844af..6875c3eb672 100644
--- a/js/src/Ice/LocatorManager.js
+++ b/js/src/Ice/LocatorManager.js
@@ -7,82 +7,82 @@
//
// **********************************************************************
-(function(global){
- require("Ice/Class");
- require("Ice/HashMap");
- require("Ice/LocatorInfo");
- require("Ice/LocatorTable");
- require("Ice/Locator");
-
- var Ice = global.Ice || {};
-
- var HashMap = Ice.HashMap;
- var LocatorInfo = Ice.LocatorInfo;
- var LocatorTable = Ice.LocatorTable;
- var LocatorPrx = Ice.LocatorPrx;
+var Ice = require("../Ice/ModuleRegistry").Ice;
+Ice.__M.require(module, "Ice",
+ [
+ "../Ice/Class",
+ "../Ice/HashMap",
+ "../Ice/LocatorInfo",
+ "../Ice/LocatorTable",
+ "../Ice/Locator"
+ ]);
- var LocatorManager = Ice.Class({
- __init__: function(properties)
- {
- this._background = properties.getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0;
+var HashMap = Ice.HashMap;
+var LocatorInfo = Ice.LocatorInfo;
+var LocatorTable = Ice.LocatorTable;
+var LocatorPrx = Ice.LocatorPrx;
+
+var LocatorManager = Ice.Class({
+ __init__: function(properties)
+ {
+ this._background = properties.getPropertyAsInt("Ice.BackgroundLocatorCacheUpdates") > 0;
- this._table = new HashMap(); // Map<Ice.LocatorPrx, LocatorInfo>
- this._table.keyComparator = HashMap.compareEquals;
- this._locatorTables = new HashMap(); // Map<Ice.Identity, LocatorTable>
- this._locatorTables.keyComparator = HashMap.compareEquals;
- },
- destroy: function()
+ this._table = new HashMap(); // Map<Ice.LocatorPrx, LocatorInfo>
+ this._table.keyComparator = HashMap.compareEquals;
+ this._locatorTables = new HashMap(); // Map<Ice.Identity, LocatorTable>
+ this._locatorTables.keyComparator = HashMap.compareEquals;
+ },
+ destroy: function()
+ {
+ for(var e = this._table.entries; e !== null; e = e.next)
{
- for(var e = this._table.entries; e !== null; e = e.next)
- {
- e.value.destroy();
- }
- this._table.clear();
- this._locatorTables.clear();
- },
+ e.value.destroy();
+ }
+ this._table.clear();
+ this._locatorTables.clear();
+ },
+ //
+ // Returns locator info for a given locator. Automatically creates
+ // the locator info if it doesn't exist yet.
+ //
+ find: function(loc)
+ {
+ if(loc === null)
+ {
+ return null;
+ }
+
//
- // Returns locator info for a given locator. Automatically creates
- // the locator info if it doesn't exist yet.
+ // The locator can't be located.
//
- find: function(loc)
- {
- if(loc === null)
- {
- return null;
- }
+ var locator = LocatorPrx.uncheckedCast(loc.ice_locator(null));
- //
- // The locator can't be located.
- //
- var locator = LocatorPrx.uncheckedCast(loc.ice_locator(null));
+ //
+ // TODO: reap unused locator info objects?
+ //
+ var info = this._table.get(locator);
+ if(info === undefined)
+ {
//
- // TODO: reap unused locator info objects?
+ // Rely on locator identity for the adapter table. We want to
+ // have only one table per locator (not one per locator
+ // proxy).
//
-
- var info = this._table.get(locator);
- if(info === undefined)
+ var table = this._locatorTables.get(locator.ice_getIdentity());
+ if(table === undefined)
{
- //
- // Rely on locator identity for the adapter table. We want to
- // have only one table per locator (not one per locator
- // proxy).
- //
- var table = this._locatorTables.get(locator.ice_getIdentity());
- if(table === undefined)
- {
- table = new LocatorTable();
- this._locatorTables.set(locator.ice_getIdentity(), table);
- }
-
- info = new LocatorInfo(locator, table, this._background);
- this._table.set(locator, info);
+ table = new LocatorTable();
+ this._locatorTables.set(locator.ice_getIdentity(), table);
}
- return info;
+ info = new LocatorInfo(locator, table, this._background);
+ this._table.set(locator, info);
}
- });
-
- Ice.LocatorManager = LocatorManager;
- global.Ice = Ice;
-}(typeof (global) === "undefined" ? window : global));
+
+ return info;
+ }
+});
+
+Ice.LocatorManager = LocatorManager;
+module.exports.Ice = Ice;