org.atmosphere.wasync.impl
Class DefaultFuture

java.lang.Object
  extended by org.atmosphere.wasync.impl.DefaultFuture
All Implemented Interfaces:
Future<Socket>

public class DefaultFuture
extends Object
implements Future

The default Future used by the library, based on the CountDownLatch

Author:
Jeanfrancois Arcand

Constructor Summary
DefaultFuture(DefaultSocket socket)
           
 
Method Summary
 boolean cancel(boolean mayInterruptIfRunning)
          
 Future done()
          Mark the future done.
 Future fire(Object data)
          Send data to the remote Server.
 Socket get()
          
 Socket get(long timeout, TimeUnit unit)
          
 boolean isCancelled()
          
 boolean isDone()
          
protected  void reset()
           
protected  Socket socket()
           
 long time()
           
 DefaultFuture timeoutException(TimeoutException te)
           
 TimeUnit timeUnit()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultFuture

public DefaultFuture(DefaultSocket socket)
Method Detail

time

public long time()

timeUnit

public TimeUnit timeUnit()

timeoutException

public DefaultFuture timeoutException(TimeoutException te)

cancel

public boolean cancel(boolean mayInterruptIfRunning)

Specified by:
cancel in interface Future<Socket>

isCancelled

public boolean isCancelled()

Specified by:
isCancelled in interface Future<Socket>

isDone

public boolean isDone()

Specified by:
isDone in interface Future<Socket>

done

public Future done()
Mark the future done.

Returns:
a Future

reset

protected void reset()

get

public Socket get()
           throws InterruptedException,
                  ExecutionException

Specified by:
get in interface Future<Socket>
Throws:
InterruptedException
ExecutionException

get

public Socket get(long timeout,
                  TimeUnit unit)
           throws InterruptedException,
                  ExecutionException,
                  TimeoutException

Specified by:
get in interface Future<Socket>
Throws:
InterruptedException
ExecutionException
TimeoutException

socket

protected Socket socket()

fire

public Future fire(Object data)
            throws IOException
Send data to the remote Server.

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


Copyright © 2013. All Rights Reserved.