mandala.rami.impl
Class ThreadPooledPolicy

java.lang.Object
  extended bymandala.rami.impl.ThreadPooledPolicy
All Implemented Interfaces:
AsynchronousPolicy, ConcurrentSemantic, java.io.Serializable

public class ThreadPooledPolicy
extends java.lang.Object
implements AsynchronousPolicy, ConcurrentSemantic, java.io.Serializable

Concurrent, thredpooled implementation of the AsynchronousPolicy interface.

This implementation uses the MethodInvoker for its method invocation implementation and the ThreadPool utility for better performance.

Version:
1.0
Author:
eipi
See Also:
ConcurrentSemantic, AsynchronousPolicy, MethodInvoker, ThreadPool, Serialized Form

Field Summary
protected  ThreadPool threadPool
          The thread pool used.
 
Constructor Summary
ThreadPooledPolicy()
          Creates a new ThreadPooledPolicy instance using the default thread pool.
ThreadPooledPolicy(ThreadPool threadPool)
          Creates a new ThreadPooledPolicy instance with a specified thread pool.
 
Method Summary
 Cancelable call(java.lang.Object object, FutureServer futureServer)
          Asynchronous implementation of a method invocation.
static ThreadPool getDefaultThreadPool()
          Returns the default thread pool used if non is given when instanciating this class.
 ThreadPool getThreadPool()
          Returns the thread pool used by this instance.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

threadPool

protected transient ThreadPool threadPool

The thread pool used.

Constructor Detail

ThreadPooledPolicy

public ThreadPooledPolicy()

Creates a new ThreadPooledPolicy instance using the default thread pool.

See Also:
getDefaultThreadPool()

ThreadPooledPolicy

public ThreadPooledPolicy(ThreadPool threadPool)

Creates a new ThreadPooledPolicy instance with a specified thread pool.

If the given thread pool has not been started, it is started.

Parameters:
threadPool - the thread pool to use.
See Also:
ThreadPool, ThreadPool.start(), ThreadPool.isStarted()
Method Detail

getDefaultThreadPool

public static ThreadPool getDefaultThreadPool()

Returns the default thread pool used if non is given when instanciating this class.

Returns:
the default thread pool.
See Also:
ThreadPool

call

public Cancelable call(java.lang.Object object,
                       FutureServer futureServer)

Asynchronous implementation of a method invocation.

This implementation uses the ThreadPool and the MethodInvoker class.

Specified by:
call in interface AsynchronousPolicy
Parameters:
object - the object on which the method is to be invoked.
futureServer - a FutureServer value
Returns:
the cancelable object to use to cancel the invocation.
See Also:
MethodInvoker, FutureServer, ThreadPool

getThreadPool

public ThreadPool getThreadPool()

Returns the thread pool used by this instance.

Returns:
a ThreadPool value
See Also:
ThreadPool

toString

public java.lang.String toString()


Mandala help mailing list