@eclipse-scout/core
Version:
Eclipse Scout runtime
91 lines • 3.88 kB
TypeScript
/// <reference types="jquery" />
import { CallModel, InitModelOf, ObjectWithType } from '../index';
/**
* Represents a robust "call" that, when it fails, is retried automatically for a specific
* number of times, before failing ultimately. The call implementation must be provided
* by a subclass by overriding the _callImpl() method.
*/
export declare abstract class Call implements CallModel, ObjectWithType {
model: CallModel;
objectType: string;
minCallDuration: number;
callCounter: number;
retryIntervals: number[];
maxRetries: number;
defaultRetryInterval: number;
deferred: JQuery.Deferred<any>;
aborted: boolean;
initialized: boolean;
pendingCall: JQuery.Promise<any>;
callTimeoutId: number;
callStartTimestamp: number;
type: string;
name: string;
uniqueName: string;
logPrefix: string;
result: any;
constructor();
static GLOBAL_SEQ: number;
init(model: InitModelOf<this>): void;
protected _checkInitialized(): void;
protected _updateLogPrefix(): void;
protected _resolve(): void;
protected _reject(): void;
protected _setResult(...args: any[]): void;
/**
* Performs the call with retries.
*
* Returns a promise that is ...
* ... RESOLVED when the call was successful (possibly after some retries).
* ... REJECTED when the call failed and no more retries are possible.
*
*
* | (promise)
* | ^
* v |
* +--------+ +---------+ .---------------. (yes)
* | call() | . . . . . | _call() | ------> < success? > ------> [RESOLVE]
* +--------+ +---------+ '---------------'
* ^ |(no)
* | |
* | v
* | .---------------. (yes)
* | < aborted? > ------> [REJECT]
* | '---------------'
* | |(no)
* | |
* | v
* | .---------------. (no)
* | < retry possible? > ------> [REJECT]
* | '---------------'
* | |(yes)
* | sleep |
* +-------- %%% ----------+
*/
call(): JQuery.Promise<any>;
/**
* Aborts the call. If the request is currently running, it is aborted (interrupted).
* If a retry is scheduled, that retry is cancelled.
*
* The promise returned by call() is REJECTED.
*/
abort(): void;
protected _call(): void;
/**
* Performs the actual request.
*/
protected abstract _callImpl(): JQuery.Promise<any>;
protected _setResultDone(...args: any[]): void;
protected _setResultFail(...args: any[]): void;
protected _onCallDone(...args: any[]): void;
protected _onCallFail(...args: any[]): void;
/**
* Checks if the call can be retried. If a number is returned, a retry is performed with a delay of the corresponding amount of milliseconds.
* All other values indicate that no retry must be performed. (It is recommended to return 'false' or 'null' in this case.)
* This method MAY be overridden by a subclass.
*/
protected _nextRetryImpl(...args: any[]): number | boolean;
protected _abort(): void;
protected _abortImpl(): void;
}
//# sourceMappingURL=Call.d.ts.map