Package org.jgroups

Examples of org.jgroups.JChannel


      receiver.clear();
  

   protected Channel createChannel() throws ChannelException
   {
      Channel ret = new JChannel(CHANNEL_CONFIG);
      ret.setOpt(Channel.BLOCK, Boolean.TRUE);
      Protocol flush = ((JChannel) ret).getProtocolStack().findProtocol("FLUSH");
      if (flush != null)
      {
         Properties p = new Properties();
         p.setProperty("timeout", "0");
View Full Code Here


        init();
    }

    public PartitionerTest() {
        try {
            channel=new JChannel(channel_properties);
        }
        catch(Exception ex) {
            ex.printStackTrace();
            System.exit(4);
        }
View Full Code Here

        Message         msg;
        Object          obj;
        String          line;
        BufferedReader  reader;

        ch=new JChannel(props);
        ch.connect(null); // unicast channel

        addr=new IpAddress(host, port);
        reader= new BufferedReader(new InputStreamReader(System.in));
View Full Code Here

    void runServer() throws Exception {
        Object  obj;
        Message msg, rsp;

        ch=new JChannel(props);
        ch.connect(null); // this makes it a unicast channel
        System.out.println("server started at " + new java.util.Date() +
                           ", listening on " + ch.getLocalAddress());
        while(true) {
            obj=ch.receive(0);
View Full Code Here

      String cfg;
      if (p != null) {
         if (p.containsKey(CONFIGURATION_FILE)) {
            cfg = p.getProperty(CONFIGURATION_FILE);
            try {
               channel = new JChannel(new FileLookup().lookupFileLocation(cfg));
            } catch (Exception e) {
               log.error("Error while trying to create a channel using config files: " + cfg);
               throw new CacheException(e);
            }
         }

         if (p.containsKey(CONFIGURATION_XML)) {
            cfg = p.getProperty(CONFIGURATION_XML);
            try {
               channel = new JChannel(XmlConfigHelper.stringToElement(cfg));
            } catch (Exception e) {
               log.error("Error while trying to create a channel using config XML: " + cfg);
               throw new CacheException(e);
            }
         }

         if (p.containsKey(CONFIGURATION_STRING)) {
            cfg = p.getProperty(CONFIGURATION_STRING);
            try {
               channel = new JChannel(cfg);
            } catch (Exception e) {
               log.error("Error while trying to create a channel using config string: " + cfg);
               throw new CacheException(e);
            }
         }
      }

      if (channel == null) {
         log.info("Unable to use any JGroups configuration mechanisms provided in properties {0}.  Using default JGroups configuration!", p);
         try {
            channel = new JChannel(new FileLookup().lookupFileLocation(DEFAULT_JGROUPS_CONFIGURATION_FILE));
         } catch (ChannelException e) {
            throw new CacheException("Unable to start JGroups channel", e);
         }
      }
   }
View Full Code Here

        listener1 = new TestVoteChannelListener(true);
        listener2 = new TestVoteChannelListener(true);
        listener3 = new TestVoteChannelListener(false);
        listener4 = new TestVoteChannelListener(false);

        channel1 = new JChannel(SERVER_PROTOCOL_STACK);
        adapter1 = new VotingAdapter(channel1);
       
        channel1.connect("voting");

        // give some time for the channel to become a coordinator
    try {
      Thread.sleep(1000);
    } catch(Exception ex) {
    }
       
        channel2 = new JChannel(SERVER_PROTOCOL_STACK);
        adapter2 = new VotingAdapter(channel2);
       
        channel2.connect("voting");
       
        try {
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        startRouter();
        checker=new ViewChecker();
        ch1=new JChannel(props);
        ch1.setReceiver(checker);
        ch1.connect("demo");
        ch2=new JChannel(props);
        ch2.setReceiver(checker);
        ch2.connect("demo");
        Util.sleep(1000);
    }
View Full Code Here

    }


    protected void setUp() throws Exception {
        super.setUp();
        channel=new JChannel(props);
        channel.setOpt(Channel.AUTO_RECONNECT, Boolean.TRUE);
        disp=new RpcDispatcher(channel, null, null, this);
        channel.connect("RpcDispatcherSerializationTestGroup");


        channel2=new JChannel(props);
        disp2=new RpcDispatcher(channel2, null, null, this);
        channel2.connect("RpcDispatcherSerializationTestGroup");
    }
View Full Code Here

     */
    static private void initCommChannel() {
        // preload all the static ip's, we only do this once, of course

        try {
            channel = new JChannel(props);
      System.out.println(channel.getProtocolStack().printProtocolSpec(false));
            disp = new RpcDispatcher(channel, null, null, null);
            channel.connect("BOSGroup");
        }
        catch (org.jgroups.ChannelException ce) {
View Full Code Here

    protected void setUp() throws Exception {
        super.setUp();
        CONFIG=System.getProperty("stack", CONFIG);

        ch=new JChannel(CONFIG);
        ServerObject obj=new ServerObject(null);
        disp=new RpcDispatcher(ch, null, null, obj);
        ch.connect("demo");
        obj.setAddress(ch.getLocalAddress());

        ch2=new JChannel(CONFIG);
        ServerObject obj2=new ServerObject(null);
        disp2=new RpcDispatcher(ch2, null, null, obj2);
        ch2.connect("demo");
        obj2.setAddress(ch2.getLocalAddress());

        ch3=new JChannel(CONFIG);
        ServerObject obj3=new ServerObject(null);
        disp3=new RpcDispatcher(ch3, null, null, obj3);
        ch3.connect("demo");
        obj3.setAddress(ch3.getLocalAddress());
    }
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.