User: patriot1burke
Date: 01/09/26 20:14:08
Modified: src/main/org/jboss/ha HARMIServerImpl.java HARMIServer.java
HARMIClient.java
Added: src/main/org/jboss/ha HARMIProxy.java
Removed: src/main/org/jboss/ha HASmallConfigEntries.java
HARemoteInfoImpl.java HARemoteInfo.java
HAConfigServerMBean.java HAConfigServer.java
HAConfigNodeImpl.java HAConfigNode.java
HAConfigEntry.java
Log:
no message
Revision Changes Path
1.6 +13 -15 jbossmx/src/main/org/jboss/ha/HARMIServerImpl.java
Index: HARMIServerImpl.java
===================================================================
RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ha/HARMIServerImpl.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- HARMIServerImpl.java 2001/09/25 22:24:21 1.5
+++ HARMIServerImpl.java 2001/09/27 03:14:08 1.6
@@ -35,19 +35,18 @@
protected HashMap invokerMap = new HashMap ();
protected HAPartition partition = null;
protected Logger log;
- protected HARMIClient client;
protected RemoteStub rmistub;
protected Object stub;
protected String key;
+ protected Class intf;
- public static Hashtable rmiServers = new Hashtable();
-
- public HARMIServerImpl (HAPartition partition, String replicantName, Class intf,
Object handler, LoadBalancePolicy policy) throws Exception
+ public HARMIServerImpl (HAPartition partition, String replicantName, Class intf,
Object handler) throws Exception
{
this.replicantName = replicantName;
this.partition = partition;
this.handler = handler;
this.log = Logger.create(this.getClass());
+ this.intf = intf;
Method[] methods = handler.getClass ().getMethods ();
for (int i = 0; i < methods.length; i++)
@@ -55,24 +54,23 @@
this.rmistub = UnicastRemoteObject.exportObject (this);
this.key = partition.getPartitionName() + "/" + replicantName;
- this.client = new HARMIClient(replicants, policy, key, handler);
- this.stub = Proxy.newProxyInstance(
- intf.getClassLoader(),
- new Class[] { intf },
- this.client);
partition.getDistributedReplicantManager ().registerListener (replicantName,
this);
partition.getDistributedReplicantManager ().add (replicantName, rmistub);
- rmiServers.put(key, this);
+ HARMIServer.rmiServers.put(key, this);
}
- public ArrayList getReplicants()
+ public ArrayList getReplicants() throws Exception
{
return replicants;
}
- public Object getHAStub()
+ public Object createHAStub(LoadBalancePolicy policy)
{
- return stub;
+ HARMIClient client = new HARMIClient(replicants, policy, key, handler);
+ return Proxy.newProxyInstance(
+ intf.getClassLoader(),
+ new Class[] { intf, HARMIProxy.class },
+ client);
}
public void destroy ()
@@ -83,7 +81,7 @@
this.partition.getDistributedReplicantManager ().remove
(this.replicantName);
UnicastRemoteObject.unexportObject (this, true);
- rmiServers.remove(key);
+ HARMIServer.rmiServers.remove(key);
} catch (Exception e)
{e.printStackTrace ();}
}
@@ -93,7 +91,7 @@
return lastSet;
}
- public Object getLocal()
+ public Object getLocal() throws Exception
{
return handler;
}
1.2 +6 -0 jbossmx/src/main/org/jboss/ha/HARMIServer.java
Index: HARMIServer.java
===================================================================
RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ha/HARMIServer.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- HARMIServer.java 2001/09/20 07:57:41 1.1
+++ HARMIServer.java 2001/09/27 03:14:08 1.2
@@ -3,6 +3,7 @@
import java.util.Vector;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Hashtable;
import java.util.Iterator;
import java.util.Collection;
import java.rmi.Remote;
@@ -21,6 +22,11 @@
extends Remote
{
public HARMIResponse invoke(long tag, MarshalledObject mimo) throws Exception;
+ public ArrayList getReplicants() throws Exception;
+ public Object getLocal() throws Exception;
+
+ public static Hashtable rmiServers = new Hashtable();
+
}
1.3 +13 -5 jbossmx/src/main/org/jboss/ha/HARMIClient.java
Index: HARMIClient.java
===================================================================
RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ha/HARMIClient.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HARMIClient.java 2001/09/25 22:24:21 1.2
+++ HARMIClient.java 2001/09/27 03:14:08 1.3
@@ -25,7 +25,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a>
- * @version $Revision: 1.2 $
+ * @version $Revision: 1.3 $
*
* <p><b>Revisions:</b>
*
@@ -35,7 +35,7 @@
* </ul>
*/
-public class HARMIClient implements java.io.Serializable,
java.lang.reflect.InvocationHandler
+public class HARMIClient implements java.io.Serializable,
java.lang.reflect.InvocationHandler, HARMIProxy
{
protected String key = null;
protected ArrayList targets = null;
@@ -136,6 +136,10 @@
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
{
+ if (method.getName().equals("isLocal") && args.length == 0)
+ {
+ return method.invoke(this, args);
+ }
if (local != null)
{
try
@@ -199,13 +203,17 @@
key = (String)stream.readUTF();
targets = (ArrayList)stream.readObject();
loadBalancePolicy = (LoadBalancePolicy)stream.readObject();
- HARMIServerImpl server = (HARMIServerImpl)HARMIServerImpl.rmiServers.get(key);
+ HARMIServer server = (HARMIServer)HARMIServer.rmiServers.get(key);
if (server != null)
{
synchronized(targets)
{
- targets = server.getReplicants();
- local = server.getLocal();
+ try
+ {
+ targets = server.getReplicants();
+ local = server.getLocal();
+ }
+ catch (Exception ignored) {}
}
}
}
1.1 jbossmx/src/main/org/jboss/ha/HARMIProxy.java
Index: HARMIProxy.java
===================================================================
package org.jboss.ha;
public interface HARMIProxy extends java.io.Serializable
{
public boolean isLocal();
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development