org.atmosphere.wasync.util
Class FutureProxy<T extends java.util.concurrent.Future>

java.lang.Object
  extended by org.atmosphere.wasync.util.FutureProxy<T>
All Implemented Interfaces:
java.util.concurrent.Future<Socket>

public class FutureProxy<T extends java.util.concurrent.Future>
extends java.lang.Object
implements Future


Constructor Summary
FutureProxy(Socket socket, T proxyiedFuture)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
           
 void close()
          Close the underlying Socket
 void done()
          Mark this instance as done.
 Future finishOrThrowException()
          Mark the future done.
 Future fire(java.lang.Object data)
          Send data to the remote Server.
 Socket get()
           
 Socket get(long timeout, java.util.concurrent.TimeUnit unit)
           
 Future ioException(java.io.IOException t)
          If an exception occurs, the Transport will set it using this method.
 boolean isCancelled()
           
 boolean isDone()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FutureProxy

public FutureProxy(Socket socket,
                   T proxyiedFuture)
Method Detail

fire

public Future fire(java.lang.Object data)
            throws java.io.IOException
Description copied from interface: Future
Send data to the remote Server.

Parameters:
data - the message to fire
Returns:
a Future
Throws:
java.io.IOException

finishOrThrowException

public Future finishOrThrowException()
                              throws java.io.IOException
Description copied from interface: Future
Mark the future done. If an exception occurred, this method will throw it.

Returns:
a Future
Throws:
java.io.IOException

ioException

public Future ioException(java.io.IOException t)
Description copied from interface: Future
If an exception occurs, the Transport will set it using this method. An application can also use that method to interrupt a blocking Socket.open(Request) operation. This operation must unlock the current blocked thread.

Parameters:
t - a IOException
Returns:
a Future

done

public void done()
Description copied from interface: Future
Mark this instance as done.


cancel

public boolean cancel(boolean mayInterruptIfRunning)
Specified by:
cancel in interface java.util.concurrent.Future<Socket>

isCancelled

public boolean isCancelled()
Specified by:
isCancelled in interface java.util.concurrent.Future<Socket>

isDone

public boolean isDone()
Specified by:
isDone in interface java.util.concurrent.Future<Socket>

get

public Socket get()
           throws java.lang.InterruptedException,
                  java.util.concurrent.ExecutionException
Specified by:
get in interface java.util.concurrent.Future<Socket>
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException

get

public Socket get(long timeout,
                  java.util.concurrent.TimeUnit unit)
           throws java.lang.InterruptedException,
                  java.util.concurrent.ExecutionException,
                  java.util.concurrent.TimeoutException
Specified by:
get in interface java.util.concurrent.Future<Socket>
Throws:
java.lang.InterruptedException
java.util.concurrent.ExecutionException
java.util.concurrent.TimeoutException

close

public void close()
Description copied from interface: Future
Close the underlying Socket



Copyright © 2014. All Rights Reserved.