KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > util > threadpool > BasicThreadPoolMBean


1 /*
2   * JBoss, Home of Professional Open Source
3   * Copyright 2005, JBoss Inc., and individual contributors as indicated
4   * by the @authors tag. See the copyright.txt in the distribution for a
5   * full listing of individual contributors.
6   *
7   * This is free software; you can redistribute it and/or modify it
8   * under the terms of the GNU Lesser General Public License as
9   * published by the Free Software Foundation; either version 2.1 of
10   * the License, or (at your option) any later version.
11   *
12   * This software is distributed in the hope that it will be useful,
13   * but WITHOUT ANY WARRANTY; without even the implied warranty of
14   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15   * Lesser General Public License for more details.
16   *
17   * You should have received a copy of the GNU Lesser General Public
18   * License along with this software; if not, write to the Free
19   * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20   * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21   */

22 package org.jboss.util.threadpool;
23
24 /**
25  * Management interface for the thread pool.
26  *
27  * @author <a HREF="mailto:adrian@jboss.org">Adrian Brock</a>
28  * @version $Revision: 1958 $
29  */

30 public interface BasicThreadPoolMBean extends ThreadPoolMBean
31 {
32    // Constants -----------------------------------------------------
33

34    // Public --------------------------------------------------------
35

36    /**
37     * Get the current queue size
38    *
39     * @return the queue size
40     */

41    int getQueueSize();
42
43    /**
44     * Get the maximum queue size
45     *
46     * @return the maximum queue size
47     */

48    int getMaximumQueueSize();
49
50    /**
51     * Set the maximum queue size
52     *
53     * @param size the new maximum queue size
54     */

55    void setMaximumQueueSize(int size);
56
57    /**
58     * @return the blocking mode
59     */

60    BlockingMode getBlockingMode();
61    
62    /** Set the behavior of the pool when a task is added and the queue is full.
63     * The mode string indicates one of the following modes:
64     * abort - a RuntimeException is thrown
65     * run - the calling thread executes the task
66     * wait - the calling thread blocks until the queue has room
67     * discard - the task is silently discarded without being run
68     * discardOldest - check to see if a task is about to complete and enque
69     * the new task if possible, else run the task in the calling thread
70     *
71     * @param mode one of run, wait, discard, discardOldest or abort without
72     * regard to case.
73     */

74    void setBlockingMode(BlockingMode mode);
75
76    /**
77     * Retrieve the thread group name
78     *
79     * @return the thread group name
80     */

81    String JavaDoc getThreadGroupName();
82
83    /**
84     * Set the thread group name
85     *
86     * @param threadGroupName - the thread group name
87     */

88    void setThreadGroupName(String JavaDoc threadGroupName);
89
90    /**
91     * Get the keep alive time
92     *
93     * @return the keep alive time
94     */

95    long getKeepAliveTime();
96
97    /**
98     * Set the keep alive time
99     *
100     * @param time the keep alive time
101     */

102    void setKeepAliveTime(long time);
103
104    // Inner classes -------------------------------------------------
105
}
106
Popular Tags