summaryrefslogtreecommitdiff
path: root/js/src/Ice/ObjectAdapterFactory.js
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2016-08-19 21:25:18 +0200
committerJose <jose@zeroc.com>2016-08-19 21:25:18 +0200
commitc8d32e04873be7938915c606027c84c8ab832f6b (patch)
treef862751cfaddcf5bb7b82a7c04a299d471f948d4 /js/src/Ice/ObjectAdapterFactory.js
parentFix ICE-7278 (diff)
downloadice-c8d32e04873be7938915c606027c84c8ab832f6b.tar.bz2
ice-c8d32e04873be7938915c606027c84c8ab832f6b.tar.xz
ice-c8d32e04873be7938915c606027c84c8ab832f6b.zip
ES6 mapping updates
Diffstat (limited to 'js/src/Ice/ObjectAdapterFactory.js')
-rw-r--r--js/src/Ice/ObjectAdapterFactory.js84
1 files changed, 35 insertions, 49 deletions
diff --git a/js/src/Ice/ObjectAdapterFactory.js b/js/src/Ice/ObjectAdapterFactory.js
index 89de4ba3d96..619396bf716 100644
--- a/js/src/Ice/ObjectAdapterFactory.js
+++ b/js/src/Ice/ObjectAdapterFactory.js
@@ -7,10 +7,9 @@
//
// **********************************************************************
-var Ice = require("../Ice/ModuleRegistry").Ice;
+const Ice = require("../Ice/ModuleRegistry").Ice;
Ice.__M.require(module,
[
- "../Ice/Class",
"../Ice/AsyncResultBase",
"../Ice/LocalException",
"../Ice/ObjectAdapterI",
@@ -18,23 +17,25 @@ Ice.__M.require(module,
"../Ice/UUID"
]);
-var AsyncResultBase = Ice.AsyncResultBase;
-var ObjectAdapterI = Ice.ObjectAdapterI;
-var Promise = Ice.Promise;
+const AsyncResultBase = Ice.AsyncResultBase;
+const ObjectAdapterI = Ice.ObjectAdapterI;
+const _Promise = Ice.Promise;
//
// Only for use by Instance.
//
-var ObjectAdapterFactory = Ice.Class({
- __init__: function(instance, communicator)
+class ObjectAdapterFactory
+{
+ constructor(instance, communicator)
{
this._instance = instance;
this._communicator = communicator;
this._adapters = [];
this._adapterNamesInUse = [];
- this._shutdownPromise = new Promise();
- },
- shutdown: function()
+ this._shutdownPromise = new _Promise();
+ }
+
+ shutdown()
{
//
// Ignore shutdown requests if the object adapter factory has
@@ -47,55 +48,39 @@ var ObjectAdapterFactory = Ice.Class({
this._instance = null;
this._communicator = null;
- this._shutdownPromise = Promise.all(
- this._adapters.map(function(adapter)
- {
- return adapter.deactivate();
- }));
+ this._shutdownPromise = _Promise.all(this._adapters.map(adapter => adapter.deactivate()));
return this._shutdownPromise;
- },
- waitForShutdown: function()
+ }
+
+ waitForShutdown()
{
- var self = this;
- return this._shutdownPromise.then(
- function()
- {
- return Promise.all(self._adapters.map(function(adapter)
- {
- return adapter.waitForDeactivate();
- }));
- });
- },
- isShutdown: function()
+ return this._shutdownPromise.then(() => _Promise.all(this._adapters.map(adapter => adapter.waitForDeactivate())));
+ }
+
+ isShutdown()
{
return this._instance === null;
- },
- destroy: function()
+ }
+
+ destroy()
{
- var self = this;
- return this.waitForShutdown().then(
- function()
- {
- return Promise.all(self._adapters.map(function(adapter)
- {
- return adapter.destroy();
- }));
- });
- },
- createObjectAdapter: function(name, router, promise)
+ return this.waitForShutdown().then(() => _Promise.all(this._adapters.map(adapter => adapter.destroy())));
+ }
+
+ createObjectAdapter(name, router, promise)
{
if(this._instance === null)
{
throw new Ice.ObjectAdapterDeactivatedException();
}
- var adapter = null;
+ let adapter = null;
try
{
if(name.length === 0)
{
- var uuid = Ice.generateUUID();
- adapter = new ObjectAdapterI(this._instance, this._communicator, this, uuid, null, true, promise);
+ adapter = new ObjectAdapterI(this._instance, this._communicator, this, Ice.generateUUID(), null, true,
+ promise);
}
else
{
@@ -110,17 +95,18 @@ var ObjectAdapterFactory = Ice.Class({
}
catch(ex)
{
- promise.fail(ex, promise);
+ promise.reject(ex);
}
- },
- removeObjectAdapter: function(adapter)
+ }
+
+ removeObjectAdapter(adapter)
{
if(this._instance === null)
{
return;
}
- var n = this._adapters.indexOf(adapter);
+ let n = this._adapters.indexOf(adapter);
if(n !== -1)
{
this._adapters.splice(n, 1);
@@ -132,7 +118,7 @@ var ObjectAdapterFactory = Ice.Class({
this._adapterNamesInUse.splice(n, 1);
}
}
-});
+}
Ice.ObjectAdapterFactory = ObjectAdapterFactory;
module.exports.Ice = Ice;