summaryrefslogtreecommitdiff
path: root/js/src/Ice/BatchRequestQueue.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/BatchRequestQueue.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/BatchRequestQueue.js')
-rw-r--r--js/src/Ice/BatchRequestQueue.js61
1 files changed, 33 insertions, 28 deletions
diff --git a/js/src/Ice/BatchRequestQueue.js b/js/src/Ice/BatchRequestQueue.js
index deab2209be5..cfc965763e4 100644
--- a/js/src/Ice/BatchRequestQueue.js
+++ b/js/src/Ice/BatchRequestQueue.js
@@ -7,26 +7,25 @@
//
// **********************************************************************
-var Ice = require("../Ice/ModuleRegistry").Ice;
+const Ice = require("../Ice/ModuleRegistry").Ice;
Ice.__M.require(module,
[
- "../Ice/Class",
"../Ice/Stream",
"../Ice/Debug",
"../Ice/ExUtil",
"../Ice/Protocol",
]);
-var OutputStream = Ice.OutputStream;
-var Debug = Ice.Debug;
-var ExUtil = Ice.ExUtil;
-var Class = Ice.Class;
-var Protocol = Ice.Protocol;
+const OutputStream = Ice.OutputStream;
+const Debug = Ice.Debug;
+const ExUtil = Ice.ExUtil;
+const Protocol = Ice.Protocol;
-var udpOverhead = 20 + 8;
+const udpOverhead = 20 + 8;
-var BatchRequestQueue = Class({
- __init__: function(instance, datagram)
+class BatchRequestQueue
+{
+ constructor(instance, datagram)
{
this._batchStreamInUse = false;
this._batchRequestNum = 0;
@@ -38,23 +37,25 @@ var BatchRequestQueue = Class({
this._maxSize = instance.batchAutoFlushSize();
if(this._maxSize > 0 && datagram)
{
- var props = instance.initializationData().properties;
- var udpSndSize = props.getPropertyAsIntWithDefault("Ice.UDP.SndSize", 65535 - udpOverhead);
+ const udpSndSize = instance.initializationData().properties.getPropertyAsIntWithDefault(
+ "Ice.UDP.SndSize", 65535 - udpOverhead);
if(udpSndSize < this._maxSize)
{
this._maxSize = udpSndSize;
}
}
- },
- prepareBatchRequest: function(os)
+ }
+
+ prepareBatchRequest(os)
{
if(this._exception)
{
throw this._exception;
}
this._batchStream.swap(os);
- },
- finishBatchRequest: function(os, proxy, operation)
+ }
+
+ finishBatchRequest(os, proxy, operation)
{
//
// No need for synchronization, no other threads are supposed
@@ -77,29 +78,31 @@ var BatchRequestQueue = Class({
{
this._batchStream.resize(this._batchMarker);
}
- },
- abortBatchRequest: function(os)
+ }
+
+ abortBatchRequest(os)
{
this._batchStream.swap(os);
this._batchStream.resize(this._batchMarker);
- },
- swap: function(os)
+ }
+
+ swap(os)
{
if(this._batchRequestNum === 0)
{
return 0;
}
- var lastRequest = null;
+ let lastRequest = null;
if(this._batchMarker < this._batchStream.size)
{
- var length = this._batchStream.size - this._batchMarker;
+ const length = this._batchStream.size - this._batchMarker;
this._batchStream.pos = this._batchMarker;
lastRequest = this._batchStream.buffer.getArray(length);
this._batchStream.resize(this._batchMarker);
}
- var requestNum = this._batchRequestNum;
+ const requestNum = this._batchRequestNum;
this._batchStream.swap(os);
//
@@ -113,16 +116,18 @@ var BatchRequestQueue = Class({
this._batchStream.writeBlob(lastRequest);
}
return requestNum;
- },
- destroy: function(ex)
+ }
+
+ destroy(ex)
{
this._exception = ex;
- },
- isEmpty: function()
+ }
+
+ isEmpty()
{
return this._batchStream.size === Protocol.requestBatchHdr.length;
}
-});
+}
Ice.BatchRequestQueue = BatchRequestQueue;
module.exports.Ice = Ice;