View Javadoc

1   package org.apache.jcs.utils.threadpool.behavior;
2   
3   /*
4    * Licensed to the Apache Software Foundation (ASF) under one
5    * or more contributor license agreements.  See the NOTICE file
6    * distributed with this work for additional information
7    * regarding copyright ownership.  The ASF licenses this file
8    * to you under the Apache License, Version 2.0 (the
9    * "License"); you may not use this file except in compliance
10   * with the License.  You may obtain a copy of the License at
11   *
12   *   http://www.apache.org/licenses/LICENSE-2.0
13   *
14   * Unless required by applicable law or agreed to in writing,
15   * software distributed under the License is distributed on an
16   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17   * KIND, either express or implied.  See the License for the
18   * specific language governing permissions and limitations
19   * under the License.
20   */
21  
22  /***
23   * This provides values to use for the when-blocked-policy.
24   * <p>
25   * @author aaronsm
26   */
27  public interface IPoolConfiguration
28  {
29      /*** abort when queue is full and max threads is reached. */
30      public static final String POLICY_ABORT = "ABORT";
31  
32      /*** block when queue is full and max threads is reached. */
33      public static final String POLICY_BLOCK = "BLOCK";
34  
35      /*** run in current thread when queue is full and max threads is reached. */
36      public static final String POLICY_RUN = "RUN";
37  
38      /*** wait when queue is full and max threads is reached. */
39      public static final String POLICY_WAIT = "WAIT";
40  
41      /*** discard oldest when queue is full and max threads is reached. */
42      public static final String POLICY_DISCARDOLDEST = "DISCARDOLDEST";
43  
44      /***
45       * @param useBoundary
46       *            The useBoundary to set.
47       */
48      public abstract void setUseBoundary( boolean useBoundary );
49  
50      /***
51       * @return Returns the useBoundary.
52       */
53      public abstract boolean isUseBoundary();
54  
55      /***
56       * @param boundarySize
57       *            The boundarySize to set.
58       */
59      public abstract void setBoundarySize( int boundarySize );
60  
61      /***
62       * @return Returns the boundarySize.
63       */
64      public abstract int getBoundarySize();
65  
66      /***
67       * @param maximumPoolSize
68       *            The maximumPoolSize to set.
69       */
70      public abstract void setMaximumPoolSize( int maximumPoolSize );
71  
72      /***
73       * @return Returns the maximumPoolSize.
74       */
75      public abstract int getMaximumPoolSize();
76  
77      /***
78       * @param minimumPoolSize
79       *            The minimumPoolSize to set.
80       */
81      public abstract void setMinimumPoolSize( int minimumPoolSize );
82  
83      /***
84       * @return Returns the minimumPoolSize.
85       */
86      public abstract int getMinimumPoolSize();
87  
88      /***
89       * @param keepAliveTime
90       *            The keepAliveTime to set.
91       */
92      public abstract void setKeepAliveTime( int keepAliveTime );
93  
94      /***
95       * @return Returns the keepAliveTime.
96       */
97      public abstract int getKeepAliveTime();
98  
99      /***
100      * should be ABORT, BLOCK, RUN, WAIT, DISCARDOLDEST.
101      * <p>
102      * If an incorrect value is returned, RUN will be used.
103      * <p>
104      * @param whenBlockedPolicy
105      *            The whenBlockedPolicy to set.
106      */
107     public abstract void setWhenBlockedPolicy( String whenBlockedPolicy );
108 
109     /***
110      * @return Returns the whenBlockedPolicy.
111      */
112     public abstract String getWhenBlockedPolicy();
113 
114     /***
115      * @param startUpSize
116      *            The startUpSize to set.
117      */
118     public abstract void setStartUpSize( int startUpSize );
119 
120     /***
121      * @return Returns the startUpSize.
122      */
123     public abstract int getStartUpSize();
124 }