Package org.jgroups

Examples of org.jgroups.JChannel


    this.provider_fails = provider_fails;
    this.requester_fails = requester_fails;
    this.delay = delay;
    this.size = size;
   
    channel = new JChannel(props);
    channel.setReceiver(this);
   
    if(name != null) {
      channel.setName(name);
    }
View Full Code Here


 
  public static final short ID = 1900;

  public static void main(String[] args) throws Exception {

    JChannel ch = new JChannel();
    ch.connect("demo");
    ch.setReceiver(new ReceiverAdapter() {
      public void receive(Message msg) {
        MyHeader hdr = (MyHeader) msg.getHeader(ID);
        System.out.println("-- received " + msg + ", header is " + hdr);
      }
    });
   
    ClassConfigurator.addProtocol(ID, MyHeader.class);
   
    int cnt = 1;
    for (int i = 0; i < 5; i++) {
      Message msg = new Message();
      msg.putHeader(ID, new MyHeader(cnt++));
      ch.send(msg);
    }
    ch.close();
  }
View Full Code Here

  public void test() throws Exception {
   
    logger.info("'org.jgroups.blocks.MessageDispatcher' test");
   
    channel = new JChannel(props);
    disp = new MessageDispatcher(channel, null, null, this);
    channel.connect("MessageDispatcherTestGroup");
   
    logger.info(" -> View Id: " + channel.getView().getViewId());
    logger.info(" -> View Creater: " + channel.getView().getCreator());
View Full Code Here

    System.out.println("    receive message: " + msg.getObject());
  }

  public void start(String props, String name) throws Exception {
   
    Channel channel = new JChannel(props);
    channel.setReceiver(this);
   
    if(name != null) {
      channel.setName(name);
    }
   
    channel.connect("LargeStateChannel");
   
    while(true){
     
      Msg msg = new Msg(10000);
      channel.send(null, msg);
     
      System.out.println("Press Enter to re-test\n");
      System.in.read();
    }
  }
View Full Code Here

  public void test() throws Exception {
   
    logger.info("'org.jgroups.blocks.RpcDispatcher' test with response filter");
   
    channel = new JChannel();
    disp = new RpcDispatcher(channel, this);
    channel.connect("RpcDispatcherTestGroup");
   
    logger.info(" -> View Id: " + channel.getView().getViewId());
    logger.info(" -> View Creater: " + channel.getView().getCreator());
View Full Code Here

    Thread.sleep(1000 * 15);
  }

  private void viewchecker(int time) throws Exception {

    JChannel channel = new JChannel();
    channel.connect("TestCluster");
    View view = channel.getView();
    logger.info("View ID: " + view.getViewId());
    logger.info("View creater: " + view.getCreator());
    logger.info("View coordinator: " + view.getMembers().get(0));
   
    new Thread(new ChannelCloseThread(channel, 1000 * time)).start();
 
View Full Code Here

 
  static final String BIND_ADDR = "192.168.1.101" ;

  public static void main(String[] args) throws Exception {

    JChannel channel = new JChannel(false);
    ProtocolStack stack = new ProtocolStack();
    channel.setProtocolStack(stack);
   
    stack.addProtocols(new UDP().setValue("bind_addr", InetAddress.getByName(BIND_ADDR)))
        .addProtocol(new PING())
        .addProtocol(new MERGE2())
        .addProtocol(new FD_SOCK())
        .addProtocol(new FD_ALL().setValue("timeout", 12000).setValue("interval", 3000))
        .addProtocol(new VERIFY_SUSPECT()).addProtocol(new BARRIER())
        .addProtocol(new NAKACK()).addProtocol(new UNICAST2())
        .addProtocol(new STABLE()).addProtocol(new GMS())
        .addProtocol(new UFC()).addProtocol(new MFC())
        .addProtocol(new FRAG2());
    stack.init();
   
    channel.setReceiver(new ReceiverAdapter(){

      public void receive(Message msg) {
        Address sender=msg.getSrc();
        System.out.println(msg.getObject() + " [" + sender + "]");
      }

      public void viewAccepted(View view) {
        System.out.println("view: " + view);
      }});
   
    channel.connect("ChatCluster");
   
    for (;;) {
      String line = Util.readStringFromStdin(": ");
      channel.send(null, line);
    }

  }
View Full Code Here

  private RpcMethods rpcMethods ;
  private RspList<String> rsp_list;
 
  private void start(String name) throws Exception {
   
    channel = new JChannel();
    if(null != name) {
      channel.setName(name);
    }
   
    messageListener = new MyMessageListener();
View Full Code Here

 
  private String props;
 
  public void start(String name) throws Exception {
   
    channel = new JChannel(props);
    if(null != name) {
      channel.setName(name);
    }
    handler = new MyRequestHandler(channel);
    messageListener = new MyMessageListener();
View Full Code Here

        sb.append("Date: ").append(new Date()).append('\n');
        sb.append("Run by: ").append(System.getProperty("user.name")).append("\n");
        sb.append("JGroups version: ").append(Version.description).append('\n');
        println(sb);

    channel = new JChannel(props);
    channel.setName(name);
    channel.setReceiver(this);
    channel.connect("mperf");
    local_addr = channel.getAddress();
        JmxConfigurator.registerChannel(channel, Util.getMBeanServer(), "jgroups", "mperf", true);
View Full Code Here

TOP

Related Classes of org.jgroups.JChannel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.