jcommon.graph
Interface ITopologicalSortAsyncResult


public interface ITopologicalSortAsyncResult

Returned by an asynchronous sort call. Used to know or await for notification of asynchronous processing completion.


Method Summary
 boolean await()
          Provided for conveniency.
 boolean await(long timeout, TimeUnit unit)
          Provided for conveniency.
 boolean awaitUninterruptibly()
          Provided for conveniency.
 boolean awaitUninterruptibly(long timeout, TimeUnit unit)
          Provided for conveniency.
 boolean discontinueScheduling()
          Discontinues further scheduling of additional vertices for processing.
 ExecutorService getExecutorService()
          Provides a reference to the ExecutorService that asynchronous processing was called with.
 boolean isDone()
          Determines if all processing of vertices has completed.
 boolean isProcessingDiscontinued()
          Determines if discontinueScheduling() has been called previously.
 boolean isSuccessful()
          Determines if all vertices have been processed without incident.
 boolean waitForCompletion()
          Waits indefinitely and uninterruptibly for the asynchronous sort to signal that it's done processing.
 boolean waitForCompletion(long timeout, TimeUnit unit)
          Waits indefinitely and uninterruptibly for the asynchronous sort to signal that it's done processing.
 

Method Detail

isDone

boolean isDone()
Determines if all processing of vertices has completed.

Returns:
True if all processing of vertices has completed, otherwise false.

isSuccessful

boolean isSuccessful()
Determines if all vertices have been processed without incident. Should be called only after waitForCompletion(), await(), or awaitUninterruptibly() have returned. Calling waitForCompletion() will return this same value after all vertices have been processed. It's suggested you use waitForCompletion().

Returns:
True if all vertices were processed without incident, otherwise false.

isProcessingDiscontinued

boolean isProcessingDiscontinued()
Determines if discontinueScheduling() has been called previously.

Returns:
True if discontinueScheduling() has been called previously, otherwise false.

getExecutorService

ExecutorService getExecutorService()
Provides a reference to the ExecutorService that asynchronous processing was called with.

Returns:
A reference to an ExecutorService instance.

discontinueScheduling

boolean discontinueScheduling()
Discontinues further scheduling of additional vertices for processing. It's highly suggested that you do not shutdown or abort the getExecutorService() instance. Instead, call this method and then waitForCompletion() which will allow all previously submitted vertices to drain.

Returns:
True if the operation was successful, otherwise false.

waitForCompletion

boolean waitForCompletion()
Waits indefinitely and uninterruptibly for the asynchronous sort to signal that it's done processing.

Returns:
True if the sorting completed successfully. False if a callback threw an exception or a cycle was detected.

waitForCompletion

boolean waitForCompletion(long timeout,
                          TimeUnit unit)
Waits indefinitely and uninterruptibly for the asynchronous sort to signal that it's done processing.

Parameters:
timeout - Length of time in TimeUnit units to wait for completion.
unit - TimeUnit unit of time represented by the timeout.
Returns:
True if the sorting completed successfully. False if a callback threw an exception or a cycle was detected.

awaitUninterruptibly

boolean awaitUninterruptibly()
Provided for conveniency. Waits indefinitely and uninterruptibly for the asynchronous sort to signal that it's done processing. It's suggested you use waitForCompletion().

Returns:
True if processing completed. This is not an indicator of successful completion. Please use isSuccessful() or simply call waitForCompletion() instead.

awaitUninterruptibly

boolean awaitUninterruptibly(long timeout,
                             TimeUnit unit)
Provided for conveniency. Waits indefinitely and uninterruptibly for the asynchronous sort to signal that it's done processing. It's suggested you use waitForCompletion().

Parameters:
timeout - Length of time in TimeUnit units to wait for completion.
unit - TimeUnit unit of time represented by the timeout.
Returns:
True if processing completed. This is not an indicator of successful completion. Please use isSuccessful() or simply call waitForCompletion() instead.

await

boolean await()
              throws InterruptedException
Provided for conveniency. Waits indefinitely (but can be interrupted) for the asynchronous sort to signal that it's done processing. It's suggested you use waitForCompletion().

Returns:
True if processing completed. This is not an indicator of successful completion. Please use isSuccessful() or simply call waitForCompletion() instead.
Throws:
InterruptedException

await

boolean await(long timeout,
              TimeUnit unit)
              throws InterruptedException
Provided for conveniency. Waits indefinitely (but can be interrupted) for the asynchronous sort to signal that it's done processing. It's suggested you use waitForCompletion().

Parameters:
timeout - Length of time in TimeUnit units to wait for completion.
unit - TimeUnit unit of time represented by the timeout.
Returns:
True if processing completed. This is not an indicator of successful completion. Please use isSuccessful() or simply call waitForCompletion() instead.
Throws:
InterruptedException


Copyright © 2012-2013. All Rights Reserved.