Platform SDK Java 8.5 API Reference

com.genesyslab.platform.applicationblocks.com
Interface AsyncRequestResult<T extends ICfgObject>

Type Parameters:
T - specific wrapping class of particular configuration objects type
All Superinterfaces:
java.util.concurrent.Future<java.util.Collection<T>>

public interface AsyncRequestResult<T extends ICfgObject>
extends java.util.concurrent.Future<java.util.Collection<T>>

A AsyncRequestResult as an extension of Future represents the result of an asynchronous read operation of configuration data. Methods are provided to check if the read operation is complete, to wait for its completion, and to retrieve the result of the operation. The result can only be retrieved using method get when the read operation has completed, blocking if necessary until it is ready. Cancellation is performed by the cancel method. Additional methods are provided to determine if the task completed normally or was canceled. Once an operation has completed, it cannot be canceled.

Author:
Petr Makagon, Vladislav Baranovsky, Alexander Filatov, Anton Brazhnyk, Sergii Volokh

Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
          Attempts to cancel execution of this task.
 java.util.Collection<T> get()
          Waits if necessary for the read operation to complete, and then returns its result.
 java.util.Collection<T> get(long timeout, java.util.concurrent.TimeUnit unit)
          Waits if necessary for at most the given time for the request to complete, and then returns its result, if available.
 java.lang.Exception getException()
          This function returns raised exception when operation is failed.
 boolean isCancelled()
          Returns true if this task was canceled before it completed normally.
 boolean isCompletedSynchronously()
           
 boolean isDone()
          Returns true if this task completed.
 boolean isFailed()
          Returns true if this task finished with some error.
 java.util.Collection<T> partialGet()
          Returns accumulated read data immediately.
 

Method Detail

isDone

boolean isDone()
Returns true if this task completed.

Completion may be due to normal termination, an exception, or cancellation -- in all of these cases, this method will return true.

Specified by:
isDone in interface java.util.concurrent.Future<java.util.Collection<T extends ICfgObject>>
Returns:
true if this task completed.

isFailed

boolean isFailed()
Returns true if this task finished with some error.

Failure may be due to exception, or cancellation -- in any of these cases, this method will return true.

Returns:
true if this task failed.

isCompletedSynchronously

boolean isCompletedSynchronously()

getException

java.lang.Exception getException()
This function returns raised exception when operation is failed.

Returns:
asynchronous operation execution exception or null

cancel

boolean cancel(boolean mayInterruptIfRunning)
Attempts to cancel execution of this task. This attempt will fail if the task has already completed, already been canceled, or could not be canceled for some other reason. If successful, and this task has not started when cancel is called, this task should never run. If the task has already started, then the mayInterruptIfRunning parameter determines whether the thread executing this task should be interrupted in an attempt to stop the task.

Note: Actual request procession (network traffic for this data) is not interrupted/stopped. This function cancels the request on ConfService level and notifies all listeners that are waiting for the result. ConfService will skip further configuration server messages on this request.

Specified by:
cancel in interface java.util.concurrent.Future<java.util.Collection<T extends ICfgObject>>
Parameters:
mayInterruptIfRunning - true if the thread executing this task should be interrupted; otherwise, in-progress tasks are allowed to complete
Returns:
false if the task could not be canceled, typically because it has already completed normally; true otherwise

isCancelled

boolean isCancelled()
Returns true if this task was canceled before it completed normally.

Specified by:
isCancelled in interface java.util.concurrent.Future<java.util.Collection<T extends ICfgObject>>
Returns:
true if task was canceled before it completed

get

java.util.Collection<T> get()
                                               throws java.lang.InterruptedException,
                                                      java.util.concurrent.ExecutionException
Waits if necessary for the read operation to complete, and then returns its result.

Specified by:
get in interface java.util.concurrent.Future<java.util.Collection<T extends ICfgObject>>
Returns:
the computed result or null
Throws:
java.util.concurrent.CancellationException - if the computation was canceled
java.util.concurrent.ExecutionException - if the computation threw an exception
java.lang.InterruptedException - if the current thread was interrupted while waiting

get

java.util.Collection<T> get(long timeout,
                            java.util.concurrent.TimeUnit unit)
                                               throws java.lang.InterruptedException,
                                                      java.util.concurrent.ExecutionException,
                                                      java.util.concurrent.TimeoutException
Waits if necessary for at most the given time for the request to complete, and then returns its result, if available.

Specified by:
get in interface java.util.concurrent.Future<java.util.Collection<T extends ICfgObject>>
Parameters:
timeout - the maximum time to wait
unit - the time unit of the timeout argument
Returns:
list containing requested configuration objects or null
Throws:
java.util.concurrent.CancellationException - if the computation was canceled
java.util.concurrent.ExecutionException - if the computation threw an exception
java.util.concurrent.TimeoutException - if the wait timed out
java.lang.InterruptedException - if the current thread was interrupted while waiting

partialGet

java.util.Collection<T> partialGet()
Returns accumulated read data immediately. Do Not wait for the read operation to complete. This method ignores exceptions and returns partial data even if operation is canceled or failed (unfinished).

Returns:
the computed result or null

Platform SDK Java 8.5 API Reference

Send comments on this topicTechpubs.webadmin@genesys.com.
Document version: 8.5.302.00
Copyright © 2006–2017 Genesys Telecommunications Laboratories, Inc. All rights reserved.