Package org.apache.catalina.tribes.membership

Examples of org.apache.catalina.tribes.membership.MemberImpl


        //check suspect members if they are still alive,
        //if not, simply issue the memberDisappeared message
        MemberImpl[] keys = removeSuspects.keySet().toArray(new MemberImpl[removeSuspects.size()]);
        for (int i = 0; i < keys.length; i++) {
            MemberImpl m = keys[i];
            if (membership.getMember(m) != null && (!memberAlive(m))) {
                membership.removeMember(m);
                super.memberDisappeared(m);
                removeSuspects.remove(m);
                if(log.isInfoEnabled())
                    log.info("Suspect member, confirmed dead.["+m+"]");
            } else {
                if (removeSuspectsTimeout > 0) {
                    long timeNow = System.currentTimeMillis();
                    int timeIdle = (int) ((timeNow - removeSuspects.get(m)) / 1000L);
                    if (timeIdle > removeSuspectsTimeout) {
                        removeSuspects.remove(m); // remove suspect member
                    }
                }
            }
        }

        //check add suspects members if they are alive now,
        //if they are, simply issue the memberAdded message
        keys = addSuspects.keySet().toArray(new MemberImpl[addSuspects.size()]);
        for (int i = 0; i < keys.length; i++) {
            MemberImpl m = keys[i];
            if ( membership.getMember(m) == null && (memberAlive(m))) {
                membership.memberAlive(m);
                super.memberAdded(m);
                addSuspects.remove(m);
                if(log.isInfoEnabled())
View Full Code Here


     * @param member The member to be found
     * @return The member, if it is found
     */
    public Member getMember(Member member) {
        if (hasMembers()) {
            MemberImpl result = null;
            for (int i = 0; i < this.members.size() && result == null; i++) {
                if (members.get(i).equals(member)) {
                    result = (MemberImpl) members.get(i);
                }
            }
View Full Code Here

        //check suspect members if they are still alive,
        //if not, simply issue the memberDisappeared message
        MemberImpl[] keys = removeSuspects.keySet().toArray(new MemberImpl[removeSuspects.size()]);
        for (int i = 0; i < keys.length; i++) {
            MemberImpl m = keys[i];
            if (membership.getMember(m) != null && (!memberAlive(m))) {
                membership.removeMember(m);
                super.memberDisappeared(m);
                removeSuspects.remove(m);
                if(log.isInfoEnabled())
                    log.info("Suspect member, confirmed dead.["+m+"]");
            } else {
                if (removeSuspectsTimeout > 0) {
                    long timeNow = System.currentTimeMillis();
                    int timeIdle = (int) ((timeNow - removeSuspects.get(m)) / 1000L);
                    if (timeIdle > removeSuspectsTimeout) {
                        removeSuspects.remove(m); // remove suspect member
                    }
                }
            }
        }

        //check add suspects members if they are alive now,
        //if they are, simply issue the memberAdded message
        keys = addSuspects.keySet().toArray(new MemberImpl[addSuspects.size()]);
        for (int i = 0; i < keys.length; i++) {
            MemberImpl m = keys[i];
            if ( membership.getMember(m) == null && (memberAlive(m))) {
                membership.memberAlive(m);
                super.memberAdded(m);
                addSuspects.remove(m);
                if(log.isInfoEnabled())
View Full Code Here

                System.out.println("Setting MessageDispatchInterceptor.maxQueueSize="+asyncsize);
            } else if ("-static".equals(args[i])) {
                String d = args[++i];
                String h = d.substring(0,d.indexOf(":"));
                String p = d.substring(h.length()+1);
                MemberImpl m = new MemberImpl(h,Integer.parseInt(p),2000);
                staticMembers.add(m);
            } else if ("-throughput".equals(args[i])) {
                throughput = true;
            } else if ("-order".equals(args[i])) {
                order = true;
View Full Code Here

        //check suspect members if they are still alive,
        //if not, simply issue the memberDisappeared message
        MemberImpl[] keys = removeSuspects.keySet().toArray(new MemberImpl[removeSuspects.size()]);
        for (int i = 0; i < keys.length; i++) {
            MemberImpl m = keys[i];
            if (membership.getMember(m) != null && (!memberAlive(m))) {
                membership.removeMember(m);
                super.memberDisappeared(m);
                removeSuspects.remove(m);
                if(log.isInfoEnabled())
                    log.info("Suspect member, confirmed dead.["+m+"]");
            } else {
                if (removeSuspectsTimeout > 0) {
                    long timeNow = System.currentTimeMillis();
                    int timeIdle = (int) ((timeNow - removeSuspects.get(m).longValue()) / 1000L);
                    if (timeIdle > removeSuspectsTimeout) {
                        removeSuspects.remove(m); // remove suspect member
                    }
                }
            }
        }

        //check add suspects members if they are alive now,
        //if they are, simply issue the memberAdded message
        keys = addSuspects.keySet().toArray(new MemberImpl[addSuspects.size()]);
        for (int i = 0; i < keys.length; i++) {
            MemberImpl m = keys[i];
            if ( membership.getMember(m) == null && (memberAlive(m))) {
                membership.memberAlive(m);
                super.memberAdded(m);
                addSuspects.remove(m);
                if(log.isInfoEnabled())
View Full Code Here

    byte[] payload = null;
    protected void setUp() throws Exception {
        super.setUp();
        payload = new byte[333];
        Arrays.fill(payload,(byte)1);
        m1 = new MemberImpl("localhost",3333,1,payload);
        m2 = new MemberImpl("localhost",3333,1);
        payload = new byte[333];
        Arrays.fill(payload,(byte)2);
        p1 = new MemberImpl("127.0.0.1",3333,1,payload);
        p2 = new MemberImpl("localhost",3331,1,payload);
        m1.setDomain(new byte[] {1,2,3,4,5,6,7,8,9});
        m2.setDomain(new byte[] {1,2,3,4,5,6,7,8,9});
        m1.setCommand(new byte[] {1,2,4,5,6,7,8,9});
        m2.setCommand(new byte[] {1,2,4,5,6,7,8,9});
    }
View Full Code Here

        assertFalse(m2.equals(p2));
        assertFalse(p1.equals(p2));
    }
   
    public void testSerializationOne() throws Exception {
        MemberImpl m = m1;
        byte[] md1 = m.getData(false,true);
        byte[] mda1 = m.getData(false,false);
        assertTrue(Arrays.equals(md1,mda1));
        assertTrue(md1==mda1);
        mda1 = m.getData(true,true);
        MemberImpl ma1 = MemberImpl.getMember(mda1);
        assertTrue(compareMembers(m,ma1));
        mda1 = p1.getData(false);
        assertFalse(Arrays.equals(md1,mda1));
        ma1 = MemberImpl.getMember(mda1);
        assertTrue(compareMembers(p1,ma1));
       
        md1 = m.getData(true,true);
        Thread.sleep(5);
        mda1 = m.getData(true,true);
        MemberImpl a1 = MemberImpl.getMember(md1);
        MemberImpl a2 = MemberImpl.getMember(mda1);
        assertTrue(a1.equals(a2));
        assertFalse(Arrays.equals(md1,mda1));
       
       
    }
View Full Code Here

public class SocketNioValidateSend {

    public static void main(String[] args) throws Exception {
        Selector selector = Selector.open();
        Member mbr = new MemberImpl("localhost", 9999, 0);
        byte seq = 0;
        byte[] buf = new byte[50000];
        Arrays.fill(buf,seq);
        int len = buf.length;
        BigDecimal total = new BigDecimal((double)0);
View Full Code Here

     * @param member The member to be found
     * @return The member, if it is found
     */
    public Member getMember(Member member) {
        if (hasMembers()) {
            MemberImpl result = null;
            for (int i = 0; i < this.members.size() && result == null; i++) {
                if (members.get(i).equals(member)) {
                    result = (MemberImpl) members.get(i);
                }
            }
View Full Code Here

                //check suspect members if they are still alive,
                //if not, simply issue the memberDisappeared message
                MemberImpl[] keys = (MemberImpl[]) removeSuspects.keySet().toArray(new MemberImpl[removeSuspects.size()]);
                for (int i = 0; i < keys.length; i++) {
                    MemberImpl m = (MemberImpl) keys[i];
                    if (membership.getMember(m) != null && (!memberAlive(m))) {
                        membership.removeMember(m);
                        super.memberDisappeared(m);
                        removeSuspects.remove(m);
                        log.info("Suspect member, confirmed dead.["+m+"]");
                    } //end if
                }

                //check add suspects members if they are alive now,
                //if they are, simply issue the memberAdded message
                keys = (MemberImpl[]) addSuspects.keySet().toArray(new MemberImpl[addSuspects.size()]);
                for (int i = 0; i < keys.length; i++) {
                    MemberImpl m = (MemberImpl) keys[i];
                    if ( membership.getMember(m) == null && (memberAlive(m))) {
                        membership.memberAlive(m);
                        super.memberAdded(m);
                        addSuspects.remove(m);
                        log.info("Suspect member, confirmed alive.["+m+"]");
View Full Code Here

TOP

Related Classes of org.apache.catalina.tribes.membership.MemberImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.