001 /**
002 * GRANITE DATA SERVICES
003 * Copyright (C) 2006-2013 GRANITE DATA SERVICES S.A.S.
004 *
005 * This file is part of the Granite Data Services Platform.
006 *
007 * Granite Data Services is free software; you can redistribute it and/or
008 * modify it under the terms of the GNU Lesser General Public
009 * License as published by the Free Software Foundation; either
010 * version 2.1 of the License, or (at your option) any later version.
011 *
012 * Granite Data Services is distributed in the hope that it will be useful,
013 * but WITHOUT ANY WARRANTY; without even the implied warranty of
014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser
015 * General Public License for more details.
016 *
017 * You should have received a copy of the GNU Lesser General Public
018 * License along with this library; if not, write to the Free Software
019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
020 * USA, or see <http://www.gnu.org/licenses/>.
021 */
022 package org.granite.gravity;
023
024 import org.granite.jmx.MBean;
025 import org.granite.jmx.MBeanAttribute;
026 import org.granite.jmx.MBeanOperation;
027 import org.granite.jmx.MBeanParameter;
028 import org.granite.jmx.MBeanOperation.Impact;
029
030 /**
031 * @author Franck WOLFF
032 */
033 @MBean(description="MBean used for Gravity operations")
034 public interface DefaultGravityMBean {
035
036 ///////////////////////////////////////////////////////////////////////////
037 // Attributes.
038
039 @MBeanAttribute(description="Factory class name used for intantiating Gravity")
040 public String getGravityFactoryName();
041
042 @MBeanAttribute(description="Amount of time after which an idle channel may be removed")
043 public long getChannelIdleTimeoutMillis();
044 public void setChannelIdleTimeoutMillis(
045 @MBeanParameter(name="channelIdleTimeoutMillis", description="New channel's idle timeout")
046 long channelIdleTimeoutMillis
047 );
048
049 @MBeanAttribute(description="Long polling timeout in milliseconds (may not work with all containers)")
050 public long getLongPollingTimeoutMillis();
051 public void setLongPollingTimeoutMillis(
052 @MBeanParameter(name="longPollingTimeoutMillis", description="New long polling timeout")
053 long longPollingTimeoutMillis
054 );
055
056 @MBeanAttribute(description="Should unsent messages be kept in the queue on IOExceptions?")
057 public boolean isRetryOnError();
058 public void setRetryOnError(
059 @MBeanParameter(name="retryOnError", description="New retry on error value")
060 boolean retryOnError
061 );
062
063 @MBeanAttribute(description="Channel's queue maximum size")
064 public int getMaxMessagesQueuedPerChannel();
065 public void setMaxMessagesQueuedPerChannel(
066 @MBeanParameter(name="maxMessagesQueuedPerChannel", description="New maximum messages queued value")
067 int maxMessagesQueuedPerChannel
068 );
069
070 @MBeanAttribute(description="Client advice for reconnection interval")
071 public long getReconnectIntervalMillis();
072
073 @MBeanAttribute(description="Client advice for reconnection max attempts")
074 public int getReconnectMaxAttempts();
075
076 @MBeanAttribute(description="Maximum number of channels that may be queued in the Gravity pool")
077 public int getQueueCapacity();
078
079 @MBeanAttribute(description=
080 "Number of channels that the Gravity pool queue can ideally (in the absence of " +
081 "memory or resource constraints) accept without blocking")
082 public int getQueueRemainingCapacity();
083
084 @MBeanAttribute(description="Number of channels in the Gravity pool queue waiting for execution")
085 public int getQueueSize();
086
087 @MBeanAttribute(description="Number of threads to keep in the Gravity pool, even if they are idle")
088 public int getCorePoolSize();
089 public void setCorePoolSize(
090 @MBeanParameter(name="corePoolSize", description="New core pool size")
091 int corePoolSize
092 );
093
094 @MBeanAttribute(description="Maximum number of threads to allow in the Gravity pool")
095 public int getMaximumPoolSize();
096 public void setMaximumPoolSize(
097 @MBeanParameter(name="maximumPoolSize", description="New maximum pool size")
098 int maximumPoolSize
099 );
100
101 @MBeanAttribute(description=
102 "When the number of threads is greater than the core, this is the maximum " +
103 "time that excess idle threads will wait for new tasks before terminating")
104 public long getKeepAliveTimeMillis();
105 public void setKeepAliveTimeMillis(
106 @MBeanParameter(name="keepAliveTimeMillis", description="New keep alive time in milliseconds")
107 long keepAliveTimeMillis
108 );
109
110 @MBeanAttribute(description="Tell if this Gravity has been succefully started")
111 public boolean isStarted();
112
113 ///////////////////////////////////////////////////////////////////////////
114 // Operations.
115
116 @MBeanOperation(description="Start Gravity", impact=Impact.ACTION)
117 public void start() throws Exception;
118
119 @MBeanOperation(description="Restart Gravity", impact=Impact.ACTION)
120 public void restart() throws Exception;
121
122 @MBeanOperation(
123 description="Attempts to stop all actively executing channels and halts the processing of waiting channels",
124 impact=Impact.ACTION
125 )
126 public void stop() throws Exception;
127 }