Search in sources :

Example 1 with EzyFutureTask

use of com.tvd12.ezyfox.concurrent.EzyFutureTask in project ezyhttp by youngmonkeys.

the class ResourceDownloadManager method drain.

public void drain(InputStream from, OutputStream to) throws Exception {
    Entry entry = new Entry(from, to);
    EzyFuture future = new EzyFutureTask();
    drain(entry, future);
    future.get(DEFAULT_TIMEOUT);
}
Also used : EzyFutureTask(com.tvd12.ezyfox.concurrent.EzyFutureTask) EzyFuture(com.tvd12.ezyfox.concurrent.EzyFuture)

Example 2 with EzyFutureTask

use of com.tvd12.ezyfox.concurrent.EzyFutureTask in project ezyhttp by youngmonkeys.

the class HttpClientProxy method request.

public ResponseEntity request(Request request, int timeout) throws Exception {
    EzyFuture future = new EzyFutureTask();
    futures.addFuture(request, future);
    try {
        addRequest(request);
    } catch (Exception e) {
        futures.removeFuture(request);
        throw e;
    }
    return future.get(timeout);
}
Also used : EzyFutureTask(com.tvd12.ezyfox.concurrent.EzyFutureTask) EzyFuture(com.tvd12.ezyfox.concurrent.EzyFuture) EzyProcessor.processWithException(com.tvd12.ezyfox.util.EzyProcessor.processWithException) RequestQueueFullException(com.tvd12.ezyhttp.client.exception.RequestQueueFullException) IOException(java.io.IOException) ClientNotActiveException(com.tvd12.ezyhttp.client.exception.ClientNotActiveException)

Aggregations

EzyFuture (com.tvd12.ezyfox.concurrent.EzyFuture)2 EzyFutureTask (com.tvd12.ezyfox.concurrent.EzyFutureTask)2 EzyProcessor.processWithException (com.tvd12.ezyfox.util.EzyProcessor.processWithException)1 ClientNotActiveException (com.tvd12.ezyhttp.client.exception.ClientNotActiveException)1 RequestQueueFullException (com.tvd12.ezyhttp.client.exception.RequestQueueFullException)1 IOException (java.io.IOException)1