jules 2004/01/04 07:19:31
Modified: modules/clustering/src/java/org/apache/geronimo/clustering/web
HttpSessionManager.java
modules/clustering/src/java/org/apache/geronimo/clustering
Tier.java Node.java Cluster.java
modules/clustering/src/deploy clustering-service.xml
Log:
commit missing change from last set
further abstract out naming protocol for clustering MBeans
Revision Changes Path
1.5 +6 -21
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/web/HttpSessionManager.java
Index: HttpSessionManager.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/web/HttpSessionManager.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- HttpSessionManager.java 4 Jan 2004 14:18:06 -0000 1.4
+++ HttpSessionManager.java 4 Jan 2004 15:19:31 -0000 1.5
@@ -65,6 +65,7 @@
import org.apache.geronimo.clustering.LocalCluster;
import org.apache.geronimo.clustering.Data;
import org.apache.geronimo.clustering.Tier;
+import org.apache.geronimo.clustering.MBeanImpl;
import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
@@ -78,7 +79,7 @@
*/
public class
HttpSessionManager
- implements GeronimoMBeanTarget
+ extends MBeanImpl
{
protected Log _log=LogFactory.getLog(HttpSessionManager.class);
@@ -112,11 +113,11 @@
// GeronimoMBeanTarget
//----------------------------------------
- protected MBeanServer _server;
-
public boolean
canStart()
{
+ if (!super.canStart()) return false;
+
try
{
// find our tier
@@ -131,8 +132,6 @@
return true;
}
- public boolean canStop() {return true;}
-
public void
doStart()
{
@@ -157,24 +156,10 @@
// TODO - leave cluster
}
- public void
- doFail()
- {
- _log.info("failing");
- // leave cluster ?
- }
-
- public void
- setMBeanContext(GeronimoMBeanContext context)
- {
- // _objectName=(context==null)?null:context.getObjectName();
- _server=(context==null)?null:context.getServer();
- }
-
public static GeronimoMBeanInfo
getGeronimoMBeanInfo()
{
- GeronimoMBeanInfo mbeanInfo=new GeronimoMBeanInfo();
+ GeronimoMBeanInfo mbeanInfo=MBeanImpl.getGeronimoMBeanInfo();
mbeanInfo.setTargetClass(HttpSessionManager.class);
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Size",
true, false, "number of extant HttpSessions within this webapp"));
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("UID",
true, false, "unique identity for this webapp within this vm"));
1.4 +24 -21
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Tier.java
Index: Tier.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Tier.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Tier.java 4 Jan 2004 14:35:06 -0000 1.3
+++ Tier.java 4 Jan 2004 15:19:31 -0000 1.4
@@ -78,13 +78,29 @@
*/
public abstract class
Tier
- extends MBeanImpl
+ extends NamedMBeanImpl
{
- protected Log _log=LogFactory.getLog(Tier.class);
- protected Node _node;
- protected Data _data;
- protected Map _tiers;
- protected Object _tier;
+ protected Log _log=LogFactory.getLog(Tier.class);
+ protected Node _node;
+ protected Data _data;
+ protected Map _tiers;
+ protected Object _tier;
+
+ /**
+ * Makes an ObjectName for a Tier MBean with the given parameters.
+ *
+ * @param clusterName a <code>String</code> value
+ * @param nodeName a <code>String</code> value
+ * @param tierName a <code>String</code> value
+ * @return an <code>ObjectName</code> value
+ * @exception Exception if an error occurs
+ */
+ public static ObjectName
+ makeObjectName(String clusterName, String nodeName, String tierName)
+ throws Exception
+ {
+ return new
ObjectName("geronimo.clustering:role=Tier,name="+tierName+",node="+nodeName+",cluster="+clusterName);
+ }
//----------------------------------------
// Tier
@@ -92,19 +108,11 @@
public String getClusterName() {return
_objectName.getKeyProperty("cluster");}
public String getNodeName() {return _objectName.getKeyProperty("node");}
- public String getName() {return _objectName.getKeyProperty("name");}
protected abstract Object alloc();
public abstract Object registerData(String uid, Object data);
public abstract Object deregisterData(String uid);
- public static ObjectName
- makeObjectName(String clusterName, String nodeName, String tierName)
- throws Exception
- {
- return new
ObjectName("geronimo.clustering:role=Tier,name="+tierName+",node="+nodeName+",cluster="+clusterName);
- }
-
//----------------------------------------
// GeronimoMBeanTarget
//----------------------------------------
@@ -112,11 +120,7 @@
public boolean
canStart()
{
- if (_objectName.getKeyProperty("name")==null)
- {
- _log.warn("TierMBean name must contain a 'name' property");
- return false;
- }
+ if (!super.canStart()) return false;
if (_objectName.getKeyProperty("node")==null)
{
@@ -171,7 +175,6 @@
GeronimoMBeanInfo mbeanInfo=MBeanImpl.getGeronimoMBeanInfo();
//set target class in concrete subclass
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Reference",
true, false, "a local reference to this Tier"));
- mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Name",
true, false, "Name of this Tier"));
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("NodeName",
true, false, "Name of this Tier's Node"));
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("ClusterName",
true, false, "Name of this Tier's Node's Cluster"));
return mbeanInfo;
1.4 +23 -32
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Node.java
Index: Node.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Node.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Node.java 4 Jan 2004 14:35:06 -0000 1.3
+++ Node.java 4 Jan 2004 15:19:31 -0000 1.4
@@ -67,16 +67,34 @@
import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
/**
+ * A Node is an instance of a connection to a Cluster. Nodes are named
+ * uniquely within their Cluster and VM. A VM may contain more than
+ * one Node.
*
* @version $Revision$ $Date$
*/
public class
Node
- extends MBeanImpl
+ extends NamedMBeanImpl
implements MetaDataListener, DataListener, DataDeltaListener
{
- protected static Log _log=LogFactory.getLog(Node.class);
- protected Cluster _cluster;
+ protected Log _log=LogFactory.getLog(Node.class);
+ protected Cluster _cluster;
+
+ /**
+ * Makes an ObjectName for a Node MBean with the given parameters.
+ *
+ * @param clusterName a <code>String</code> value
+ * @param nodeName a <code>String</code> value
+ * @return an <code>ObjectName</code> value
+ * @exception Exception if an error occurs
+ */
+ public static ObjectName
+ makeObjectName(String clusterName, String nodeName)
+ throws Exception
+ {
+ return new
ObjectName("geronimo.clustering:role=Node,name="+nodeName+",cluster="+clusterName);
+ }
//----------------------------------------
// Node
@@ -89,33 +107,12 @@
*/
public String getCluster() {return _objectName.getKeyProperty("cluster");}
/**
- * Returns the Node's unique identifier within it's Cluster.
- *
- * @return a <code>String</code> value
- */
- public String getName() {return _objectName.getKeyProperty("name");}
- /**
* Returns the Node's Cluster's current membership.
*
* @return a <code>List</code> value
*/
public List getMembers(){return _cluster.getMembers();}
- /**
- * Makes an ObjectName for a NodeMBean with the given parameters.
- *
- * @param clusterName a <code>String</code> value
- * @param nodeName a <code>String</code> value
- * @return an <code>ObjectName</code> value
- * @exception Exception if an error occurs
- */
- public static ObjectName
- makeObjectName(String clusterName, String nodeName)
- throws Exception
- {
- return new
ObjectName("geronimo.clustering:role=Node,name="+nodeName+",cluster="+clusterName);
- }
-
//----------------------------------------
// MetaDataListener
//----------------------------------------
@@ -169,11 +166,7 @@
public boolean
canStart()
{
- if (_objectName.getKeyProperty("name")==null)
- {
- _log.warn("NodeMBean name must contain a 'name' property");
- return false;
- }
+ if (!super.canStart()) return false;
if (_objectName.getKeyProperty("cluster")==null)
{
@@ -229,8 +222,6 @@
{
GeronimoMBeanInfo mbeanInfo=MBeanImpl.getGeronimoMBeanInfo();
mbeanInfo.setTargetClass(Node.class);
- mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Reference", true,
false, "a local reference to this Node"));
- mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Name", true,
false, "unique identifier for this Node (within it's Cluster)"));
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Cluster", true,
false, "unique identifier for this Node's Cluster"));
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Members", true,
false, "list of cluster members"));
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Data", true,
false, "cluster state"));
1.8 +16 -14
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Cluster.java
Index: Cluster.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/Cluster.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Cluster.java 4 Jan 2004 14:35:06 -0000 1.7
+++ Cluster.java 4 Jan 2004 15:19:31 -0000 1.8
@@ -66,21 +66,27 @@
import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
/**
- * A 'Cluster' is the in-vm representative of a Cluster of Geronimo
- * nodes. The particular cluster to which it belongs is identified by
- * it's 'name' property. I hope to support different types of cluster
- * including (initially) SimpleCluster, in which every node replicates
- * every other node and CleverCluster, which automagically partitions
- * data into SubClusters etc...
+ * A 'Cluster' is a point of connection between all 'Cluster's with
+ * the same name, running in other VMs. I hope to support different
+ * types of cluster including (initially) SimpleCluster, in which
+ * every node replicates every other node and CleverCluster, which
+ * automagically partitions data into SubClusters etc...
*
* @version $Revision$ $Date$
*/
public abstract class
Cluster
- extends MBeanImpl
+ extends NamedMBeanImpl
{
protected Log _log=LogFactory.getLog(Cluster.class);
+ /**
+ * Makes an ObjectName for a Cluster MBean with the given parameters.
+ *
+ * @param clusterName a <code>String</code> value
+ * @return an <code>ObjectName</code> value
+ * @exception Exception if an error occurs
+ */
public static ObjectName
makeObjectName(String clusterName)
throws Exception
@@ -118,11 +124,7 @@
public boolean
canStart()
{
- if (_objectName.getKeyProperty("name")==null)
- {
- _log.warn("ClusterMBean name must contain a 'name' property");
- return false;
- }
+ if (!super.canStart()) return false;
return true;
}
@@ -130,7 +132,7 @@
public void
doStart()
{
-
_log=LogFactory.getLog(Cluster.class.getName()+"#"+_objectName.getKeyProperty("name"));
+ _log=LogFactory.getLog(Cluster.class.getName()+"#"+getName());
_log.debug("starting");
}
1.7 +1 -4
incubator-geronimo/modules/clustering/src/deploy/clustering-service.xml
Index: clustering-service.xml
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/clustering/src/deploy/clustering-service.xml,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- clustering-service.xml 3 Jan 2004 01:42:56 -0000 1.6
+++ clustering-service.xml 4 Jan 2004 15:19:31 -0000 1.7
@@ -16,13 +16,12 @@
<!-- Start two Clusters containing 5 nodes (all Local) -->
<!-- ============================================================ -->
-<!--
<mbean
descriptor="org.apache.geronimo.clustering.LocalCluster"
name="geronimo.clustering:role=Cluster,name=GERONIMO"
>
</mbean>
--->
+
<mbean
descriptor="org.apache.geronimo.clustering.Node"
name="geronimo.clustering:role=Node,name=0,cluster=GERONIMO"
@@ -41,13 +40,11 @@
>
</mbean>
-<!--
<mbean
descriptor="org.apache.geronimo.clustering.LocalCluster"
name="geronimo.clustering:role=Cluster,name=GERONIMO2"
>
</mbean>
--->
<mbean
descriptor="org.apache.geronimo.clustering.Node"