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.jmx;
023:
024: import java.io.Serializable;
025:
026: import javax.management.Notification;
027: import javax.management.NotificationBroadcaster;
028:
029: import org.jboss.ha.framework.server.ClusterPartitionMBean;
030:
031: /**
032: * <p>
033: * HA-Service interface.
034: * Defines common functionality for partition symmetric (farming) services.
035: * </p>
036: *
037: * @author <a href="mailto:ivelin@apache.org">Ivelin Ivanov</a>
038: * @version $Revision: 57188 $
039: *
040: */
041:
042: public interface HAServiceMBean extends org.jboss.system.ServiceMBean,
043: NotificationBroadcaster {
044:
045: /**
046: * Name of the underlying partition that determine the cluster to use.
047: *
048: * @deprecate use {@link #getClusterPartition()}
049: */
050: public String getPartitionName();
051:
052: /**
053: * Set the name of the underlying partition that determine the cluster to use.
054: * Can be set only when the MBean is not in a STARTED or STARTING state.
055: *
056: * @deprecate use {@link #setClusterPartition()}
057: */
058: public void setPartitionName(String partitionName);
059:
060: /**
061: * Get the underlying partition used by this service.
062: *
063: * @return the partition
064: */
065: ClusterPartitionMBean getClusterPartition();
066:
067: /**
068: * Sets the underlying partition used by this service.
069: * Can be set only when the MBean is not in a STARTED or STARTING state.
070: *
071: * @param clusterPartition the partition
072: */
073: void setClusterPartition(ClusterPartitionMBean clusterPartition);
074:
075: /**
076: *
077: * Convenience method for broadcasting a call to all members
078: * of a partition.
079: *
080: * @param methodName
081: * @param args
082: * @throws Exception
083: */
084: public void callMethodOnPartition(String methodName, Object[] args)
085: throws Exception;
086:
087: /**
088: *
089: * Convenience method for sharing state across a cluster partition.
090: * Delegates to the DistributedStateService
091: *
092: * @param key key for the distributed object
093: * @return Serializable the distributed object
094: *
095: */
096: public Serializable getDistributedState(String key);
097:
098: /**
099: *
100: *
101: * Convenience method for sharing state across a cluster partition.
102: * Delegates to the DistributedStateService
103: *
104: * @param key key for the distributed object
105: * @param value the distributed object
106: *
107: */
108: public void setDistributedState(String key, Serializable value)
109: throws Exception;
110:
111: /**
112: *
113: * Broadcast the notification to the remote listener nodes (if any) and then
114: * invoke super.sendNotification() to notify local listeners.
115: *
116: * @param notification sent out to local listeners and other nodes. It should be serializable.
117: * It is recommended that the source of the notification is an ObjectName of an MBean that
118: * is is available on all nodes where the broadcaster MBean is registered.
119: *
120: *
121: * @see javax.management.NotificationBroadcasterSupport#sendNotification(Notification)
122: *
123: */
124: public void sendNotification(Notification notification);
125:
126: }
|