User: patriot1burke
  Date: 02/02/04 13:26:48

  Modified:    src/main/org/jboss/ha/framework/server ClusterPartition.java
                        HAPartitionImpl.java
  Log:
  JavaGroups 2.0
  
  Revision  Changes    Path
  1.11      +26 -11    
jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartition.java
  
  Index: ClusterPartition.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/server/ClusterPartition.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ClusterPartition.java     2001/12/31 20:41:17     1.10
  +++ ClusterPartition.java     2002/02/04 21:26:48     1.11
  @@ -13,7 +13,7 @@
   
   import javax.management.ObjectName;
   
  -import JavaGroups.Channel;
  +import org.javagroups.Channel;
   
   import org.jboss.system.ServiceMBeanSupport;
   
  @@ -23,7 +23,7 @@
    *
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Bill Burke</a>.
    *   @author <a href="mailto:[EMAIL PROTECTED]";>Sacha Labourey</a>.
  - *   @version $Revision: 1.10 $
  + *   @version $Revision: 1.11 $
    *
    * <p><b>Revisions:</b><br>
    */
  @@ -40,6 +40,20 @@
      protected String jgProps = 
          "UDP:" +
          "PING:" +
  +       "FD(timeout=5000):" +
  +       "VERIFY_SUSPECT(timeout=1500):" +
  +       "MERGE:" + 
  +       "NAKACK:" +
  +       "UNICAST(timeout=5000;min_wait_time=2000):" +
  +       "FRAG:" +
  +       "FLUSH:" +
  +       "GMS:" +
  +       "STATE_TRANSFER:" +
  +       "QUEUE";
  +   /*
  +   protected String jgProps = 
  +       "UDP:" +
  +       "PING:" +
          "FD(trace=true;timeout=5000):" +
          "VERIFY_SUSPECT(trace=false;timeout=1500):" +
          "MERGE:" + 
  @@ -50,9 +64,10 @@
          "GMS:" +
          "STATE_TRANSFER(trace=true):" +
          "QUEUE";
  +   */
      protected HAPartitionImpl partition;
      protected boolean deadlock_detection = false;
  -   protected JavaGroups.JChannel channel;
  +   protected org.javagroups.JChannel channel;
      
      // Static --------------------------------------------------------
      
  @@ -114,11 +129,11 @@
         throws Exception
      {
         log.info ("Creating JavaGroups JChannel");
  -      this.channel = new JavaGroups.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));
  +      this.channel = new org.javagroups.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 HAPartition...");
         partition = new HAPartitionImpl(partitionName, channel, deadlock_detection, 
getServer());
  @@ -134,10 +149,10 @@
         log.info("Starting ClusterPartition: " + partitionName);
         
         log.info(" Connecting to channel");
  -      channel.Connect(partitionName);
  +      channel.connect(partitionName);
         
         log.info(" Starting channel");
  -      partition.start();
  +      partition.startPartition();
         
         log.info("Started ClusterPartition: " + partitionName);
      }
  @@ -147,7 +162,7 @@
         try
         {
            log.info("Stopping HAPartition: " + partitionName);
  -         partition.close();
  +         partition.closePartition();
            log.info("Stopped HAPartition: " + partitionName);
         }
         catch (Exception e)
  
  
  
  1.15      +65 -65    
jbossmx/src/main/org/jboss/ha/framework/server/HAPartitionImpl.java
  
  Index: HAPartitionImpl.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jbossmx/src/main/org/jboss/ha/framework/server/HAPartitionImpl.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- HAPartitionImpl.java      2002/01/12 16:53:38     1.14
  +++ HAPartitionImpl.java      2002/02/04 21:26:48     1.15
  @@ -16,7 +16,7 @@
   import javax.naming.InitialContext;
   import javax.management.MBeanServer;
   
  -import JavaGroups.MethodCall;
  +import org.javagroups.blocks.MethodCall;
   
   import org.jboss.ha.framework.interfaces.DistributedReplicantManager;
   import org.jboss.ha.framework.interfaces.DistributedState;
  @@ -33,18 +33,18 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sacha Labourey</a>.
    * @author <a href="mailto:[EMAIL PROTECTED]";>Bill Burke</a>.
  - * @version $Revision: 1.14 $
  + * @version $Revision: 1.15 $
    *
    * <p><b>Revisions:</b><br>
    */
   
   public class HAPartitionImpl 
  -   extends JavaGroups.RpcDispatcher 
  -   implements JavaGroups.MessageListener, JavaGroups.MembershipListener, HAPartition
  +   extends org.javagroups.blocks.RpcDispatcher 
  +   implements org.javagroups.MessageListener, org.javagroups.MembershipListener, 
HAPartition
   {
      // Constants -----------------------------------------------------
      
  -   final JavaGroups.MethodLookup method_lookup_clos=new 
JavaGroups.MethodLookupClos();
  +   final org.javagroups.blocks.MethodLookup method_lookup_clos=new 
org.javagroups.blocks.MethodLookupClos();
      
      // Attributes ----------------------------------------------------
      
  @@ -57,7 +57,7 @@
      protected String nodeName;
      protected int timeout = 500;
      
  -   protected JavaGroups.JChannel channel = null;
  +   protected org.javagroups.JChannel channel = null;
      
      protected DistributedReplicantManagerImpl replicantManager = null;
      protected DistributedStateImpl dsManager = null;
  @@ -72,13 +72,13 @@
      
      // Constructors --------------------------------------------------
          
  -   public HAPartitionImpl(String partitionName, JavaGroups.JChannel channel, 
boolean deadlock_detection, MBeanServer server) throws Exception
  +   public HAPartitionImpl(String partitionName, org.javagroups.JChannel channel, 
boolean deadlock_detection, MBeanServer server) throws Exception
      {
         this(partitionName, channel, deadlock_detection);
         this.server = server;
      }
      
  -   public HAPartitionImpl(String partitionName, JavaGroups.JChannel channel, 
boolean deadlock_detection) throws Exception
  +   public HAPartitionImpl(String partitionName, org.javagroups.JChannel channel, 
boolean deadlock_detection) throws Exception
      {
         super(channel, null, null, new Object(), false); // init RpcDispatcher with a 
fake target object
         this.log = Logger.getLogger("HAPartition:" + partitionName);
  @@ -90,12 +90,12 @@
      
      public void init() throws Exception
      {
  -      // Subscribe to dHA events comming generated by the JavaGroups protocol stack
  +      // Subscribe to dHA events comming generated by the org.javagroups. protocol 
stack
         //
  -      log.debug("SetMembershipListener");
  -      SetMembershipListener(this);
  -      log.debug("SetMessageListener");
  -      SetMessageListener(this);
  +      log.debug("setMembershipListener");
  +      setMembershipListener(this);
  +      log.debug("setMessageListener");
  +      setMessageListener(this);
         
         // Create the DRM and link it to this HAPartition
         //
  @@ -119,27 +119,27 @@
         Context ctx = new InitialContext();
         this.bind("/HAPartition/" + partitionName, this, HAPartitionImpl.class, ctx);
         
  -      log.info("done initing..");
  +      log.info("done initing.");
      }
      
  -   public void start() throws Exception
  +   public void startPartition() throws Exception
      {
         // get current JG group properties
         //
         log.debug("get nodeName");
  -      this.nodeName = channel.GetLocalAddress().toString();
  +      this.nodeName = channel.getLocalAddress().toString();
         log.debug("Get current members");
  -      JavaGroups.View view = channel.GetView();
  -      this.members = (Vector)view.GetMembers().clone();
  +      org.javagroups.View view = channel.getView();
  +      this.members = (Vector)view.getMembers().clone();
         log.info("Num cluster members: " + members.size());
         
         // Update the initial view id
         //
  -      this.currentViewId = view.GetVid().GetId();
  +      this.currentViewId = view.getVid().getId();
   
         // We must now syncrhonize new state transfer subscriber
         //
  -      boolean rc = channel.GetState(null, 8000);
  +      boolean rc = channel.getState(null, 8000);
         if (rc)
            log.info("State was retrieved successfully");
         else
  @@ -151,7 +151,7 @@
         this.dsManager.start();
      }
      
  -   public void close() throws Exception
  +   public void closePartition() throws Exception
      {
         log.info("Closing partition " + partitionName);
         // Stop the DRM and DS services
  @@ -159,19 +159,19 @@
         try {this.replicantManager.stop();} catch (Exception printed) 
{printed.printStackTrace ();}
         try {this.dsManager.stop();} catch (Exception printed) 
{printed.printStackTrace();}
         
  -      try {channel.Close();} catch (Exception printed) {printed.printStackTrace();}
  +      try {channel.close();} catch (Exception printed) {printed.printStackTrace();}
         
         new InitialContext().unbind("/HAPartition/" + partitionName);
         log.info("Partition " + partitionName + " closed.");
      }
      
  -   // JavaGroups.MessageListener implementation 
----------------------------------------------
  +   // org.javagroups.MessageListener implementation 
----------------------------------------------
   
      // MessageListener methods
      //
  -   public Object GetState()
  +   public Object getState()
      {
  -      log.info("GetState called.");
  +      log.info("getState called.");
         try
         {
            // we now get the sub-state of each HAPartitionStateTransfer subscribers 
and
  @@ -184,7 +184,7 @@
               String key = (String)keys.next();
               HAPartition.HAPartitionStateTransfer subscriber = 
(HAPartition.HAPartitionStateTransfer)stateHandlers.get(key);
               if (log.isDebugEnabled())
  -               log.debug("GetState for " + key);
  +               log.debug("getState for " + key);
               state.put(key, subscriber.getCurrentState());
            }
            return state;
  @@ -196,11 +196,11 @@
         return null;
      }
      
  -   public void SetState(Object obj)
  +   public void setState(Object obj)
      {
         try
         {
  -         log.info("SetState called");
  +         log.info("setState called");
            if (obj == null)
            {
               log.info("state is null");
  @@ -212,7 +212,7 @@
            while (keys.hasNext())
            {
               String key = (String)keys.next();
  -            log.info("SetState for " + key);
  +            log.info("setState for " + key);
               Object someState = state.get(key);
               HAPartition.HAPartitionStateTransfer subscriber = 
(HAPartition.HAPartitionStateTransfer)stateHandlers.get(key);
               if (subscriber != null)
  @@ -227,38 +227,38 @@
         }
         catch (Exception ex)
         {
  -         log.error("SetState failed", ex);
  +         log.error("setState failed", ex);
         }
      }
      
  -   public void Receive(JavaGroups.Message msg)
  +   public void receive(org.javagroups.Message msg)
      { /* complete */}
      
  -   // JavaGroups.MembershipListener implementation 
----------------------------------------------
  +   // org.javagroups.MembershipListener implementation 
----------------------------------------------
      
  -   public void Suspect(JavaGroups.Address suspected_mbr) { log.info("Suspected 
member: " + suspected_mbr); /* complete */  }
  +   public void suspect(org.javagroups.Address suspected_mbr) { log.info("Suspected 
member: " + suspected_mbr); /* complete */  }
      
  -   public void Block() {}
  +   public void block() {}
      
  -   public void ViewAccepted(JavaGroups.View newView)
  +   public void viewAccepted(org.javagroups.View newView)
      {
         try
         {
            // we update the view id
            //
  -         this.currentViewId = newView.GetVid().GetId();
  -         log.info("new view accepted: " + currentViewId + " (" + newView.GetMembers 
() + ")");
  +         this.currentViewId = newView.getVid().getId();
  +         log.info("new view accepted: " + currentViewId + " (" + newView.getMembers 
() + ")");
            
            if (this.members == null)
            {
               // Initial viewAccepted
               //
  -            this.members = (Vector)newView.GetMembers().clone();
  +            this.members = (Vector)newView.getMembers().clone();
               log.info("ViewAccepted: initial members set");
               return;
            }
            Vector oldMembers = this.members;
  -         Vector allMembers = newView.GetMembers();
  +         Vector allMembers = newView.getMembers();
            log.info("membership changed from " + this.members.size() + " to " + 
allMembers.size());
            Vector deadMembers = getDeadMembers(oldMembers, allMembers);
            Vector newMembers = getNewMembers(oldMembers, allMembers);
  @@ -345,15 +345,15 @@
      {
         ArrayList rtn = new ArrayList();
         MethodCall m = new MethodCall(objName + "." + methodName, args);
  -      JavaGroups.RspList rsp = this.CallRemoteMethods(null, m, 
JavaGroups.GroupRequest.GET_ALL, timeout);
  +      org.javagroups.util.RspList rsp = this.callRemoteMethods(null, m, 
org.javagroups.blocks.GroupRequest.GET_ALL, timeout);
         if (rsp != null)
         {
            for (int i = 0; i < rsp.size(); i++)
            {
               Object item = rsp.elementAt(i);
  -            if (item instanceof JavaGroups.Rsp)
  +            if (item instanceof org.javagroups.util.Rsp)
               {
  -               item = ((JavaGroups.Rsp)item).GetValue();
  +               item = ((org.javagroups.util.Rsp)item).getValue();
               }
               rtn.add(item);
            }
  @@ -361,9 +361,9 @@
         
         if (!excludeSelf)
         {
  -         m.SetName (methodName);
  -         Object handler = rpcHandlers.get (objName);
  -         Object retval=m.Invoke (handler, method_lookup_clos);
  +         m.setName(methodName);
  +         Object handler = rpcHandlers.get(objName);
  +         Object retval=m.invoke(handler, method_lookup_clos);
            if (retval != null) rtn.add (retval);
         }
         return rtn;
  @@ -375,13 +375,13 @@
      public void callAsynchMethodOnCluster(String objName, String methodName, 
Object[] args, boolean excludeSelf) throws Exception
      {
         MethodCall m = new MethodCall(objName + "." + methodName, args);
  -      this.CallRemoteMethods(null, m, JavaGroups.GroupRequest.GET_NONE, timeout);
  +      this.callRemoteMethods(null, m, org.javagroups.blocks.GroupRequest.GET_NONE, 
timeout);
   
         if (!excludeSelf)
         {
  -         m.SetName(methodName);
  +         m.setName(methodName);
            Object handler = rpcHandlers.get(objName);
  -         m.Invoke(handler, method_lookup_clos);
  +         m.invoke(handler, method_lookup_clos);
         }
      }
      
  @@ -423,23 +423,23 @@
         }
      }
      
  -   // JavaGroups.RpcDispatcher overrides 
---------------------------------------------------
  +   // org.javagroups.RpcDispatcher overrides 
---------------------------------------------------
      
      /**
       * Message contains MethodCall. Execute it against *this* object and return 
result.
       * Use MethodCall.Invoke() to do this. Return result.
       *
       * This overrides RpcDispatcher.Handle so that we can dispatch to many different 
objects.
  -    * @param req The JavaGroups representation of the method invocation
  +    * @param req The org.javagroups. representation of the method invocation
       * @return The serializable return value from the invocation
       */
  -   public Object Handle(JavaGroups.Message req)
  +   public Object handle(org.javagroups.Message req)
      {
         Object body = null;
         Object retval = null;
         MethodCall  method_call = null;
         
  -      if(req == null || req.GetBuffer() == null)
  +      if(req == null || req.getBuffer() == null)
         {
            log.warn("RpcProtocol.Handle(): message or message buffer is null !");
            return null;
  @@ -447,7 +447,7 @@
         
         try
         {
  -         body=JavaGroups.Util.ObjectFromByteBuffer(req.GetBuffer());
  +         body=org.javagroups.util.Util.objectFromByteBuffer(req.getBuffer());
         }
         catch(Exception e)
         {
  @@ -464,7 +464,7 @@
         // get method call informations
         //
         method_call=(MethodCall)body;
  -      String methodName = method_call.GetName();      
  +      String methodName = method_call.getName();      
         int idx = methodName.indexOf('.');
         String handlerName = methodName.substring(0, idx);
         String newMethodName = methodName.substring(idx + 1);
  @@ -472,12 +472,12 @@
         
         // prepare method call
         //
  -      method_call.SetName(newMethodName);
  +      method_call.setName(newMethodName);
         Object handler = rpcHandlers.get(handlerName);
         
         // Invoke it
         //
  -      retval=method_call.Invoke(handler, method_lookup_clos);
  +      retval=method_call.invoke(handler, method_lookup_clos);
         
         return retval;
      }
  @@ -518,8 +518,8 @@
         // The helper class NonSerializableFactory uses address type nns, we go on to
         // use the helper class to bind the service object in JNDI
         //
  -      StringRefAddr addr = new StringRefAddr ("nns", jndiName);
  -      javax.naming.Reference ref = new javax.naming.Reference ( classType.getName 
(), addr, NonSerializableFactory.class.getName (), null);
  +      StringRefAddr addr = new StringRefAddr("nns", jndiName);
  +      javax.naming.Reference ref = new javax.naming.Reference(classType.getName (), 
addr, NonSerializableFactory.class.getName (), null);
         ctx.rebind (n.get (0), ref);
      }
      
  @@ -529,16 +529,16 @@
       * @param newMembers Vector of new members
       * @return Vector of members that have died between the two views
       */   
  -   protected Vector getDeadMembers (Vector oldMembers, Vector newMembers)
  +   protected Vector getDeadMembers(Vector oldMembers, Vector newMembers)
      {
  -      Vector dead = new Vector ();
  +      Vector dead = new Vector();
         for (int i=0; i<oldMembers.size ();i++)
         {
            log.info("is node " + oldMembers.elementAt(i).toString() + "dead?");
  -         if (!newMembers.contains (oldMembers.elementAt (i)))
  +         if (!newMembers.contains(oldMembers.elementAt (i)))
            {
               log.info("node " + oldMembers.elementAt(i).toString()  + "is dead");
  -            dead.add (oldMembers.elementAt (i));
  +            dead.add(oldMembers.elementAt (i));
            }
            else
            {
  @@ -555,10 +555,10 @@
       * @param allMembers Vector of new members
       * @return Vector of members that have joined the partition between the two views
       */   
  -   protected Vector getNewMembers (Vector oldMembers, Vector allMembers)
  +   protected Vector getNewMembers(Vector oldMembers, Vector allMembers)
      {
  -      Vector newMembers = new Vector ();
  -      for (int i=0; i<allMembers.size ();i++)
  +      Vector newMembers = new Vector();
  +      for (int i=0; i<allMembers.size();i++)
            if (!oldMembers.contains (allMembers.elementAt (i)))
               newMembers.add (allMembers.elementAt (i));
         return newMembers;
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to