User: patriot1burke Date: 01/09/19 16:57:43 Modified: src/main/org/jboss/ha HARMITarget.java HAPartitionImpl.java DistributedReplicantManagerImpl.java ClusterPartition.java Log: HAJNDI sort of works now. Framework definately works now. Revision Changes Path 1.2 +6 -0 jbossmx/src/main/org/jboss/ha/HARMITarget.java Index: HARMITarget.java =================================================================== RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ha/HARMITarget.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- HARMITarget.java 2001/09/14 03:53:29 1.1 +++ HARMITarget.java 2001/09/19 23:57:43 1.2 @@ -22,7 +22,7 @@ * * @author <a href="mailto:[EMAIL PROTECTED]">Sacha Labourey</a> * @author <a href="mailto:[EMAIL PROTECTED]">Bill Burke</a> - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ * * <p><b>Revisions:</b> * @@ -90,6 +90,7 @@ public Object getRemoteTarget() { + System.out.println("number of targets: " + targets.length); if (targets.length == 0) { findTargetsSynchronously (); @@ -222,6 +223,11 @@ || targetException instanceof UnknownHostException) { // ignore + System.out.println("Connection failure"); + } + else if (targetException instanceof RemoteException) + { + System.out.println("RemoteException called: " + targetException.getClass().getName()); } else { 1.6 +35 -11 jbossmx/src/main/org/jboss/ha/HAPartitionImpl.java Index: HAPartitionImpl.java =================================================================== RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ha/HAPartitionImpl.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- HAPartitionImpl.java 2001/09/18 21:56:49 1.5 +++ HAPartitionImpl.java 2001/09/19 23:57:43 1.6 @@ -18,6 +18,7 @@ import JavaGroups.MethodCall; import JavaGroups.RpcDispatcher; import JavaGroups.RspList; +import JavaGroups.Rsp; import JavaGroups.GroupRequest; import JavaGroups.View; import JavaGroups.Address; @@ -46,7 +47,7 @@ protected ArrayList listeners = new ArrayList(); protected String partitionName; protected Vector members = null; - protected int timeout = 500; + protected int timeout = 0; protected JChannel channel = null; protected DistributedReplicantManagerImpl replicantManager; protected String nodeName; @@ -64,16 +65,10 @@ public void init() throws Exception { - log.info("Get current members"); - View view = channel.GetView(); - this.members = view.GetMembers(); - log.info("Num cluster members: " + members.size()); log.info("SetMembershipListener"); SetMembershipListener(this); log.info("SetMessageListener"); SetMessageListener(this); - log.info("get nodeName"); - this.nodeName = channel.GetLocalAddress().toString(); log.info("create replicant manager"); this.replicantManager = new DistributedReplicantManagerImpl(this); log.info("init replicant manager"); @@ -107,6 +102,21 @@ log.info("done initing.."); } + public void start() throws Exception + { + log.info("get nodeName"); + this.nodeName = channel.GetLocalAddress().toString(); + log.info("Get current members"); + View view = channel.GetView(); + this.members = view.GetMembers(); + log.info("Num cluster members: " + members.size()); + // We must now syncrhonize new state transfer subscriber + boolean rc = channel.GetState(null, 8000); + if (rc) log.info("State was retrieved successfully"); + else log.info("State could not be retrieved, (must be first member of group)"); + replicantManager.start(); + } + public void close() throws Exception { channel.Close(); @@ -157,7 +167,14 @@ if (rsp != null) { for (int i = 0; i < rsp.size(); i++) - rtn.add(rsp.elementAt(i)); + { + Object item = rsp.elementAt(i); + if (item instanceof Rsp) + { + item = ((Rsp)item).GetValue(); + } + rtn.add(item); + } } if (!excludeSelf) @@ -182,9 +199,9 @@ { stateHandlers.put(objectName, subscriber); // We must now syncrhonize new state transfer subscriber - boolean rc = channel.GetState(null, 8000); - if (rc) log.info("State was retrieved successfully"); - else log.info("State could not be retrieved, (must be first member of group)"); + // boolean rc = channel.GetState(null, 8000); + //if (rc) log.info("State was retrieved successfully"); + //else log.info("State could not be retrieved, (must be first member of group)"); } public void unsubscribeFromStateTransferEvents(String objectName, HAPartition.HAPartitionStateTransfer subscriber) @@ -291,6 +308,12 @@ { try { + if (this.members == null) + { + // Initial viewAccepted + this.members = newView.GetMembers(); + return; + } Vector oldMembers = this.members; Vector allMembers = newView.GetMembers(); Vector deadMembers = getDeadMembers(oldMembers, allMembers); @@ -371,6 +394,7 @@ method_call=(MethodCall)body; String methodName = method_call.GetName(); + log.info("Handle: " + methodName); int idx = methodName.indexOf('.'); String handlerName = methodName.substring(0, idx); String newMethodName = methodName.substring(idx + 1); 1.5 +14 -1 jbossmx/src/main/org/jboss/ha/DistributedReplicantManagerImpl.java Index: DistributedReplicantManagerImpl.java =================================================================== RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ha/DistributedReplicantManagerImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- DistributedReplicantManagerImpl.java 2001/09/18 04:15:10 1.4 +++ DistributedReplicantManagerImpl.java 2001/09/19 23:57:43 1.5 @@ -41,6 +41,10 @@ partition.registerMembershipListener(this); log.info("subscribeToStateTransferEvents"); partition.subscribeToStateTransferEvents(SERVICE_NAME, this); + } + + public void start() throws Exception + { log.info("Export myself as an RMI server"); RemoteStub stub = UnicastRemoteObject.exportObject(this); log.info("Register myself as a replicant of DistributedReplicantManager"); @@ -111,6 +115,7 @@ public void _add(String key, String nodeName, Serializable replicant) { + log.info("_add(" + key + ", " + nodeName); try { synchronized(this.replicants) @@ -118,10 +123,12 @@ HashMap rep = (HashMap)replicants.get(key); if (rep == null) { + log.info("_adding new HashMap"); rep = new HashMap(); replicants.put (key, rep); } rep.put(nodeName, replicant); + log.info("notifyingKeyListeners"); notifyKeyListeners(key, new ArrayList(rep.values())); } } @@ -227,11 +234,17 @@ protected void notifyKeyListeners(String key, ArrayList newReplicants) { + log.info("notifyKeyListeners"); synchronized(this.keyListeners) { ArrayList listeners = (ArrayList)keyListeners.get(key); - if (listeners == null) return; + if (listeners == null) + { + log.info("listeners is null"); + return; + } + log.info("notifying " + listeners.size() + " for key change: " + key); for (int i = 0; i < listeners.size(); i++) { DistributedReplicantManager.ReplicantListener listener = (DistributedReplicantManager.ReplicantListener)listeners.get(i); 1.4 +14 -8 jbossmx/src/main/org/jboss/ha/ClusterPartition.java Index: ClusterPartition.java =================================================================== RCS file: /cvsroot/jboss/jbossmx/src/main/org/jboss/ha/ClusterPartition.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- ClusterPartition.java 2001/09/16 15:29:07 1.3 +++ ClusterPartition.java 2001/09/19 23:57:43 1.4 @@ -24,10 +24,11 @@ "UNICAST(timeout=5000;min_wait_time=2000):" + "FRAG:" + "pbcast.GMS:" + - "pbcast.STATE_TRANSFER(trace=true)"; + "pbcast.STATE_TRANSFER(trace=true):" + + "QUEUE"; protected HAPartitionImpl partition; protected boolean deadlock_detection = false; - + protected JChannel channel; public String getName() { @@ -70,21 +71,26 @@ return new ObjectName(OBJECT_NAME); } - public void startService() - throws Exception + public void initService() throws Exception { - log.info("Starting ClusterPartition: " + partitionName); - JChannel channel = new JChannel(jgProps); + this.channel = new JChannel(jgProps); channel.SetOpt(Channel.LOCAL, new Boolean(false)); channel.SetOpt(Channel.GET_STATE_EVENTS, new Boolean(true)); channel.SetOpt(Channel.AUTO_RECONNECT, new Boolean(true)); channel.SetOpt(Channel.AUTO_GETSTATE, new Boolean(true)); log.info("Creating Partition"); partition = new HAPartitionImpl(partitionName, channel, deadlock_detection); - log.info("Connecting to channel"); - channel.Connect(partitionName); log.info("Initing Partition"); partition.init(); + } + + public void startService() + throws Exception + { + log.info("Starting ClusterPartition: " + partitionName); + log.info("Connecting to channel"); + channel.Connect(partitionName); + partition.start(); log.info("Started ClusterPartition: " + partitionName); } public void stopService() _______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development