uphandlertest.java

来自「JGRoups源码」· Java 代码 · 共 46 行

JAVA
46
字号
// $Id: UpHandlerTest.java,v 1.6 2005/05/30 16:15:12 belaban Exp $package org.jgroups.tests;import org.jgroups.*;import org.jgroups.util.Util;/** * Uses the pass-though facility of the Channel: events are passed (mostly) unfiltered from the channel * to the application. The app quickly joins a groups, sends a message and then leaves again. The events * received during this period are shown. * @author Bela Ban */public class UpHandlerTest implements UpHandler {    Channel channel;    public void start() throws Exception {	channel=new JChannel();	channel.setUpHandler(this);	channel.connect("UpHandlerTestGroup");	channel.send(new Message(null, null, "Hello".getBytes()));	Util.sleep(2000);	channel.close();    }    public void up(Event evt) {	System.out.println(evt);    }    public static void main(String[] args) {	try {	    new UpHandlerTest().start();	}	catch(Exception e) {	    System.err.println(e);	}    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?