Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

RPCManager.sendQueue(new RPCQueueCallback()) never calls the callback

$
0
0
Hi,

SmartClient Version: v9.1p_2014-07-12/Pro Deployment (built 2014-07-12)

Somewhere, we start a Queue and use a callback on SendQueue to know when it's done. Deeper logic might call server in that Queue.
Sometimes though, the Queue doesn't do anything (because the server call isn't needed because the response is already cached in client).

In that scenario, sendQueue just returns false, without notifying the callback.

Code:

    sendQueue : function (callback, prompt, URL, delay) {
        var transaction = this.currentTransaction;

        // we're going to submit this transaction or error out in some way - in either way we're not
        // going to continue queueing
        this.currentTransaction = null;
        this.queuing = false;

        if (!transaction) {
            //>DEBUG Note this can happen easily if rpcRequests have been deferred because they
            // are attempted before page load.
            this.logInfo("sendQueue called with no current queue, ignoring");
            //<DEBUG
            return false;
        }
        if (delay) this.delayCall("_sendQueue", [callback,prompt,URL,transaction]);
        else return this._sendQueue(callback,prompt,URL,transaction);
    },


The "return false" doesn't make it to SmartGWT, since it's only void :: public static native void sendQueue(RPCQueueCallback callback)

Can you maybe call the callback with "null" responses in that if (!transaction) ?
Or use the return boolean result in SmartGWT?



I could have tried checking if there is a transaction too, but this will probably yield a nullpointer in that case:
Code:

    public static native int getCurrentTransactionIdAsInt() /*-{
        return $wnd.isc.RPCManager.getCurrentTransactionId();
    }-*/;

Since that returns an "int", but in JavaScript it can return "null".
Code:

    getCurrentTransactionId : function () {
        return this.currentTransaction ? this.currentTransaction.transactionNum : null;
    },



TIA

Viewing all articles
Browse latest Browse all 4756

Trending Articles