jules 2004/01/06 16:15:38
Modified: modules/clustering/src/java/org/apache/geronimo/clustering/web
WebTier.java HttpSessionManager.java
modules/clustering/src/java/org/apache/geronimo/clustering/ejb
EJBTier.java
modules/clustering/src/java/org/apache/geronimo/clustering
package.html Tier.java Node.java Cluster.java
modules/clustering/src/deploy clustering-service.xml
Added: modules/clustering/src/java/org/apache/geronimo/clustering/jndi
package.html JNDITier.java
Log:
more changes to Cluster/Node/Tier - I think I have it sorted now.
explanatory javadoc in package.html
addition of JNDI Tier
Revision Changes Path
1.5 +18 -2
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/web/WebTier.java
Index: WebTier.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/web/WebTier.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- WebTier.java 4 Jan 2004 15:51:59 -0000 1.4
+++ WebTier.java 7 Jan 2004 00:15:38 -0000 1.5
@@ -80,7 +80,23 @@
WebTier
extends Tier
{
- protected Log _log=LogFactory.getLog(WebTier.class);
+ // protected Log _log=LogFactory.getLog(WebTier.class);
+
+ /**
+ * 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)
+ throws Exception
+ {
+ return Tier.makeObjectName(clusterName, nodeName, "web");
+ }
//----------------------------------------
// WebTier
1.6 +3 -2
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HttpSessionManager.java 4 Jan 2004 15:19:31 -0000 1.5
+++ HttpSessionManager.java 7 Jan 2004 00:15:38 -0000 1.6
@@ -121,7 +121,8 @@
try
{
// find our tier
- _tier=(Tier)_server.getAttribute(Tier.makeObjectName(getClusterName(),
getNodeName(), "web"), "Reference");
+
_tier=(Tier)_server.getAttribute(WebTier.makeObjectName(getClusterName(),
getNodeName()), "Reference");
+ _log.debug("Tier: "+_tier);
}
catch (Exception e)
{
1.1
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/jndi/package.html
Index: package.html
===================================================================
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title></title>
</head>
<body>
The Geronimo JNDI Tier Clustering binding.
</body>
</html>
1.1
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/jndi/JNDITier.java
Index: JNDITier.java
===================================================================
/* ====================================================================
* The Apache Software License, Version 1.1
*
* Copyright (c) 2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Apache" and "Apache Software Foundation" and
* "Apache Geronimo" must not be used to endorse or promote products
* derived from this software without prior written permission. For
* written permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache",
* "Apache Geronimo", nor may "Apache" appear in their name, without
* prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* ====================================================================
*/
package org.apache.geronimo.clustering.jndi;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.management.MBeanServer;
import javax.management.ObjectName;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.clustering.Tier;
import org.apache.geronimo.clustering.Data;
import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
/**
* Responsible for maintaining state stored in the JNDI tier -
* i.e. StatefulSessions.
*
* @version $Revision: 1.1 $ $Date: 2004/01/07 00:15:38 $
*/
public class
JNDITier
extends Tier
{
// protected Log _log=LogFactory.getLog(JNDITier.class);
/**
* 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)
throws Exception
{
return Tier.makeObjectName(clusterName, nodeName, "jndi");
}
//----------------------------------------
// JNDITier
//----------------------------------------
protected Object alloc(){return new HashMap();}
public Object registerData(String uid, Object data) {synchronized (_tier)
{return ((Map)_tier).put(uid, data);}}
public Object deregisterData(String uid) {synchronized (_tier){return
((Map)_tier).remove(uid);}}
//----------------------------------------
// GeronimoMBeanTarget
//----------------------------------------
public static GeronimoMBeanInfo
getGeronimoMBeanInfo()
{
GeronimoMBeanInfo mbeanInfo=Tier.getGeronimoMBeanInfo();
mbeanInfo.setTargetClass(JNDITier.class);
return mbeanInfo;
}
}
1.4 +19 -2
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/ejb/EJBTier.java
Index: EJBTier.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/ejb/EJBTier.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- EJBTier.java 4 Jan 2004 14:18:06 -0000 1.3
+++ EJBTier.java 7 Jan 2004 00:15:38 -0000 1.4
@@ -80,7 +80,23 @@
EJBTier
extends Tier
{
- protected Log _log=LogFactory.getLog(EJBTier.class);
+ // protected Log _log=LogFactory.getLog(EJBTier.class);
+
+ /**
+ * 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)
+ throws Exception
+ {
+ return Tier.makeObjectName(clusterName, nodeName, "ejb");
+ }
//----------------------------------------
// EJBTier
@@ -115,6 +131,7 @@
//----------------------------------------
// GeronimoMBeanTarget
//----------------------------------------
+
public static GeronimoMBeanInfo
getGeronimoMBeanInfo()
{
1.2 +50 -4
incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/package.html
Index: package.html
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/clustering/src/java/org/apache/geronimo/clustering/package.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- package.html 28 Dec 2003 19:12:51 -0000 1.1
+++ package.html 7 Jan 2004 00:15:38 -0000 1.2
@@ -1,9 +1,55 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
- <head>
- <title></title>
- </head>
<body>
+
The Geronimo Clustering implementation.
- </body>
+
+ <p/>
+
+ Basically it works like this...
+
+ <p/>
+
+ <li>A Geronimo instance has N Cluster instances.</li>
+
+ <li>A Cluster instance has N Node instances.</li>
+
+ <li>A Node instance has N Tier instances (each of a different
+ type - e.g. web/ejb/jndi/etc.).</li>
+
+ <li>Each Tier instance is responsible for connecting Application
+ state, of a corresponding type, to the Cluster's Data Collection
+ .</li>
+
+ <p/>
+
+ Clusters, Nodes and Tiers are statically described in a
+ descriptor (clustering-service.xml) that is deployed in the
+ Geronimo instance.
+
+ <p/>
+
+ Other types, more closely bound to the Application arena
+ (e.g. HttpSessionManager) are created dynamically as and when
+ required and hooked to a corresponding Tier Object as described
+ above.
+
+ <p/>
+
+ Messages may travel to and from these types, via their Cluster.
+
+ <p/>
+
+ Clusters map onto backends that are capable of transporting
+ these messages between JVMs, hence this collection of types
+ forms the backbone of Geronimo's distributed architecture.
+
+ <p/>
+
+ All of these types are MBeans, so will register with Geronimo's
+ JMX Agent and export interfaces to it that allow useful
+ information about their internal state to be read and possible
+ written by JMX Clients.
+
+ </body>
</html>
1.6 +15 -8
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Tier.java 4 Jan 2004 15:51:59 -0000 1.5
+++ Tier.java 7 Jan 2004 00:15:38 -0000 1.6
@@ -122,21 +122,22 @@
{
if (!super.canStart()) return false;
- if (_objectName.getKeyProperty("node")==null)
+ if (_objectName.getKeyProperty("cluster")==null)
{
- _log.warn("NodeMBean name must contain a 'node' property");
+ _log.warn("Tier MBean name must contain a 'cluster' property");
return false;
}
- if (_objectName.getKeyProperty("cluster")==null)
+ if (_objectName.getKeyProperty("node")==null)
{
- _log.warn("NodeMBean name must contain a 'cluster' property");
+ _log.warn("Tier MBean name must contain a 'node' property");
return false;
}
try
{
_node=(Node)_server.getAttribute(Node.makeObjectName(getClusterName(),
getNodeName()), "Reference");
+ _log.debug("Node: "+_node);
}
catch (Exception e)
{
@@ -154,7 +155,6 @@
// register our session map with it's Data object
Data data=_node.getData();
- _log.info("Data:"+data);
_tiers=data.getTiers(); // immutable, so doesn't need synchronisation
_tier=null;
synchronized (_tiers)
@@ -167,6 +167,14 @@
}
// tier storage now initialised...
}
+ _log.info("Node Data:"+data);
+ }
+
+ public void
+ setMBeanContext(GeronimoMBeanContext context)
+ {
+ super.setMBeanContext(context);
+
_log=LogFactory.getLog(getClass().getName()+"#"+getClusterName()+"/"+getNodeName()+"/"+getName());
}
public static GeronimoMBeanInfo
@@ -174,9 +182,8 @@
{
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("NodeName",
true, false, "Name of this Tier's Node"));
mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("ClusterName",
true, false, "Name of this Tier's Node's Cluster"));
+ mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("NodeName",
true, false, "Name of this Tier's Node"));
return mbeanInfo;
}
}
1.6 +8 -2
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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- Node.java 4 Jan 2004 15:51:59 -0000 1.5
+++ Node.java 7 Jan 2004 00:15:38 -0000 1.6
@@ -187,7 +187,6 @@
public void
doStart()
{
-
_log=LogFactory.getLog(getClass().getName()+"#"+getClusterName()+"/"+getName());
_log.info("starting");
synchronized (_cluster)
@@ -211,6 +210,13 @@
{
_log.info("failing");
_cluster.leave(this); // TODO - ??
+ }
+
+ public void
+ setMBeanContext(GeronimoMBeanContext context)
+ {
+ super.setMBeanContext(context);
+
_log=LogFactory.getLog(getClass().getName()+"#"+getClusterName()+"/"+getName());
}
public static GeronimoMBeanInfo
1.9 +16 -10
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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- Cluster.java 4 Jan 2004 15:19:31 -0000 1.8
+++ Cluster.java 7 Jan 2004 00:15:38 -0000 1.9
@@ -101,6 +101,12 @@
*/
public abstract List getMembers();
+ /**
+ * Return the Object which this Cluster is responsible for
+ * maintaining via e.g. replication.
+ *
+ * @return a <code>Data</code> value
+ */
public abstract Data getData();
/**
@@ -121,18 +127,9 @@
// GeronimoMBeanTarget
//----------------------------------------
- public boolean
- canStart()
- {
- if (!super.canStart()) return false;
-
- return true;
- }
-
public void
doStart()
{
- _log=LogFactory.getLog(Cluster.class.getName()+"#"+getName());
_log.debug("starting");
}
@@ -148,11 +145,20 @@
_log.debug("failing");
}
+ public void
+ setMBeanContext(GeronimoMBeanContext context)
+ {
+ super.setMBeanContext(context);
+ _log=LogFactory.getLog(Cluster.class.getName()+"#"+getName());
+ }
+
public static GeronimoMBeanInfo
getGeronimoMBeanInfo()
{
GeronimoMBeanInfo mbeanInfo=MBeanImpl.getGeronimoMBeanInfo();
// set target class in concrete subclasses...
+ mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Members", true,
false, "Cluster's current membership"));
+ mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Data", true,
false, "Cluster's current state"));
return mbeanInfo;
}
}
1.8 +10 -0
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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- clustering-service.xml 4 Jan 2004 15:19:31 -0000 1.7
+++ clustering-service.xml 7 Jan 2004 00:15:38 -0000 1.8
@@ -79,6 +79,16 @@
</mbean>
<!-- ============================================================ -->
+ <!-- JNDI Tier Manager -->
+ <!-- ============================================================ -->
+
+ <mbean
+ descriptor="org.apache.geronimo.clustering.jndi.JNDITier"
+ name="geronimo.clustering:role=Tier,name=jndi,cluster=GERONIMO,node=0"
+ >
+ </mbean>
+
+ <!-- ============================================================ -->
<!-- Start a test distributable HttpSessionManager... -->
<!-- ============================================================ -->