org.apache.catalina.tribes.ChannelInterceptor Java Examples

The following examples show how to use org.apache.catalina.tribes.ChannelInterceptor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GroupChannel.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
/**
 * Adds an interceptor to the stack for message processing<br>
 * Interceptors are ordered in the way they are added.<br>
 * <code>channel.addInterceptor(A);</code><br>
 * <code>channel.addInterceptor(C);</code><br>
 * <code>channel.addInterceptor(B);</code><br>
 * Will result in a interceptor stack like this:<br>
 * <code>A -> C -> B</code><br>
 * The complete stack will look like this:<br>
 * <code>Channel -> A -> C -> B -> ChannelCoordinator</code><br>
 * @param interceptor ChannelInterceptorBase
 */
@Override
public void addInterceptor(ChannelInterceptor interceptor) {
    if ( interceptors == null ) {
        interceptors = interceptor;
        interceptors.setNext(coordinator);
        interceptors.setPrevious(null);
        coordinator.setPrevious(interceptors);
    } else {
        ChannelInterceptor last = interceptors;
        while ( last.getNext() != coordinator ) {
            last = last.getNext();
        }
        last.setNext(interceptor);
        interceptor.setNext(coordinator);
        interceptor.setPrevious(last);
        coordinator.setPrevious(interceptor);
    }
}
 
Example #2
Source File: TestGroupChannelOptionFlag.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Test
public void testOptionNoConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(64);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(256);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    Assert.assertFalse(error);
}
 
Example #3
Source File: TestGroupChannelOptionFlag.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Test
public void testOptionConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    Assert.assertTrue(error);
}
 
Example #4
Source File: GroupChannel.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
/**
 * Adds an interceptor to the stack for message processing<br>
 * Interceptors are ordered in the way they are added.<br>
 * <code>channel.addInterceptor(A);</code><br>
 * <code>channel.addInterceptor(C);</code><br>
 * <code>channel.addInterceptor(B);</code><br>
 * Will result in a interceptor stack like this:<br>
 * <code>A -> C -> B</code><br>
 * The complete stack will look like this:<br>
 * <code>Channel -> A -> C -> B -> ChannelCoordinator</code><br>
 * @param interceptor ChannelInterceptorBase
 */
@Override
public void addInterceptor(ChannelInterceptor interceptor) {
    if ( interceptors == null ) {
        interceptors = interceptor;
        interceptors.setNext(coordinator);
        interceptors.setPrevious(null);
        coordinator.setPrevious(interceptors);
    } else {
        ChannelInterceptor last = interceptors;
        while ( last.getNext() != coordinator ) {
            last = last.getNext();
        }
        last.setNext(interceptor);
        interceptor.setNext(coordinator);
        interceptor.setPrevious(last);
        coordinator.setPrevious(interceptor);
    }
}
 
Example #5
Source File: TcpPingInterceptor.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized void start(int svc) throws ChannelException {
    super.start(svc);
    running = true;
    if ( thread == null && useThread) {
        thread = new PingThread();
        thread.setDaemon(true);
        thread.setName("TcpPingInterceptor.PingThread-"+cnt.addAndGet(1));
        thread.start();
    }
    
    //acquire the interceptors to invoke on send ping events
    ChannelInterceptor next = getNext();
    while ( next != null ) {
        if ( next instanceof TcpFailureDetector ) 
            failureDetector = new WeakReference<TcpFailureDetector>((TcpFailureDetector)next);
        if ( next instanceof StaticMembershipInterceptor ) 
            staticMembers = new WeakReference<StaticMembershipInterceptor>((StaticMembershipInterceptor)next);
        next = next.getNext();
    }
    
}
 
Example #6
Source File: TcpPingInterceptor.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
@Override
public synchronized void start(int svc) throws ChannelException {
    super.start(svc);
    running = true;
    if ( thread == null && useThread) {
        thread = new PingThread();
        thread.setDaemon(true);
        String channelName = "";
        if (getChannel().getName() != null) channelName = "[" + getChannel().getName() + "]";
        thread.setName("TcpPingInterceptor.PingThread" + channelName +"-"+cnt.addAndGet(1));
        thread.start();
    }

    //acquire the interceptors to invoke on send ping events
    ChannelInterceptor next = getNext();
    while ( next != null ) {
        if ( next instanceof TcpFailureDetector )
            failureDetector = new WeakReference<>((TcpFailureDetector)next);
        if ( next instanceof StaticMembershipInterceptor )
            staticMembers = new WeakReference<>((StaticMembershipInterceptor)next);
        next = next.getNext();
    }

}
 
Example #7
Source File: TestGroupChannelOptionFlag.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Test
public void testOptionConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    assertTrue(error);
}
 
Example #8
Source File: TestGroupChannelOptionFlag.java    From Tomcat7.0.67 with Apache License 2.0 6 votes vote down vote up
@Test
public void testOptionNoConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(64);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(256);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    assertFalse(error);
}
 
Example #9
Source File: TcpPingInterceptor.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Override
public synchronized void start(int svc) throws ChannelException {
    super.start(svc);
    running = true;
    if ( thread == null && useThread) {
        thread = new PingThread();
        thread.setDaemon(true);
        String channelName = "";
        if (getChannel() instanceof GroupChannel && ((GroupChannel)getChannel()).getName() != null) {
            channelName = "[" + ((GroupChannel)getChannel()).getName() + "]";
        }
        thread.setName("TcpPingInterceptor.PingThread" + channelName +"-"+cnt.addAndGet(1));
        thread.start();
    }
    
    //acquire the interceptors to invoke on send ping events
    ChannelInterceptor next = getNext();
    while ( next != null ) {
        if ( next instanceof TcpFailureDetector ) 
            failureDetector = new WeakReference<TcpFailureDetector>((TcpFailureDetector)next);
        if ( next instanceof StaticMembershipInterceptor ) 
            staticMembers = new WeakReference<StaticMembershipInterceptor>((StaticMembershipInterceptor)next);
        next = next.getNext();
    }
    
}
 
Example #10
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 6 votes vote down vote up
/**
 * Adds an interceptor to the stack for message processing<br>
 * Interceptors are ordered in the way they are added.<br>
 * <code>channel.addInterceptor(A);</code><br>
 * <code>channel.addInterceptor(C);</code><br>
 * <code>channel.addInterceptor(B);</code><br>
 * Will result in an interceptor stack like this:<br>
 * <code>A -&gt; C -&gt; B</code><br>
 * The complete stack will look like this:<br>
 * <code>Channel -&gt; A -&gt; C -&gt; B -&gt; ChannelCoordinator</code><br>
 * @param interceptor ChannelInterceptorBase
 */
@Override
public void addInterceptor(ChannelInterceptor interceptor) {
    if ( interceptors == null ) {
        interceptors = interceptor;
        interceptors.setNext(coordinator);
        interceptors.setPrevious(null);
        coordinator.setPrevious(interceptors);
    } else {
        ChannelInterceptor last = interceptors;
        while ( last.getNext() != coordinator ) {
            last = last.getNext();
        }
        last.setNext(interceptor);
        interceptor.setNext(coordinator);
        interceptor.setPrevious(last);
        coordinator.setPrevious(interceptor);
    }
}
 
Example #11
Source File: TestGroupChannelOptionFlag.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Test
public void testOptionConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    assertTrue(error);
}
 
Example #12
Source File: TestGroupChannelOptionFlag.java    From tomcatsrc with Apache License 2.0 6 votes vote down vote up
@Test
public void testOptionNoConflict() throws Exception {
    boolean error = false;
    channel.setOptionCheck(true);
    ChannelInterceptor i = new TestInterceptor();
    i.setOptionFlag(128);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(64);
    channel.addInterceptor(i);
    i = new TestInterceptor();
    i.setOptionFlag(256);
    channel.addInterceptor(i);
    try {
        channel.start(Channel.DEFAULT);
    }catch ( ChannelException x ) {
        if ( x.getMessage().indexOf("option flag conflict") >= 0 ) error = true;
    }
    assertFalse(error);
}
 
Example #13
Source File: GroupChannel.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
@Override
public ChannelInterceptor next() {
    ChannelInterceptor result = null;
    if ( hasNext() ) {
        result = start;
        start = start.getNext();
    }
    return result;
}
 
Example #14
Source File: GroupChannel.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Validates the option flags that each interceptor is using and reports
 * an error if two interceptor share the same flag.
 * @throws ChannelException
 */
protected void checkOptionFlags() throws ChannelException {
    StringBuilder conflicts = new StringBuilder();
    ChannelInterceptor first = interceptors;
    while ( first != null ) {
        int flag = first.getOptionFlag();
        if ( flag != 0 ) {
            ChannelInterceptor next = first.getNext();
            while ( next != null ) {
                int nflag = next.getOptionFlag();
                if (nflag!=0 && (((flag & nflag) == flag ) || ((flag & nflag) == nflag)) ) {
                    conflicts.append("[");
                    conflicts.append(first.getClass().getName());
                    conflicts.append(":");
                    conflicts.append(flag);
                    conflicts.append(" == ");
                    conflicts.append(next.getClass().getName());
                    conflicts.append(":");
                    conflicts.append(nflag);
                    conflicts.append("] ");
                }//end if
                next = next.getNext();
            }//while
        }//end if
        first = first.getNext();
    }//while
    if ( conflicts.length() > 0 ) throw new ChannelException("Interceptor option flag conflict: "+conflicts.toString());

}
 
Example #15
Source File: GroupChannel.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Validates the option flags that each interceptor is using and reports
 * an error if two interceptor share the same flag.
 * @throws ChannelException
 */
protected void checkOptionFlags() throws ChannelException {
    StringBuilder conflicts = new StringBuilder();
    ChannelInterceptor first = interceptors;
    while ( first != null ) {
        int flag = first.getOptionFlag();
        if ( flag != 0 ) {
            ChannelInterceptor next = first.getNext();
            while ( next != null ) {
                int nflag = next.getOptionFlag();
                if (nflag!=0 && (((flag & nflag) == flag ) || ((flag & nflag) == nflag)) ) {
                    conflicts.append("[");
                    conflicts.append(first.getClass().getName());
                    conflicts.append(":");
                    conflicts.append(flag);
                    conflicts.append(" == ");
                    conflicts.append(next.getClass().getName());
                    conflicts.append(":");
                    conflicts.append(nflag);
                    conflicts.append("] ");
                }//end if
                next = next.getNext();
            }//while
        }//end if
        first = first.getNext();
    }//while
    if ( conflicts.length() > 0 ) throw new ChannelException("Interceptor option flag conflict: "+conflicts.toString());

}
 
Example #16
Source File: NonBlockingCoordinator.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
public CoordinationEvent(int type,ChannelInterceptor interceptor, String info) {
    this.type = type;
    this.interceptor = interceptor;
    this.coord = ((NonBlockingCoordinator)interceptor).getCoordinator();
    this.mbrs = ((NonBlockingCoordinator)interceptor).membership.getMembers();
    this.info = info;
    this.view = ((NonBlockingCoordinator)interceptor).view;
    this.suggestedView = ((NonBlockingCoordinator)interceptor).suggestedView;
}
 
Example #17
Source File: StaticMembershipInterceptor.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * Send notifications upwards
 * @param svc int
 * @throws ChannelException
 */
@Override
public void start(int svc) throws ChannelException {
    if ( (Channel.SND_RX_SEQ&svc)==Channel.SND_RX_SEQ ) super.start(Channel.SND_RX_SEQ); 
    if ( (Channel.SND_TX_SEQ&svc)==Channel.SND_TX_SEQ ) super.start(Channel.SND_TX_SEQ); 
    final Member[] mbrs = members.toArray(new Member[members.size()]);
    final ChannelInterceptorBase base = this;
    Thread t = new Thread() {
        @Override
        public void run() {
            for (int i=0; i<mbrs.length; i++ ) {
                base.memberAdded(mbrs[i]);
            }
        }
    };
    t.start();
    super.start(svc & (~Channel.SND_RX_SEQ) & (~Channel.SND_TX_SEQ));

    // check required interceptors
    TcpFailureDetector failureDetector = null;
    TcpPingInterceptor pingInterceptor = null;
    ChannelInterceptor prev = getPrevious();
    while (prev != null) {
        if (prev instanceof TcpFailureDetector ) failureDetector = (TcpFailureDetector) prev;
        if (prev instanceof TcpPingInterceptor) pingInterceptor = (TcpPingInterceptor) prev;
        prev = prev.getPrevious();
    }
    if (failureDetector == null) {
        log.warn("There is no TcpFailureDetector. Automatic detection of static members does"
                + " not work properly. By defining the StaticMembershipInterceptor under the"
                + " TcpFailureDetector, automatic detection of the static members will work.");
    }
    if (pingInterceptor == null) {
        log.warn("There is no TcpPingInterceptor. The health check of static member does"
                + " not work properly. By defining the TcpPingInterceptor, the health check of"
                + " static member will work.");
    }
}
 
Example #18
Source File: StaticMembershipInterceptor.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * Send notifications upwards
 * @param svc int
 * @throws ChannelException
 */
@Override
public void start(int svc) throws ChannelException {
    if ( (Channel.SND_RX_SEQ&svc)==Channel.SND_RX_SEQ ) super.start(Channel.SND_RX_SEQ); 
    if ( (Channel.SND_TX_SEQ&svc)==Channel.SND_TX_SEQ ) super.start(Channel.SND_TX_SEQ); 
    final ChannelInterceptorBase base = this;
    for (final Member member : members) {
        Thread t = new Thread() {
            @Override
            public void run() {
                base.memberAdded(member);
                if (getfirstInterceptor().getMember(member) != null) {
                    sendLocalMember(new Member[]{member});
                }
            }
        };
        t.start();
    }
    super.start(svc & (~Channel.SND_RX_SEQ) & (~Channel.SND_TX_SEQ));

    // check required interceptors
    TcpFailureDetector failureDetector = null;
    TcpPingInterceptor pingInterceptor = null;
    ChannelInterceptor prev = getPrevious();
    while (prev != null) {
        if (prev instanceof TcpFailureDetector ) failureDetector = (TcpFailureDetector) prev;
        if (prev instanceof TcpPingInterceptor) pingInterceptor = (TcpPingInterceptor) prev;
        prev = prev.getPrevious();
    }
    if (failureDetector == null) {
        log.warn("There is no TcpFailureDetector. Automatic detection of static members does"
                + " not work properly. By defining the StaticMembershipInterceptor under the"
                + " TcpFailureDetector, automatic detection of the static members will work.");
    }
    if (pingInterceptor == null) {
        log.warn("There is no TcpPingInterceptor. The health check of static member does"
                + " not work properly. By defining the TcpPingInterceptor, the health check of"
                + " static member will work.");
    }
}
 
Example #19
Source File: NonBlockingCoordinator.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
public CoordinationEvent(int type,ChannelInterceptor interceptor, String info) {
    this.type = type;
    this.interceptor = interceptor;
    this.coord = ((NonBlockingCoordinator)interceptor).getCoordinator();
    this.mbrs = ((NonBlockingCoordinator)interceptor).membership.getMembers();
    this.info = info;
    this.view = ((NonBlockingCoordinator)interceptor).view;
    this.suggestedView = ((NonBlockingCoordinator)interceptor).suggestedView;
}
 
Example #20
Source File: GroupChannel.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
@Override
public ChannelInterceptor next() {
    ChannelInterceptor result = null;
    if ( hasNext() ) {
        result = start;
        start = start.getNext();
    }
    return result;
}
 
Example #21
Source File: StaticMembershipInterceptor.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
protected ChannelInterceptor getfirstInterceptor() {
    ChannelInterceptor result = null;
    ChannelInterceptor now = this;
    do {
        result = now;
        now = now.getPrevious();
    } while (now.getPrevious() != null);
    return result;
}
 
Example #22
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
@Override
public ChannelInterceptor next() {
    ChannelInterceptor result = null;
    if ( hasNext() ) {
        result = start;
        start = start.getNext();
    }
    return result;
}
 
Example #23
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Sets up the default implementation interceptor stack
 * if no interceptors have been added
 * @throws ChannelException Cluster error
 */
protected synchronized void setupDefaultStack() throws ChannelException {
    if (getFirstInterceptor() != null &&
            ((getFirstInterceptor().getNext() instanceof ChannelCoordinator))) {
        addInterceptor(new MessageDispatchInterceptor());
    }
    Iterator<ChannelInterceptor> interceptors = getInterceptors();
    while (interceptors.hasNext()) {
        ChannelInterceptor channelInterceptor = interceptors.next();
        channelInterceptor.setChannel(this);
    }
    coordinator.setChannel(this);
}
 
Example #24
Source File: GroupChannel.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Validates the option flags that each interceptor is using and reports
 * an error if two interceptor share the same flag.
 * @throws ChannelException Error with option flag
 */
protected void checkOptionFlags() throws ChannelException {
    StringBuilder conflicts = new StringBuilder();
    ChannelInterceptor first = interceptors;
    while ( first != null ) {
        int flag = first.getOptionFlag();
        if ( flag != 0 ) {
            ChannelInterceptor next = first.getNext();
            while ( next != null ) {
                int nflag = next.getOptionFlag();
                if (nflag!=0 && (((flag & nflag) == flag ) || ((flag & nflag) == nflag)) ) {
                    conflicts.append("[");
                    conflicts.append(first.getClass().getName());
                    conflicts.append(":");
                    conflicts.append(flag);
                    conflicts.append(" == ");
                    conflicts.append(next.getClass().getName());
                    conflicts.append(":");
                    conflicts.append(nflag);
                    conflicts.append("] ");
                }//end if
                next = next.getNext();
            }//while
        }//end if
        first = first.getNext();
    }//while
    if ( conflicts.length() > 0 ) throw new ChannelException(sm.getString("groupChannel.optionFlag.conflict",
            conflicts.toString()));

}
 
Example #25
Source File: EncryptInterceptor.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
private void validateChannelChain() throws ChannelException {
    ChannelInterceptor interceptor = getPrevious();
    while(null != interceptor) {
        if(interceptor instanceof TcpFailureDetector)
            throw new ChannelConfigException(sm.getString("encryptInterceptor.tcpFailureDetector.ordering"));

        interceptor = interceptor.getPrevious();
    }
}
 
Example #26
Source File: NonBlockingCoordinator.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
public CoordinationEvent(int type,ChannelInterceptor interceptor, String info) {
    this.type = type;
    this.interceptor = interceptor;
    this.coord = ((NonBlockingCoordinator)interceptor).getCoordinator();
    this.mbrs = ((NonBlockingCoordinator)interceptor).membership.getMembers();
    this.info = info;
    this.view = ((NonBlockingCoordinator)interceptor).view;
    this.suggestedView = ((NonBlockingCoordinator)interceptor).suggestedView;
}
 
Example #27
Source File: StaticMembershipInterceptor.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * {@inheritDoc}
 * <p>
 * Sends notifications upwards.
 */
@Override
public void start(int svc) throws ChannelException {
    if ( (Channel.SND_RX_SEQ&svc)==Channel.SND_RX_SEQ ) super.start(Channel.SND_RX_SEQ);
    if ( (Channel.SND_TX_SEQ&svc)==Channel.SND_TX_SEQ ) super.start(Channel.SND_TX_SEQ);
    final ChannelInterceptorBase base = this;
    for (final Member member : members) {
        Thread t = new Thread() {
            @Override
            public void run() {
                base.memberAdded(member);
                if (getfirstInterceptor().getMember(member) != null) {
                    sendLocalMember(new Member[]{member});
                }
            }
        };
        t.start();
    }
    super.start(svc & (~Channel.SND_RX_SEQ) & (~Channel.SND_TX_SEQ));

    // check required interceptors
    TcpFailureDetector failureDetector = null;
    TcpPingInterceptor pingInterceptor = null;
    ChannelInterceptor prev = getPrevious();
    while (prev != null) {
        if (prev instanceof TcpFailureDetector ) failureDetector = (TcpFailureDetector) prev;
        if (prev instanceof TcpPingInterceptor) pingInterceptor = (TcpPingInterceptor) prev;
        prev = prev.getPrevious();
    }
    if (failureDetector == null) {
        log.warn(sm.getString("staticMembershipInterceptor.no.failureDetector"));
    }
    if (pingInterceptor == null) {
        log.warn(sm.getString("staticMembershipInterceptor.no.pingInterceptor"));
    }
}
 
Example #28
Source File: ChannelSF.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * Store the specified Channel children.
 *
 * @param aWriter
 *            PrintWriter to which we are storing
 * @param indent
 *            Number of spaces to indent this element
 * @param aChannel
 *            Channel whose properties are being stored
 *
 * @exception Exception
 *                if an exception occurs while storing
 */
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aChannel,
        StoreDescription parentDesc) throws Exception {
    if (aChannel instanceof Channel) {
        Channel channel = (Channel) aChannel;
        if (channel instanceof ManagedChannel) {
            ManagedChannel managedChannel = (ManagedChannel) channel;
            // Store nested <Membership> element
            MembershipService service = managedChannel.getMembershipService();
            if (service != null) {
                storeElement(aWriter, indent, service);
            }
            // Store nested <Sender> element
            ChannelSender sender = managedChannel.getChannelSender();
            if (sender != null) {
                storeElement(aWriter, indent, sender);
            }
            // Store nested <Receiver> element
            ChannelReceiver receiver = managedChannel.getChannelReceiver();
            if (receiver != null) {
                storeElement(aWriter, indent, receiver);
            }
            Iterator<ChannelInterceptor> interceptors = managedChannel.getInterceptors();
            while (interceptors.hasNext()) {
                ChannelInterceptor interceptor = interceptors.next();
                storeElement(aWriter, indent, interceptor);
            }
        }
   }
}
 
Example #29
Source File: StaticMembershipInterceptor.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
protected ChannelInterceptor getfirstInterceptor() {
    ChannelInterceptor result = null;
    ChannelInterceptor now = this;
    do {
        result = now;
        now = now.getPrevious();
    } while (now.getPrevious() != null);
    return result;
}
 
Example #30
Source File: ChannelInterceptorBase.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
@Override
public final ChannelInterceptor getPrevious() {
    return previous;
}