tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r408780 - in /tomcat/container/tc5.5.x/modules/groupcom: src/share/org/apache/catalina/tribes/group/interceptors/StaticMembershipInterceptor.java to-do.txt
Date Mon, 22 May 2006 23:02:55 GMT
Author: fhanik
Date: Mon May 22 16:02:55 2006
New Revision: 408780

URL: http://svn.apache.org/viewvc?rev=408780&view=rev
Log:
Added static membership interceptor, so that you can hard code your members.
Stuff the TcpFailureDetector on top of this, and you will get a true membership

Added:
    tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/StaticMembershipInterceptor.java
Modified:
    tomcat/container/tc5.5.x/modules/groupcom/to-do.txt

Added: tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/StaticMembershipInterceptor.java
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/StaticMembershipInterceptor.java?rev=408780&view=auto
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/StaticMembershipInterceptor.java
(added)
+++ tomcat/container/tc5.5.x/modules/groupcom/src/share/org/apache/catalina/tribes/group/interceptors/StaticMembershipInterceptor.java
Mon May 22 16:02:55 2006
@@ -0,0 +1,78 @@
+package org.apache.catalina.tribes.group.interceptors;
+
+import org.apache.catalina.tribes.group.ChannelInterceptorBase;
+import org.apache.catalina.tribes.Member;
+import java.util.ArrayList;
+import org.apache.catalina.tribes.group.AbsoluteOrder;
+
+public class StaticMembershipInterceptor
+    extends ChannelInterceptorBase {
+    protected ArrayList members = new ArrayList();
+    protected Member localMember = null;
+
+    public StaticMembershipInterceptor() {
+        super();
+    }
+
+    public void addStaticMember(Member member) {
+        synchronized (members) {
+            if (!members.contains(member)) members.add(member);
+        }
+    }
+
+    public void removeStaticMember(Member member) {
+        synchronized (members) {
+            if (members.contains(member)) members.remove(member);
+        }
+    }
+
+    public void setLocalMember(Member member) {
+        this.localMember = member;
+    }
+
+    /**
+     * has members
+     */
+    public boolean hasMembers() {
+        return super.hasMembers() || (members.size()>0);
+    }
+
+    /**
+     * Get all current cluster members
+     * @return all members or empty array
+     */
+    public Member[] getMembers() {
+        if ( members.size() == 0 ) return super.getMembers();
+        else {
+            synchronized (members) {
+                Member[] others = super.getMembers();
+                Member[] result = new Member[members.size() + others.length];
+                for (int i = 0; i < others.length; i++) result[i] = others[i];
+                for (int i = 0; i < members.size(); i++) result[i + others.length] = (Member)
members.get(i);
+                AbsoluteOrder.absoluteOrder(result);
+                return result;
+            }//sync
+        }//end if
+    }
+
+    /**
+     *
+     * @param mbr Member
+     * @return Member
+     */
+    public Member getMember(Member mbr) {
+        if ( members.contains(mbr) ) return (Member)members.get(members.indexOf(mbr));
+        else return super.getMember(mbr);
+    }
+
+    /**
+     * Return the member that represents this node.
+     *
+     * @return Member
+     */
+    public Member getLocalMember(boolean incAlive) {
+        if (this.localMember != null ) return localMember;
+        else return super.getLocalMember(incAlive);
+    }
+
+}
\ No newline at end of file

Modified: tomcat/container/tc5.5.x/modules/groupcom/to-do.txt
URL: http://svn.apache.org/viewvc/tomcat/container/tc5.5.x/modules/groupcom/to-do.txt?rev=408780&r1=408779&r2=408780&view=diff
==============================================================================
--- tomcat/container/tc5.5.x/modules/groupcom/to-do.txt (original)
+++ tomcat/container/tc5.5.x/modules/groupcom/to-do.txt Mon May 22 16:02:55 2006
@@ -66,9 +66,6 @@
 
 35. The ability to share one channel amongst multiple processes
 
-34. Configurable payload for the membership heartbeat, so that the app can decide what to
heartbeat.
-    such as JMX management port, ala Andy Piper's suggestion.
-
 32. Replicated JNDI entries in Tomcat in the format
     cluster:<map name>/<entry key> for example
     cluster:myapps/db/shared/dbinfo
@@ -100,9 +97,6 @@
 26. JNDIChannel - a way to bind the group channel in a JNDI tree, 
     so that shared resources can access it.
 
-25. Member.uniqueId - 16 bytes unique for a member, UUID
-    Needed to not confuse a crashed member with a revived member on the same port
-
 23. TotalOrderInterceptor - fairly straight forward implementation
     This interceptor would depend on the fact that there is some sort of 
     membership coordinator, see task 9.
@@ -131,14 +125,14 @@
       cons: the sequence can become overloaded, since it has to do all the trafficing
             the requesting member will not know if the message failed/succeeded
       OPTION C) Research papers on total order, better algorithms exist.
+      NOTES! THIS CANT BE DONE USING A SEQUENCER THAT SENDS THE MESSAGE SINCE WE
+      LOSE THE ABILITY TO REPORT FEEDBACK
 
 21. Implement a WAN membership layer, using a WANMbrInterceptor and a 
     WAN Router/Forwarder (Tipi on top of a ManagedChannel)
 
 20. Implement a TCP membership interceptor, for guaranteed functionality, not just discovery
 
-19. Implement a hardcoded tcp membership
-
 18. Implement SSL encryption over message transfers, BIO and NIO
 
 8. WaitForCompletionInterceptor - waits for the message to get processed by all receivers
before returning
@@ -146,8 +140,6 @@
    parallel processing, but you want to have all messages sent in parallel and
    don't return until all have been processed on the remote end.)
 
-10. Xa2PhaseCommitInterceptor - make sure the message doesn't reach the receiver unless all
members got it
-
 11. Code a ReplicatedFileSystem example, package org.apache.catalina.tipis
 
 13. StateTransfer interceptor
@@ -162,11 +154,6 @@
     
 14. Keepalive count and idle kill off for Nio senders
 
-16. Guaranteed delivery of messages, ie either all get it or none get it.
-    Meaning, that all receivers get it, then wait for a process command.
-    ala Gossip protocol - this is fairly redundant with a Xa2PhaseCommitInterceptor
-    except it doesn't keep a transaction log.
-
 17. Implement transactions - the ability to start a transaction, send several messages,
                              and then commit the transaction
 
@@ -292,4 +279,27 @@
 Notes: Completed
 
 33. TcpFailureDetector, when a member is reported missing, first check TCP path too.
+Notes: Completed
+
+34. Configurable payload for the membership heartbeat, so that the app can decide what to
heartbeat.
+    such as JMX management port, ala Andy Piper's suggestion.
+Notes: Completed
+
+49. Make sure that membership is established before the start process returns.
+Notes: Completed
+
+16. Guaranteed delivery of messages, ie either all get it or none get it.
+    Meaning, that all receivers get it, then wait for a process command.
+    ala Gossip protocol - this is fairly redundant with a Xa2PhaseCommitInterceptor
+    except it doesn't keep a transaction log.
+Notes: Completed in another task    
+
+10. Xa2PhaseCommitInterceptor - make sure the message doesn't reach the receiver unless all
members got it
+Notes: Completed
+
+25. Member.uniqueId - 16 bytes unique for a member, UUID
+    Needed to not confuse a crashed member with a revived member on the same port
+Notes: Completed
+
+19. Implement a hardcoded tcp membership
 Notes: Completed



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message