001/*
002 * jPOS Project [http://jpos.org]
003 * Copyright (C) 2000-2026 jPOS Software SRL
004 *
005 * This program is free software: you can redistribute it and/or modify
006 * it under the terms of the GNU Affero General Public License as
007 * published by the Free Software Foundation, either version 3 of the
008 * License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
013 * GNU Affero General Public License for more details.
014 *
015 * You should have received a copy of the GNU Affero General Public License
016 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
017 */
018
019package org.jpos.q2.qbean;
020
021import org.jpos.util.NameRegistrar.NotFoundException;
022
023/**
024 * JMX management interface for the Q2 thread-pool executor QBean.
025 * @author dgrandemange
026 * 
027 */
028public interface QThreadPoolExecutorMBean extends org.jpos.q2.QBeanSupportMBean {
029    /**
030     * Returns the executor service type.
031     * @return executor service type
032     */
033    String getExecSrvType();
034
035    /**
036     * Returns the await-termination delay in milliseconds.
037     * @return await termination delay
038     */
039    int getTerminationTimer();
040
041    /**
042     * Returns the approximate number of threads that are actively executing tasks.
043     * @return approximate number of threads that are actively executing tasks
044     * @throws NotFoundException if the executor cannot be found in the name registrar
045     */
046    int getActiveCount() throws NotFoundException;
047
048    /**
049     * Returns the approximate total number of tasks that have completed execution.
050     * @return the approximate total number of tasks that have completed
051     *         execution.
052     * @throws NotFoundException if the executor cannot be found in the name registrar
053     */
054    long getCompletedTaskCount() throws NotFoundException;
055
056    /**
057     * Returns the core number of threads.
058     * @return returns the core number of threads.
059     * @throws NotFoundException if the executor cannot be found in the name registrar
060     */
061    int getCorePoolSize() throws NotFoundException;
062
063    /**
064     * Returns the thread keep-alive time in milliseconds.
065     * @return the thread keep-alive time, which is the amount of time (in
066     *         milliseconds) which threads in excess of the core pool size may
067     *         remain idle before being terminated
068     * @throws NotFoundException if the executor cannot be found in the name registrar
069     */
070    long getKeepAliveTimeMS() throws NotFoundException;
071
072    /**
073     * Returns the largest number of threads that have ever simultaneously been in the pool.
074     * @return the largest number of threads that have ever simultaneously been
075     *         in the pool.
076     * @throws NotFoundException if the executor cannot be found in the name registrar
077     */
078    int getLargestPoolSize() throws NotFoundException;
079
080    /**
081     * Returns the maximum allowed number of threads.
082     * @return the maximum allowed number of threads.
083     * @throws NotFoundException if the executor cannot be found in the name registrar
084     */
085    int getMaximumPoolSize() throws NotFoundException;
086
087    /**
088     * Returns the current number of threads in the pool.
089     * @return the current number of threads in the pool.
090     * @throws NotFoundException if the executor cannot be found in the name registrar
091     */
092    int getPoolSize() throws NotFoundException;
093
094    /**
095     * Returns the approximate total number of tasks that have been scheduled for execution.
096     * @return the approximate total number of tasks that have been scheduled
097     *         for execution
098     * @throws NotFoundException if the executor cannot be found in the name registrar
099     */
100    long getTaskCount() throws NotFoundException;
101
102    /**
103     * Returns whether this executor has been shut down.
104     * @return true if this executor has been shut down.
105     * @throws NotFoundException if the executor cannot be found in the name registrar
106     */
107    boolean isShutdown() throws NotFoundException;
108
109    /**
110     * Returns whether all tasks have completed following shut down.
111     * @return true if all tasks have completed following shut down
112     * @throws NotFoundException if the executor cannot be found in the name registrar
113     */
114    boolean isTerminated() throws NotFoundException;
115
116    /**
117     * Returns whether this executor is in the process of terminating after shutdown.
118     * @return true if this executor is in the process of terminating after
119     *         shutdown or shutdownNow but has not completely terminated.
120     * @throws NotFoundException if the executor cannot be found in the name registrar
121     */
122    boolean isTerminating() throws NotFoundException;
123}