• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ChannelInterceptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.catalina.tribes.ChannelInterceptor的典型用法代码示例。如果您正苦于以下问题:Java ChannelInterceptor类的具体用法?Java ChannelInterceptor怎么用?Java ChannelInterceptor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ChannelInterceptor类属于org.apache.catalina.tribes包,在下文中一共展示了ChannelInterceptor类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: addInterceptor

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:31,代码来源:GroupChannel.java


示例2: start

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
@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();
    }
    
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:27,代码来源:TcpPingInterceptor.java


示例3: testOptionConflict

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
@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);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:TestGroupChannelOptionFlag.java


示例4: testOptionNoConflict

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
@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);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:TestGroupChannelOptionFlag.java


示例5: addInterceptor

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
/**
 * 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);
	}
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:33,代码来源:GroupChannel.java


示例6: start

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
@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();
	}

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:27,代码来源:TcpPingInterceptor.java


示例7: start

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
@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();
    }
    
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:23,代码来源:TcpPingInterceptor.java


示例8: start

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
@Override
public synchronized void start(int svc) throws ChannelException {
    super.start(svc);
    running = true;
    if ( thread == null ) {
        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();
    }
    
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:23,代码来源:TcpPingInterceptor.java


示例9: checkOptionFlags

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
/**
 * 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());

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:34,代码来源:GroupChannel.java


示例10: next

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
@Override
public ChannelInterceptor next() {
    ChannelInterceptor result = null;
    if ( hasNext() ) {
        result = start;
        start = start.getNext();
    }
    return result;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:GroupChannel.java


示例11: CoordinationEvent

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
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;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:NonBlockingCoordinator.java


示例12: start

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
/**
 * 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.");
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:45,代码来源:StaticMembershipInterceptor.java


示例13: getfirstInterceptor

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
protected ChannelInterceptor getfirstInterceptor() {
    ChannelInterceptor result = null;
    ChannelInterceptor now = this;
    do {
        result = now;
        now = now.getPrevious();
    } while (now.getPrevious() != null);
    return result;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:10,代码来源:StaticMembershipInterceptor.java


示例14: checkOptionFlags

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
/**
 * 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());

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:36,代码来源:GroupChannel.java


示例15: getFirstInterceptor

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
/**
 * Returns the first interceptor of the stack. Useful for traversal.
 * 
 * @return ChannelInterceptor
 */
public ChannelInterceptor getFirstInterceptor() {
	if (interceptors != null)
		return interceptors;
	else
		return coordinator;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:12,代码来源:GroupChannel.java


示例16: next

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
@Override
public ChannelInterceptor next() {
	ChannelInterceptor result = null;
	if (hasNext()) {
		result = start;
		start = start.getNext();
	}
	return result;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:10,代码来源:GroupChannel.java


示例17: CoordinationEvent

import org.apache.catalina.tribes.ChannelInterceptor; //导入依赖的package包/类
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;
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:10,代码来源:NonBlockingCoordinator.java



注:本文中的org.apache.catalina.tribes.ChannelInterceptor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Graphic类代码示例发布时间:2022-05-23
下一篇:
Java CountStatistic类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap