org.ldaptive.concurrent
Class AbstractOperationWorker<Q extends Request,S>

java.lang.Object
  extended by org.ldaptive.concurrent.AbstractOperationWorker<Q,S>
Type Parameters:
Q - type of ldap request
S - type of ldap response
All Implemented Interfaces:
OperationWorker<Q,S>
Direct Known Subclasses:
AddOperationWorker, BindOperationWorker, CompareOperationWorker, DeleteOperationWorker, ModifyDnOperationWorker, ModifyOperationWorker, SearchOperationWorker

public abstract class AbstractOperationWorker<Q extends Request,S>
extends Object
implements OperationWorker<Q,S>

Base class for worker operations. If no ExecutorService is provided a cached thread pool is used by default.

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services

Field Summary
protected  org.slf4j.Logger logger
          Logger for this class.
 
Constructor Summary
AbstractOperationWorker(Operation<Q,S> op)
          Creates a new abstract operation worker.
AbstractOperationWorker(Operation<Q,S> op, ExecutorService es)
          Creates a new abstract operation worker.
 
Method Summary
static
<Q extends Request,S>
Callable<Response<S>>
createCallable(Operation<Q,S> operation, Q request)
          Returns a Callable that executes the supplied request with the supplied operation.
 Collection<Future<Response<S>>> execute(Q... requests)
          Execute an ldap operation for each request on a separate thread.
 Future<Response<S>> execute(Q request)
          Execute an ldap operation on a separate thread.
 Collection<Response<S>> executeToCompletion(Q... requests)
          Execute an ldap operation for each request on a separate thread and waits for all operations to complete.
protected  void finalize()
          
 void shutdown()
          Invokes ExecutorService.shutdown() on the underlying executor service.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.slf4j.Logger logger
Logger for this class.

Constructor Detail

AbstractOperationWorker

public AbstractOperationWorker(Operation<Q,S> op)
Creates a new abstract operation worker.

Parameters:
op - operation

AbstractOperationWorker

public AbstractOperationWorker(Operation<Q,S> op,
                               ExecutorService es)
Creates a new abstract operation worker.

Parameters:
op - operation
es - executor service
Method Detail

execute

public Future<Response<S>> execute(Q request)
Execute an ldap operation on a separate thread.

Specified by:
execute in interface OperationWorker<Q extends Request,S>
Parameters:
request - containing the data required by this operation
Returns:
future response for this operation

execute

public Collection<Future<Response<S>>> execute(Q... requests)
Execute an ldap operation for each request on a separate thread.

Specified by:
execute in interface OperationWorker<Q extends Request,S>
Parameters:
requests - containing the data required by this operation
Returns:
future responses for this operation

executeToCompletion

public Collection<Response<S>> executeToCompletion(Q... requests)
Execute an ldap operation for each request on a separate thread and waits for all operations to complete.

Specified by:
executeToCompletion in interface OperationWorker<Q extends Request,S>
Parameters:
requests - containing the data required by this operation
Returns:
responses for this operation

createCallable

public static <Q extends Request,S> Callable<Response<S>> createCallable(Operation<Q,S> operation,
                                                                         Q request)
Returns a Callable that executes the supplied request with the supplied operation.

Type Parameters:
Q - type of ldap request
S - type of ldap response
Parameters:
operation - to execute
request - to pass to the operation
Returns:
callable for the supplied operation and request

shutdown

public void shutdown()
Invokes ExecutorService.shutdown() on the underlying executor service.


finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2003-2017 Virginia Tech. All Rights Reserved.