net.gleamynode.netty.handler.execution
Class MemoryAwareThreadPoolExecutor

java.lang.Object
  extended by java.util.concurrent.AbstractExecutorService
      extended by java.util.concurrent.ThreadPoolExecutor
          extended by net.gleamynode.netty.handler.execution.MemoryAwareThreadPoolExecutor
All Implemented Interfaces:
Executor, ExecutorService
Direct Known Subclasses:
OrderedMemoryAwareThreadPoolExecutor

public class MemoryAwareThreadPoolExecutor
extends ThreadPoolExecutor

Version:
$Rev$, $Date$
Author:
The Netty Project (netty@googlegroups.com), Trustin Lee (trustin@gmail.com)

Nested Class Summary
 
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
 
Constructor Summary
MemoryAwareThreadPoolExecutor(int corePoolSize, int maxChannelMemorySize, int maxTotalMemorySize)
           
MemoryAwareThreadPoolExecutor(int corePoolSize, int maxChannelMemorySize, int maxTotalMemorySize, long keepAliveTime, TimeUnit unit)
           
MemoryAwareThreadPoolExecutor(int corePoolSize, int maxChannelMemorySize, int maxTotalMemorySize, long keepAliveTime, TimeUnit unit, ObjectSizeEstimator objectSizeEstimator, ThreadFactory threadFactory)
           
MemoryAwareThreadPoolExecutor(int corePoolSize, int maxChannelMemorySize, int maxTotalMemorySize, long keepAliveTime, TimeUnit unit, ThreadFactory threadFactory)
           
 
Method Summary
protected  void beforeExecute(Thread t, Runnable r)
           
protected  void doExecute(Runnable task)
           
protected  void doUnorderedExecute(Runnable task)
           
 void execute(Runnable command)
           
 int getMaxChannelMemorySize()
           
 int getMaxTotalMemorySize()
           
 ObjectSizeEstimator getObjectSizeEstimator()
           
 boolean remove(Runnable task)
           
 void setMaxChannelMemorySize(int maxChannelMemorySize)
           
 void setMaxTotalMemorySize(int maxTotalMemorySize)
           
 
Methods inherited from class java.util.concurrent.ThreadPoolExecutor
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated
 
Methods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MemoryAwareThreadPoolExecutor

public MemoryAwareThreadPoolExecutor(int corePoolSize,
                                     int maxChannelMemorySize,
                                     int maxTotalMemorySize)

MemoryAwareThreadPoolExecutor

public MemoryAwareThreadPoolExecutor(int corePoolSize,
                                     int maxChannelMemorySize,
                                     int maxTotalMemorySize,
                                     long keepAliveTime,
                                     TimeUnit unit)

MemoryAwareThreadPoolExecutor

public MemoryAwareThreadPoolExecutor(int corePoolSize,
                                     int maxChannelMemorySize,
                                     int maxTotalMemorySize,
                                     long keepAliveTime,
                                     TimeUnit unit,
                                     ThreadFactory threadFactory)

MemoryAwareThreadPoolExecutor

public MemoryAwareThreadPoolExecutor(int corePoolSize,
                                     int maxChannelMemorySize,
                                     int maxTotalMemorySize,
                                     long keepAliveTime,
                                     TimeUnit unit,
                                     ObjectSizeEstimator objectSizeEstimator,
                                     ThreadFactory threadFactory)
Method Detail

getObjectSizeEstimator

public ObjectSizeEstimator getObjectSizeEstimator()

getMaxChannelMemorySize

public int getMaxChannelMemorySize()

setMaxChannelMemorySize

public void setMaxChannelMemorySize(int maxChannelMemorySize)

getMaxTotalMemorySize

public int getMaxTotalMemorySize()

setMaxTotalMemorySize

public void setMaxTotalMemorySize(int maxTotalMemorySize)

execute

public void execute(Runnable command)
Specified by:
execute in interface Executor
Overrides:
execute in class ThreadPoolExecutor

doExecute

protected void doExecute(Runnable task)

doUnorderedExecute

protected final void doUnorderedExecute(Runnable task)

remove

public boolean remove(Runnable task)
Overrides:
remove in class ThreadPoolExecutor

beforeExecute

protected void beforeExecute(Thread t,
                             Runnable r)
Overrides:
beforeExecute in class ThreadPoolExecutor


Copyright © 2008-Present Trustin Heuiseung Lee. All Rights Reserved.