User: kimptoc
Date: 01/09/01 12:50:29
Modified: src/main/org/jboss/ejb/plugins/jrmp13/server
JRMPContainerInvokerHA.java
Log:
remove deprecated logging import, where possible, otherwise comment as needing
replacement with log4j.... must find out how it is use.... would be good if the
deprecation message pointed to an example to use...
Revision Changes Path
1.2 +36 -34
jbossmx/src/main/org/jboss/ejb/plugins/jrmp13/server/JRMPContainerInvokerHA.java
Index: JRMPContainerInvokerHA.java
===================================================================
RCS file:
/cvsroot/jboss/jbossmx/src/main/org/jboss/ejb/plugins/jrmp13/server/JRMPContainerInvokerHA.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JRMPContainerInvokerHA.java 2001/08/19 18:31:02 1.1
+++ JRMPContainerInvokerHA.java 2001/09/01 19:50:29 1.2
@@ -33,6 +33,8 @@
import org.jboss.ejb.plugins.jrmp13.interfaces.StatelessSessionProxyHA;
import org.jboss.ejb.plugins.jrmp13.interfaces.StatefulSessionProxy;
import org.jboss.ejb.plugins.jrmp13.interfaces.EntityProxy;
+
+// TODO this needs to be replaced with the log4j logging
import org.jboss.logging.Logger;
import org.jboss.ha.HAConfigNode;
@@ -52,7 +54,7 @@
* @author Rickard �berg ([EMAIL PROTECTED])
* @author <a href="mailto:[EMAIL PROTECTED]">Marc Fleury</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>
- * @version $Revision: 1.1 $
+ * @version $Revision: 1.2 $
*
* <p><b>Revisions:</b>
*
@@ -67,10 +69,10 @@
{
EJBHome home;
EJBObject statelessObject;
-
+
Container container;
org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker ci; // Parent invoker
-
+
String _beanName = null;
String _appName = null;
String _nodeName = null;
@@ -78,17 +80,17 @@
HomeProxyHA _sshp = null; // optimization
Hashtable localJndiProps = null;
String haAppPathName = null;
-
+
public JRMPContainerInvokerHA
(org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker ci)
{
this.ci = ci;
}
-
+
public void setContainer (Container con)
{
this.container = con;
}
-
+
public void init ()
{
// Create stateless session object
@@ -99,23 +101,23 @@
try
{
Context ctx = new InitialContext ();
-
+
// names used for HA
//
_appName = new java.io.File (new java.net.URL
(this.container.getApplication ().getName ()).getFile ()).getName ();
_beanName = this.container.getBeanMetaData ().getEjbName ();
-
+
// Get the HAConfigService
//
HAConfigNode ha = (HAConfigNode)ctx.lookup ("java:/HAConfigServer");
_nodeName = ha.getNodeName ();
localJndiProps = ha.getLocalJndiProps ();
-
+
// Get already running replica
//
Vector replicateContainers = ha.getReplicateContainers (_appName ,
_beanName, HAConfigNode.REMOTE_TYPE);
haAppPathName = ha.getHaAppPath (_appName , _beanName,
HAConfigNode.REMOTE_TYPE);
-
+
this.createStatelessSessionProxy (replicateContainers,
ha.getNormalDelay (), ha.getDeathDelay ());
}
catch (Exception e)
@@ -140,10 +142,10 @@
{ ((ContainerInvokerContainer)container).getHomeClass (), handleClass },
new HomeProxy (ci.getJndiName (), ci.getEJBMetaData (), ci, ci.isOptimized
()));
}
-
+
Logger.debug ("JRMP 1.3 CI initialized (HA)");
}
-
+
public void start ()
{
if (!(container.getBeanMetaData () instanceof EntityMetaData) &&
@@ -153,40 +155,40 @@
{
Context ctx = new InitialContext ();
HAConfigNode ha = (HAConfigNode)ctx.lookup ("java:/HAConfigServer");
- HAConfigEntry detail = new HAConfigEntry
((ContainerRemote)java.rmi.server.RemoteObject.toStub (ci), null, null);
+ HAConfigEntry detail = new HAConfigEntry
((ContainerRemote)java.rmi.server.RemoteObject.toStub (ci), null, null);
ha.registerContainer (this, _appName , _beanName,
HAConfigNode.REMOTE_TYPE, detail);
}
catch (Exception e)
{ e.printStackTrace (); }
}
}
-
+
public void stop ()
{
unregisterFromHA ();
}
-
+
public void destroy ()
{
unregisterFromHA ();
}
-
+
public EJBMetaData getEJBMetaData ()
{
// Ignore, never called
return null;
}
-
+
public EJBHome getEJBHome ()
{
return home;
}
-
+
public EJBObject getStatelessSessionEJBObject ()
{
return statelessObject;
}
-
+
public EJBObject getStatefulSessionEJBObject (Object id)
{
return (EJBObject)Proxy.newProxyInstance
(((ContainerInvokerContainer)container).getRemoteClass ().getClassLoader (),
@@ -194,7 +196,7 @@
{ ((ContainerInvokerContainer)container).getRemoteClass () },
new StatefulSessionProxy (ci.getJndiName (), ci, id, ci.isOptimized ()));
}
-
+
public EJBObject getEntityEJBObject (Object id)
{
return (EJBObject)Proxy.newProxyInstance
(((ContainerInvokerContainer)container).getRemoteClass ().getClassLoader (),
@@ -202,7 +204,7 @@
{ ((ContainerInvokerContainer)container).getRemoteClass () },
new EntityProxy (ci.getJndiName (), ci, id, ci.isOptimized ()));
}
-
+
public Collection getEntityCollection (Collection ids)
{
ArrayList list = new ArrayList (ids.size ());
@@ -216,15 +218,15 @@
}
return list;
}
-
+
// private methods -----------------------------------------------------
-
+
public void beanReplicaModified (java.util.Vector newValue)
{
System.out.println/*Logger.debug*/("Cluster structure has changed, need to
recompute proxies");
this.createStatelessSessionProxy (newValue, 5000, 30000); // these delays
won't be used anyway
}
-
+
private void createStatelessSessionProxy (java.util.Vector replicateContainers,
long normalDelay, long deathDelay)
{
try
@@ -238,7 +240,7 @@
props[0] = this.localJndiProps;
HAConfigEntry tmpEntry = null;
boolean foundMeInList = false;
-
+
for (int i=0, cursor=0; i < nbElem; i++)
{
tmpEntry = (HAConfigEntry)(replicateContainers.elementAt (i));
@@ -250,7 +252,7 @@
}
foundMeInList = true;
}
-
+
// If I was in the list, it means that nbElem had the good size and that
cis is now too big (nbElem + 1)
// as well as props
//
@@ -259,8 +261,8 @@
System.arraycopy (cis, 0, cis, 0, nbElem);
System.arraycopy (props, 0, props, 0, nbElem);
}
-
-
+
+
// create home proxy and set it all its possible targets (replicas)
//
if ((this._sshp == null) || (this.home == null)) // create it only the
first time, after it is only updated
@@ -284,7 +286,7 @@
}
else
this._sshp.setMultipleContainers (cis, props, haAppPathName);
-
+
// create proxy and set it all its possible targets (replicas)
//
if ((this._ssp == null) || (this.statelessObject == null)) // create it
only the first time, after it is only updated
@@ -302,7 +304,7 @@
catch (Exception e)
{
e.printStackTrace ();
-
+
// Create EJBHome object
// We add the Handle methods to the Home
Class handleClass;
@@ -317,7 +319,7 @@
new Class[]
{ ((ContainerInvokerContainer)container).getHomeClass (), handleClass },
new HomeProxy (ci.getJndiName (), ci.getEJBMetaData (), ci, ci.isOptimized
()));
-
+
// problem? create a standard stateless proxy object...
this.statelessObject = (EJBObject)Proxy.newProxyInstance
(((ContainerInvokerContainer)container).getRemoteClass ().getClassLoader (),
new Class[]
@@ -325,7 +327,7 @@
new StatelessSessionProxy (ci.getJndiName (), ci, ci.isOptimized ()));
}
}
-
+
private void unregisterFromHA ()
{
if (!(container.getBeanMetaData () instanceof EntityMetaData) &&
@@ -337,7 +339,7 @@
//
Context ctx = new InitialContext ();
HAConfigNode ha = (HAConfigNode)ctx.lookup ("java:/HAConfigServer");
-
+
try
{
ha.unregisterContainer (_appName , _beanName,
HAConfigNode.REMOTE_TYPE);
@@ -353,5 +355,5 @@
}
}
// ********SL********END
-
+
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development