summaryrefslogtreecommitdiff
path: root/js/src/Ice/ProxyBatchOutgoingAsync.js
blob: 372ee9dcc3ec91310e31b2bcf08e036207f2f39b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// **********************************************************************
//
// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_FOR_ACTIONSCRIPT_LICENSE file included in this distribution.
//
// **********************************************************************

(function(global){
    require("Ice/Class");
    require("Ice/AsyncResult");
    require("Ice/AsyncStatus");
    require("Ice/BatchOutgoingAsync");
    require("Ice/Protocol");

    var Ice = global.Ice || {};

    var AsyncResult = Ice.AsyncResult;
    var AsyncStatus = Ice.AsyncStatus;
    var BatchOutgoingAsync = Ice.BatchOutgoingAsync;
    var Protocol = Ice.Protocol;

    var ProxyBatchOutgoingAsync = Ice.Class(BatchOutgoingAsync, {
        __init__: function(prx, operation)
        {
            BatchOutgoingAsync.call(this, prx.ice_getCommunicator(), operation);
            this._proxy = prx;
        },
        __send: function()
        {
            Protocol.checkSupportedProtocol(this._proxy.__reference().getProtocol());

            //
            // We don't automatically retry if ice_flushBatchRequests fails. Otherwise, if some batch
            // requests were queued with the connection, they would be lost without being noticed.
            //
            var handler = null;
            var cnt = -1; // Don't retry.
            try
            {
                handler = this._proxy.__getRequestHandler();
                handler.flushAsyncBatchRequests(this);
            }
            catch(__ex)
            {
                cnt = this._proxy.__handleException(handler, __ex, 0, cnt);
            }
        }
    });
    
    Ice.ProxyBatchOutgoingAsync = ProxyBatchOutgoingAsync;
    global.Ice = Ice;
}(typeof (global) === "undefined" ? window : global));