org.apache.catalina.tribes.group.ChannelInterceptorBase Java Examples

The following examples show how to use org.apache.catalina.tribes.group.ChannelInterceptorBase. 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: 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 #2
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 #3
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.");
    }
}