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

Java GroupChannel类代码示例

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

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



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

示例1: startInternal

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
/**
 * Start Cluster and implement the requirements
 * of {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException if this component detects a fatal error
 *  that prevents this component from being used
 */
@Override
protected void startInternal() throws LifecycleException {

    if (log.isInfoEnabled()) log.info("Cluster is about to start");

    try {
        checkDefaults();
        registerClusterValve();
        channel.addMembershipListener(this);
        channel.addChannelListener(this);
        if (channel instanceof GroupChannel)
            ((GroupChannel)channel).setName(getClusterName() + "-Channel");
        channel.start(channelStartOptions);
        if (clusterDeployer != null) clusterDeployer.start();
        registerMember(channel.getLocalMember(false));
    } catch (Exception x) {
        log.error("Unable to start cluster.", x);
        throw new LifecycleException(x);
    }
    
    setState(LifecycleState.STARTING);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:30,代码来源:SimpleTcpCluster.java


示例2: start

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的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: recover

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
public static synchronized void recover(McastServiceImpl parent) {
    if (running) return;
    if (!parent.isRecoveryEnabled())
        return;
    
    running = true;
    
    Thread t = new RecoveryThread(parent);
    String channelName = "";
    if (parent.channel instanceof GroupChannel
            && ((GroupChannel)parent.channel).getName() != null) {
        channelName = "[" + ((GroupChannel)parent.channel).getName() + "]";
    }
    t.setName("Tribes-MembershipRecovery" + channelName);
    t.setDaemon(true);
    t.start();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:18,代码来源:McastServiceImpl.java


示例4: createChannel

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
public GroupChannel createChannel() {
    channel = new GroupChannel();
    ((ReceiverBase)channel.getChannelReceiver()).setAutoBind(100);
    interceptor = new NonBlockingCoordinator() {
        @Override
        public void fireInterceptorEvent(InterceptorEvent event) {
            status = event.getEventTypeDesc();
            int type = event.getEventType();
            boolean display = VIEW_EVENTS[type];
            if ( display ) parent.printScreen();
            try { Thread.sleep(SLEEP_TIME); }catch ( Exception x){
                // Ignore
            }
        }
    };
    channel.addInterceptor(interceptor);
    channel.addInterceptor(new TcpFailureDetector());
    channel.addInterceptor(new MessageDispatch15Interceptor());
    return channel;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:21,代码来源:CoordinationDemo.java


示例5: setUp

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel2 = new GroupChannel();
    channel1.getMembershipService().setPayload("Channel-1".getBytes("ASCII"));
    channel2.getMembershipService().setPayload("Channel-2".getBytes("ASCII"));
    mbrlist1 = new TestMbrListener("Channel-1");
    mbrlist2 = new TestMbrListener("Channel-2");
    tcpFailureDetector1 = new TcpFailureDetector();
    tcpFailureDetector2 = new TcpFailureDetector();
    channel1.addInterceptor(tcpFailureDetector1);
    channel2.addInterceptor(tcpFailureDetector2);
    channel1.addMembershipListener(mbrlist1);
    channel2.addMembershipListener(mbrlist2);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:17,代码来源:TestTcpFailureDetector.java


示例6: setUp

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    //channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    TesterUtil.addRandomDomain(new ManagedChannel[] {channel1, channel2});
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:23,代码来源:TestMulticastPackages.java


示例7: startInternal

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
/**
 * Start Cluster and implement the requirements of
 * {@link org.apache.catalina.util.LifecycleBase#startInternal()}.
 *
 * @exception LifecycleException
 *                if this component detects a fatal error that prevents this
 *                component from being used
 */
@Override
protected void startInternal() throws LifecycleException {

	if (log.isInfoEnabled())
		log.info("Cluster is about to start");

	try {
		checkDefaults();
		registerClusterValve();
		channel.addMembershipListener(this);
		channel.addChannelListener(this);
		if (channel instanceof GroupChannel)
			((GroupChannel) channel).setName(getClusterName() + "-Channel");
		channel.start(channelStartOptions);
		if (clusterDeployer != null)
			clusterDeployer.start();
		registerMember(channel.getLocalMember(false));
	} catch (Exception x) {
		log.error("Unable to start cluster.", x);
		throw new LifecycleException(x);
	}

	setState(LifecycleState.STARTING);
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:33,代码来源:SimpleTcpCluster.java


示例8: start

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的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


示例9: recover

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
public static synchronized void recover(McastServiceImpl parent) {
	if (running)
		return;
	if (!parent.isRecoveryEnabled())
		return;

	running = true;

	Thread t = new RecoveryThread(parent);
	String channelName = "";
	if (parent.channel instanceof GroupChannel && ((GroupChannel) parent.channel).getName() != null) {
		channelName = "[" + ((GroupChannel) parent.channel).getName() + "]";
	}
	t.setName("Tribes-MembershipRecovery" + channelName);
	t.setDaemon(true);
	t.start();
}
 
开发者ID:how2j,项目名称:lazycat,代码行数:18,代码来源:McastServiceImpl.java


示例10: setUp

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    channel1 = new GroupChannel();
    channel1.addInterceptor(new MessageDispatch15Interceptor());
    channel2 = new GroupChannel();
    channel2.addInterceptor(new MessageDispatch15Interceptor());
    ThroughputInterceptor tint = new ThroughputInterceptor();
    tint.setInterval(500);
    ThroughputInterceptor tint2 = new ThroughputInterceptor();
    tint2.setInterval(500);
    //channel1.addInterceptor(tint);
    channel2.addInterceptor(tint2);
    listener1 = new Listener();
    ReceiverBase rb1 = (ReceiverBase)channel1.getChannelReceiver();
    ReceiverBase rb2 = (ReceiverBase)channel2.getChannelReceiver();
    rb1.setUdpPort(50000);
    rb2.setUdpPort(50000);
    channel2.addChannelListener(listener1);
    channel1.start(Channel.DEFAULT);
    channel2.start(Channel.DEFAULT);
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:22,代码来源:TestMulticastPackages.java


示例11: startQueue

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
public void startQueue() {
    msgDispatchThread = new Thread(this);
    String channelName = "";
    if (getChannel() instanceof GroupChannel
            && ((GroupChannel)getChannel()).getName() != null) {
        channelName = "[" + ((GroupChannel)getChannel()).getName() + "]";
    }
    msgDispatchThread.setName("MessageDispatchInterceptor.MessageDispatchThread" + channelName);
    msgDispatchThread.setDaemon(true);
    msgDispatchThread.setPriority(Thread.MAX_PRIORITY);
    queue.setEnabled(true);
    run = true;
    msgDispatchThread.start();
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:15,代码来源:MessageDispatchInterceptor.java


示例12: startQueue

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
@Override
public void startQueue() {
    if ( run ) return;
    String channelName = "";
    if (getChannel() instanceof GroupChannel
            && ((GroupChannel)getChannel()).getName() != null) {
        channelName = "[" + ((GroupChannel)getChannel()).getName() + "]";
    }
    executor = ExecutorFactory.newThreadPool(maxSpareThreads, maxThreads,
            keepAliveTime, TimeUnit.MILLISECONDS,
            new TcclThreadFactory("MessageDispatch15Interceptor.MessageDispatchThread" + channelName));
    run = true;
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:14,代码来源:MessageDispatch15Interceptor.java


示例13: start

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
@Override
public void start() throws IOException {
    if ( executor == null ) {
        //executor = new ThreadPoolExecutor(minThreads,maxThreads,60,TimeUnit.SECONDS,new LinkedBlockingQueue<Runnable>());
        String channelName = "";
        if (channel instanceof GroupChannel && ((GroupChannel)channel).getName() != null) {
            channelName = "[" + ((GroupChannel)channel).getName() + "]";
        }
        TaskThreadFactory tf = new TaskThreadFactory("Tribes-Task-Receiver" + channelName + "-");
        executor = ExecutorFactory.newThreadPool(minThreads, maxThreads, maxIdleTime, TimeUnit.MILLISECONDS, tf);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:13,代码来源:ReceiverBase.java


示例14: ReceiverThread

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
public ReceiverThread() {
    super();
    String channelName = "";
    if (channel instanceof GroupChannel && ((GroupChannel)channel).getName() != null) {
        channelName = "[" + ((GroupChannel)channel).getName() + "]";
    }
    setName("Tribes-MembershipReceiver" + channelName);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:9,代码来源:McastServiceImpl.java


示例15: SenderThread

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
public SenderThread(long time) {
    this.time = time;
    String channelName = "";
    if (channel instanceof GroupChannel && ((GroupChannel)channel).getName() != null) {
        channelName = "[" + ((GroupChannel)channel).getName() + "]";
    }
    setName("Tribes-MembershipSender" + channelName);

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


示例16: setUp

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    System.out.println("Setup");
    channels = new GroupChannel[channelCount];
    orderitcs = new OrderInterceptor[channelCount];
    mangleitcs = new MangleOrderInterceptor[channelCount];
    test = new TestListener[channelCount];
    threads = new Thread[channelCount];
    for ( int i=0; i<channelCount; i++ ) {
        channels[i] = new GroupChannel();

        orderitcs[i] = new OrderInterceptor();
        mangleitcs[i] = new MangleOrderInterceptor();
        orderitcs[i].setExpire(Long.MAX_VALUE);
        channels[i].addInterceptor(orderitcs[i]);
        channels[i].addInterceptor(mangleitcs[i]);
        test[i] = new TestListener(i);
        channels[i].addChannelListener(test[i]);
        final int j = i;
        threads[i] = new Thread() {
            @Override
            public void run() {
                try {
                    channels[j].start(Channel.DEFAULT);
                    Thread.sleep(50);
                } catch (Exception x) {
                    x.printStackTrace();
                }
            }
        };
    }
    TesterUtil.addRandomDomain(channels);
    for ( int i=0; i<channelCount; i++ ) threads[i].start();
    for ( int i=0; i<channelCount; i++ ) threads[i].join();
    Thread.sleep(1000);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:37,代码来源:TestOrderInterceptor.java


示例17: setUp

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    System.out.println("Setup");
    channels = new GroupChannel[CHANNEL_COUNT];
    coordinators = new NonBlockingCoordinator[CHANNEL_COUNT];
    Thread[] threads = new Thread[CHANNEL_COUNT];
    for ( int i=0; i<CHANNEL_COUNT; i++ ) {
        channels[i] = new GroupChannel();
        coordinators[i] = new NonBlockingCoordinator();
        channels[i].addInterceptor(coordinators[i]);
        channels[i].addInterceptor(new TcpFailureDetector());
        final int j = i;
        threads[i] = new Thread() {
            @Override
            public void run() {
                try {
                    channels[j].start(Channel.DEFAULT);
                    Thread.sleep(50);
                } catch (Exception x) {
                    x.printStackTrace();
                }
            }
        };
    }
    TesterUtil.addRandomDomain(channels);
    for (int i = 0; i < CHANNEL_COUNT; i++) {
        threads[i].start();
    }
    for (int i = 0; i < CHANNEL_COUNT; i++) {
        threads[i].join();
    }
    Thread.sleep(1000);
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:34,代码来源:TestNonBlockingCoordinator.java


示例18: setUp

import org.apache.catalina.tribes.group.GroupChannel; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    for (int i = 0; i < channels.length; i++) {
        channels[i] = new GroupChannel();
        channels[i].getMembershipService().setPayload( ("Channel-" + (i + 1)).getBytes("ASCII"));
        listeners[i] = new TestMbrListener( ("Listener-" + (i + 1)));
        channels[i].addMembershipListener(listeners[i]);
        DomainFilterInterceptor filter = new DomainFilterInterceptor();
        filter.setDomain(UUIDGenerator.randomUUID(false));
        channels[i].addInterceptor(filter);
    }
}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:13,代码来源:TestDomainFilterInterceptor.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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