001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software 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
015: * Lesser 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 software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.ha.framework.server;
023:
024: import java.net.InetAddress;
025: import java.util.Vector;
026:
027: import javax.management.ObjectName;
028:
029: import org.jboss.ha.framework.interfaces.HAPartition;
030: import org.jboss.mx.util.ObjectNameFactory;
031: import org.jgroups.jmx.JChannelFactoryMBean;
032: import org.w3c.dom.Element;
033:
034: /**
035: * Management Bean for Cluster HAPartitions. It will start a JGroups
036: * channel and initialize the ReplicantManager and DistributedStateService.
037: *
038: * @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>.
039: * @author <a href="mailto:sacha.labourey@cogito-info.ch">Sacha Labourey</a>.
040: * @version $Revision: 60110 $
041: *
042: * <p><b>Revisions:</b><br>
043: */
044:
045: public interface ClusterPartitionMBean extends
046: org.jboss.system.ServiceMBean {
047: ObjectName OBJECT_NAME = ObjectNameFactory
048: .create("jboss:service=ClusterPartition");
049:
050: /**
051: * Name of the partition being built. All nodes/services belonging to
052: * a partition with the same name are clustered together.
053: */
054: String getPartitionName();
055:
056: void setPartitionName(String newName);
057:
058: /**
059: * Get JGroups property string a la JDBC
060: * see <a href="http://www.jgroups.com/">JGroups web site for more information</a>
061: *
062: * @return the protocol stack used by this ClusterPartition, or <code>null</code>
063: * if the {@link #setMultiplexer(JChannelFactoryMBean) multiplexer} is
064: * configured but the channel has not been created yet.
065: */
066: String getPartitionProperties(); // i.e. JGroups properties
067:
068: void setPartitionProperties(String newProps);
069:
070: /** A write-only attribute that allows for an xml specification of the
071: *PartitionProperties string. For example, a string like:
072: UDP(mcast_addr=228.1.2.3):PING(timeout=2000):MERGE2(min_interval=5000;max_interval=10000):FD"
073: * would be specified in xml as:
074: <JGProps>
075: <UDP mcast_addr="228.1.2.3" />
076: <PING timeout="2000" />
077: <MERGE2 min_interval="5000" max_interval="10000" />
078: <FD />
079: </JGProps>
080: * <p/>
081: * Ignored if the {@link #setMultiplexer(JChannelFactoryMBean) multiplexer} is
082: * used.
083: */
084: void setPartitionConfig(Element config);
085:
086: /**
087: * Uniquely identifies this node. MUST be unique accros the whole cluster!
088: * Cannot be changed once the partition has been started (otherwise an exception is thrown)
089: */
090: String getNodeName();
091:
092: void setNodeName(String node) throws Exception;
093:
094: /**
095: * The node address used to generate the node name
096: */
097: InetAddress getNodeAddress();
098:
099: void setNodeAddress(InetAddress address);
100:
101: /** The version of JGroups this is running on */
102: String getJGroupsVersion();
103:
104: /* Number of milliseconds to wait until state has been transferred. Increase this value for large states
105: 0 = wait forever */
106: long getStateTransferTimeout();
107:
108: void setStateTransferTimeout(long timeout);
109:
110: /** Max time (in ms) to wait for <em>synchronous</em> group method calls
111: * ({@link HAPartition#callMethodOnCluster(String, String, Object[], Class[], boolean)}) */
112: long getMethodCallTimeout();
113:
114: void setMethodCallTimeout(long timeout);
115:
116: /**
117: * Gets the multiplexer channel factory that should be used to
118: * create the JGroups channel.
119: *
120: * @return the multiplexed channel factory, or <code>null</code> if
121: * one isn't configured
122: */
123: JChannelFactoryMBean getMultiplexer();
124:
125: /**
126: * Sets the multiplexer channel factory that should be used to
127: * create the JGroups channel. If this and a
128: * {@link #setMultiplexerStack() multiplexer stack name} are set,
129: * the channel will come from the multiplexer and properties
130: * {@link #setPartitionConfig(Element) partitionConfig} and
131: * {@link #setPartitionProperties(String) partitionProperties} will be
132: * ingored.
133: */
134: void setMultiplexer(JChannelFactoryMBean muxFactory);
135:
136: /**
137: * Gets the name of the protocol stack the multiplexer channel factory
138: * should use to create the JGroups channel.
139: *
140: * @return the stack name, or <code>null</code>
141: */
142: String getMultiplexerStack();
143:
144: /**
145: * Sets the name of the protocol stack the multiplexer channel factory
146: * should use to create the JGroups channel. If this and a
147: * {@link #setMultiplexer() multiplexed channel factory} are set,
148: * the channel will come from the multiplexer and properties
149: * {@link #setPartitionConfig(Element) partitionConfig} and
150: * {@link #setPartitionProperties(String) partitionProperties} will be
151: * ingored.
152: *
153: * @param stackName the name of one of the protocols stacks included
154: * in the multiplexed channel factor's configuration
155: */
156: void setMultiplexerStack(String stackName);
157:
158: // boolean getChannelDebugger();
159: // void setChannelDebugger(boolean flag);
160:
161: /**
162: * Determine if deadlock detection is enabled
163: */
164: boolean getDeadlockDetection();
165:
166: void setDeadlockDetection(boolean doit);
167:
168: /**
169: * Returns whether this partition will synchronously notify any
170: * HAPartition.HAMembershipListener of membership changes using the
171: * calling thread from the underlying group communications layer
172: * (e.g. JGroups).
173: *
174: * @return <code>true</code> if registered listeners that don't implement
175: * <code>AsynchHAMembershipExtendedListener</code> or
176: * <code>AsynchHAMembershipListener</code> will be notified
177: * synchronously of membership changes; <code>false</code> if
178: * those listeners will be notified asynchronously. Default
179: * is <code>false</code>.
180: */
181: public boolean getAllowSynchronousMembershipNotifications();
182:
183: /**
184: * Sets whether this partition will synchronously notify any
185: * HAPartition.HAMembershipListener of membership changes using the
186: * calling thread from the underlying group communications layer
187: * (e.g. JGroups).
188: *
189: * @param allowSync <code>true</code> if registered listeners that don't
190: * implement <code>AsynchHAMembershipExtendedListener</code> or
191: * <code>AsynchHAMembershipListener</code> should be notified
192: * synchronously of membership changes; <code>false</code> if
193: * those listeners can be notified asynchronously. Default
194: * is <code>false</code>.
195: */
196: public void setAllowSynchronousMembershipNotifications(
197: boolean allowSync);
198:
199: /** Access to the underlying HAPartition without going through JNDI
200: *
201: * @return the HAPartition for the cluster service
202: */
203: HAPartition getHAPartition();
204:
205: /** Return the list of member nodes that built from the current view
206: * @return A Vector Strings representing the host:port values of the nodes
207: */
208: Vector getCurrentView();
209:
210: String showHistory();
211:
212: String showHistoryAsXML();
213:
214: void startChannelDebugger();
215:
216: void startChannelDebugger(boolean accumulative);
217:
218: void stopChannelDebugger();
219: }
|