KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > ha > jmx > HAServiceMBean


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.ha.jmx;
23
24 import java.io.Serializable JavaDoc;
25
26 import javax.management.Notification JavaDoc;
27 import javax.management.NotificationBroadcaster JavaDoc;
28
29 import org.jboss.ha.framework.server.ClusterPartitionMBean;
30
31 /**
32  * <p>
33  * HA-Service interface.
34  * Defines common functionality for partition symmetric (farming) services.
35  * </p>
36  *
37  * @author <a HREF="mailto:ivelin@apache.org">Ivelin Ivanov</a>
38  * @version $Revision: 43879 $
39  *
40  */

41
42 public interface HAServiceMBean
43   extends org.jboss.system.ServiceMBean, NotificationBroadcaster JavaDoc
44 {
45
46    /**
47     * Name of the underlying partition that determine the cluster to use.
48     *
49     * @deprecate use {@link #getClusterPartition()}
50     */

51    String JavaDoc getPartitionName();
52
53    /**
54     * Set the name of the underlying partition that determine the cluster to use.
55     * Can be set only when the MBean is not in a STARTED or STARTING state.
56     *
57     * @deprecate use {@link #setClusterPartition()}
58     */

59    void setPartitionName(String JavaDoc partitionName);
60   
61    /**
62     * Get the underlying partition used by this service.
63     *
64     * @return the partition
65     */

66    ClusterPartitionMBean getClusterPartition();
67   
68    /**
69     * Sets the underlying partition used by this service.
70     * Can be set only when the MBean is not in a STARTED or STARTING state.
71     *
72     * @param clusterPartition the partition
73     */

74    void setClusterPartition(ClusterPartitionMBean clusterPartition);
75
76
77   /**
78    *
79    * Convenience method for broadcasting a call to all members
80    * of a partition.
81    *
82    * @param methodName
83    * @param args
84    * @throws Exception
85    */

86   public void callMethodOnPartition(String JavaDoc methodName, Object JavaDoc[] args)
87     throws Exception JavaDoc;
88
89   /**
90    *
91    * Convenience method for sharing state across a cluster partition.
92    * Delegates to the DistributedStateService
93    *
94    * @param key key for the distributed object
95    * @return Serializable the distributed object
96    *
97    */

98   public Serializable JavaDoc getDistributedState(String JavaDoc key);
99
100   /**
101    *
102    *
103    * Convenience method for sharing state across a cluster partition.
104    * Delegates to the DistributedStateService
105    *
106    * @param key key for the distributed object
107    * @param value the distributed object
108    *
109    */

110   public void setDistributedState(String JavaDoc key, Serializable JavaDoc value)
111     throws Exception JavaDoc;
112
113
114   /**
115    *
116    * Broadcast the notification to the remote listener nodes (if any) and then
117    * invoke super.sendNotification() to notify local listeners.
118    *
119    * @param notification sent out to local listeners and other nodes. It should be serializable.
120    * It is recommended that the source of the notification is an ObjectName of an MBean that
121    * is is available on all nodes where the broadcaster MBean is registered.
122    *
123    *
124    * @see javax.management.NotificationBroadcasterSupport#sendNotification(Notification)
125    *
126    */

127   public void sendNotification(Notification JavaDoc notification);
128   
129 }
130
Popular Tags