net.tomp2p.futures
Class FutureAsyncTask

java.lang.Object
  extended by net.tomp2p.futures.BaseFutureImpl<FutureAsyncTask>
      extended by net.tomp2p.futures.FutureAsyncTask
All Implemented Interfaces:
BaseFuture, Cancellable

public class FutureAsyncTask
extends BaseFutureImpl<FutureAsyncTask>

A future to keep track of a future task. The task is submitted using an RPC, then a scheduled task keeps polling the peer if the peer is still alive. If the peer dies, this future is notified. If the remote peer finishes the task, the remote peer sends an RPC to the initiating peer that the task is finished.

Author:
Thomas Bocek

Nested Class Summary
 
Nested classes/interfaces inherited from interface net.tomp2p.futures.BaseFuture
BaseFuture.FutureType
 
Field Summary
 
Fields inherited from class net.tomp2p.futures.BaseFutureImpl
completed, lock, reason, type
 
Constructor Summary
FutureAsyncTask(PeerAddress remotePeer)
          Constructor
 
Method Summary
 Map<Number160,Data> getDataMap()
           
 PeerAddress getRemotePeer()
           
 void setDataMap(Map<Number160,Data> dataMap)
          Finishes the future and notifies listeners.
 
Methods inherited from class net.tomp2p.futures.BaseFutureImpl
addCancellation, addListener, addListener, await, await, awaitListeners, awaitUninterruptibly, awaitUninterruptibly, cancel, getFailedReason, getType, isCompleted, isFailed, isSuccess, notifyListerenrs, removeListener, self, setCompletedAndNotify, setFailed, setFailed, setFailed, setFailed, setFailed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FutureAsyncTask

public FutureAsyncTask(PeerAddress remotePeer)
Constructor

Parameters:
remotePeer - The address of the peer that processes the task
Method Detail

setDataMap

public void setDataMap(Map<Number160,Data> dataMap)
Finishes the future and notifies listeners.

Parameters:
dataMap - The result from the remote peer

getDataMap

public Map<Number160,Data> getDataMap()
Returns:
The result of the remote peer from the task.

getRemotePeer

public PeerAddress getRemotePeer()
Returns:
The address of the peer that processes the task


Copyright © 2013. All Rights Reserved.