com.iparelan.util
Class ConcurrencyTools

java.lang.Object
  extended by com.iparelan.util.ConcurrencyTools

@Copyright(value="Copyright © 2008, Iparelan Solutions, LLC. All rights reserved.")
public final class ConcurrencyTools
extends Object

This utility class contains concurrency convenience algorithms.

Version:
July 2008
Author:
Greg Mattes

Nested Class Summary
static interface ConcurrencyTools.Shutdownable
          A Shutdownable is an execution resource than can be shutdown for termination.
private static class ConcurrencyTools.ThreadPoolProxyInvocationHandler<T>
          Dispatches proxied method invocations through a thread pool.
private static class ConcurrencyTools.ThreadPoolProxyThreadFactory
          The default thread factory
 
Field Summary
(package private) static Logger LOGGER
           
static String LOGGER_NAME
           
 
Constructor Summary
ConcurrencyTools()
           
 
Method Summary
static
<T> T
newThreadPoolProxy(String poolName, T toProxy)
          Creates a Proxy for toProxy that routes method invocations through a thread pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER_NAME

public static final String LOGGER_NAME
See Also:
Constant Field Values

LOGGER

static final Logger LOGGER
Constructor Detail

ConcurrencyTools

public ConcurrencyTools()
Method Detail

newThreadPoolProxy

public static <T> T newThreadPoolProxy(String poolName,
                                       T toProxy)
Creates a Proxy for toProxy that routes method invocations through a thread pool.

Parameters:
poolName - The name of the thread pool. May not be null.
toProxy - The object for which to create a dynamic proxy. May not be null.
Returns:
A proxy for toProxy. Never null.
Throws:
IllegalArgumentException - Iff a dynamic proxy cannot be created.
To Do:
  • Allow a thread pool (not just a thread pool name) to be injected into this method? Allow sharing of a thread pool among several proxies?
  • For each thread: setUncaughtExceptionHandler(Thread.UncaughtExceptionHandler eh)


Copyright © 2008 Iparelan Solutions, LLC. All rights reserved.