001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.servicemix.executors.impl;
018    
019    /**
020     * This bean holds configuration attributes for a given Executor.
021     * 
022     * @author <a href="mailto:gnodet [at] gmail.com">Guillaume Nodet</a>
023     */
024    public class ExecutorConfig {
025    
026        private int corePoolSize = 4;
027    
028        private int maximumPoolSize = -1;
029    
030        private long keepAliveTime = 60000;
031    
032        private boolean threadDaemon;
033    
034        private int threadPriority = Thread.NORM_PRIORITY;
035    
036        private int queueSize = 1024;
037    
038        private long shutdownDelay = 1000;
039    
040        private boolean allowCoreThreadsTimeout = true;
041    
042        /**
043         * @return the corePoolSize
044         */
045        public int getCorePoolSize() {
046            return corePoolSize;
047        }
048    
049        /**
050         * @param corePoolSize
051         *            the corePoolSize to set
052         */
053        public void setCorePoolSize(int corePoolSize) {
054            this.corePoolSize = corePoolSize;
055        }
056    
057        /**
058         * @return the keepAlive
059         */
060        public long getKeepAliveTime() {
061            return keepAliveTime;
062        }
063    
064        /**
065         * @param keepAlive
066         *            the keepAlive to set
067         */
068        public void setKeepAliveTime(long keepAlive) {
069            this.keepAliveTime = keepAlive;
070        }
071    
072        /**
073         * @return the maximumPoolSize
074         */
075        public int getMaximumPoolSize() {
076            return maximumPoolSize;
077        }
078    
079        /**
080         * @param maximumPoolSize
081         *            the maximumPoolSize to set
082         */
083        public void setMaximumPoolSize(int maximumPoolSize) {
084            this.maximumPoolSize = maximumPoolSize;
085        }
086    
087        /**
088         * @return the queueSize
089         */
090        public int getQueueSize() {
091            return queueSize;
092        }
093    
094        /**
095         * @param queueSize
096         *            the queueSize to set
097         */
098        public void setQueueSize(int queueSize) {
099            this.queueSize = queueSize;
100        }
101    
102        /**
103         * @return the threadDaemon
104         */
105        public boolean isThreadDaemon() {
106            return threadDaemon;
107        }
108    
109        /**
110         * @param threadDaemon
111         *            the threadDaemon to set
112         */
113        public void setThreadDaemon(boolean threadDaemon) {
114            this.threadDaemon = threadDaemon;
115        }
116    
117        /**
118         * @return the threadPriority
119         */
120        public int getThreadPriority() {
121            return threadPriority;
122        }
123    
124        /**
125         * @param threadPriority
126         *            the threadPriority to set
127         */
128        public void setThreadPriority(int threadPriority) {
129            this.threadPriority = threadPriority;
130        }
131    
132        /**
133         * @return the shutdownDelay
134         */
135        public long getShutdownDelay() {
136            return shutdownDelay;
137        }
138    
139        /**
140         * @param shutdownDelay
141         *            the shutdownDelay to set
142         */
143        public void setShutdownDelay(long shutdownDelay) {
144            this.shutdownDelay = shutdownDelay;
145        }
146    
147        /**
148         * @return the allowCoreThreadsTimeout
149         */
150        public boolean isAllowCoreThreadsTimeout() {
151            return allowCoreThreadsTimeout;
152        }
153    
154        /**
155         * @param allowCoreThreadsTimeout
156         *            the allowCoreThreadsTimeout to set
157         */
158        public void setAllowCoreThreadsTimeout(boolean allowCoreThreadsTimeout) {
159            this.allowCoreThreadsTimeout = allowCoreThreadsTimeout;
160        }
161    
162    }