001
014
015 package com.liferay.portal.kernel.executor;
016
017 import com.liferay.portal.kernel.concurrent.RejectedExecutionHandler;
018 import com.liferay.portal.kernel.concurrent.ThreadPoolHandler;
019 import com.liferay.portal.kernel.util.NamedThreadFactory;
020
021 import java.io.Serializable;
022
023 import java.util.concurrent.ThreadFactory;
024 import java.util.concurrent.TimeUnit;
025
026
029 public class PortalExecutorConfig implements Serializable {
030
031 public PortalExecutorConfig(
032 String name, int corePoolSize, int maxPoolSize, long keepAliveTime,
033 TimeUnit timeUnit, boolean allowCoreThreadTimeout, int maxQueueSize,
034 RejectedExecutionHandler rejectedExecutionHandler,
035 ThreadPoolHandler threadPoolHandler, int priority,
036 ClassLoader contextClassLoader) {
037
038 _name = name;
039 _corePoolSize = corePoolSize;
040 _maxPoolSize = maxPoolSize;
041 _keepAliveTime = keepAliveTime;
042 _timeUnit = timeUnit;
043 _allowCoreThreadTimeout = allowCoreThreadTimeout;
044 _maxQueueSize = maxQueueSize;
045 _rejectedExecutionHandler = rejectedExecutionHandler;
046 _threadPoolHandler = threadPoolHandler;
047
048 _threadFactory = new NamedThreadFactory(
049 name, priority, contextClassLoader);
050 }
051
052 public int getCorePoolSize() {
053 return _corePoolSize;
054 }
055
056 public long getKeepAliveTime() {
057 return _keepAliveTime;
058 }
059
060 public int getMaxPoolSize() {
061 return _maxPoolSize;
062 }
063
064 public int getMaxQueueSize() {
065 return _maxQueueSize;
066 }
067
068 public String getName() {
069 return _name;
070 }
071
072 public RejectedExecutionHandler getRejectedExecutionHandler() {
073 return _rejectedExecutionHandler;
074 }
075
076 public ThreadFactory getThreadFactory() {
077 return _threadFactory;
078 }
079
080 public ThreadPoolHandler getThreadPoolHandler() {
081 return _threadPoolHandler;
082 }
083
084 public TimeUnit getTimeUnit() {
085 return _timeUnit;
086 }
087
088 public boolean isAllowCoreThreadTimeout() {
089 return _allowCoreThreadTimeout;
090 }
091
092 private static final long serialVersionUID = 1L;
093
094 private final boolean _allowCoreThreadTimeout;
095 private final int _corePoolSize;
096 private final long _keepAliveTime;
097 private final int _maxPoolSize;
098 private final int _maxQueueSize;
099 private final String _name;
100 private final RejectedExecutionHandler _rejectedExecutionHandler;
101 private final ThreadFactory _threadFactory;
102 private final ThreadPoolHandler _threadPoolHandler;
103 private final TimeUnit _timeUnit;
104
105 }