Examples of JChannel


Examples of org.jgroups.JChannel

        }

        public void run() {
            for(int i=1; i <= num_msgs; i++) {
                try {
                    JChannel ch=(JChannel)Util.pickRandomElement(channels);
                    String channel_name=ch.getName();
                    ch.send(null, null, channel_name + ":" + num.getAndIncrement());
                }
                catch(Exception e) {
                }
            }
        }
View Full Code Here

Examples of org.jgroups.JChannel

            "print_local_addr=true)";

    @Test(groups=Global.FUNCTIONAL)
    public static void testMyProtocol() throws Exception {
        System.out.println("PROTOCOL_STACK: " + PROTOCOL_STACK);
        JChannel channel = new JChannel(PROTOCOL_STACK);
        System.out.println("channel = " + channel);
        assert true;
    }
View Full Code Here

Examples of org.jgroups.JChannel

        this.cache = cache;
        if (cache.getAttributes().isDistributed())
        {
            try
            {
                channel = new JChannel(null);
                channel.connect("FKacheOS");
                new PullPushAdapter(channel, this, this);
            }
            catch (ChannelException e)
            {
View Full Code Here

Examples of org.jgroups.JChannel

   }

   // implementation of JChannelFactory ------------------------------------------------------------
   public JChannel createSyncChannel() throws Exception
   {
      return new JChannel(syncConfig);
   }
View Full Code Here

Examples of org.jgroups.JChannel

      return new JChannel(syncConfig);
   }

   public JChannel createASyncChannel() throws Exception
   {
      return new JChannel(asyncConfig);
   }
View Full Code Here

Examples of org.jgroups.JChannel

   // Constructors --------------------------------------------------

   public JChannelClient() throws Exception
   {
      jChannel = new JChannel(props);
      // this may be replaced by other listener by subclasses
      // TODO commented out to get rid of deprecated warnings at compilation. If needed, replace with something valid
      //jChannel.setChannelListener(new ChannelListenerImpl());

   }
View Full Code Here

Examples of org.jgroups.JChannel

    public void init() {
        try {
            logger.info("Starting Atmosphere JGroups Clustering support");

            //initialize jgroups channel
            jchannel = new JChannel();
            //register for Group Events
            jchannel.setReceiver(this);
            //join group
            jchannel.connect(clusterName);
        } catch (Throwable t) {
View Full Code Here

Examples of org.jgroups.JChannel

    @Override
    public void incomingBroadcast() {
        try {
            logger.info("Starting Atmosphere JGroups Clustering support");

            jchannel = new JChannel();
            jchannel.setReceiver(new ReceiverAdapter() {
                /** {@inheritDoc} */
                @Override
                public void receive(final Message message) {
                    final String msg = (String) message.getObject();
View Full Code Here

Examples of org.jgroups.JChannel

  public JChannel createChannel(String name, String cluster, ReceiverAdapter reciever) {

    logger.info("Create JGroups Channel, name = " + name + ", cluster = " + cluster);
   
    try {
      JChannel channel = new JChannel(jgroupsProps);
      channel.setName(name);
      channel.setReceiver(reciever);
      channel.setDiscardOwnMessages(true);
      channel.connect(cluster);
     
      MBeanServer server = Util.getMBeanServer();
          if(server == null){
            throw new Exception("No MBeanServers found;" + "\nTankWar needs to be run with an MBeanServer present");
          }
          JmxConfigurator.registerChannel((JChannel)channel, server, "jgroups-tankwar", channel.getClusterName(), true);
     
      return channel ;
    } catch (Exception e) {
      throw new TankWarCommunicationException("connect to " + cluster + " error", e);
    }
View Full Code Here

Examples of org.jgroups.JChannel

public class SimplisticChat {

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

    JChannel channel = new JChannel();
   
    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");
   
    System.out.println(channel.getView().getCreator().equals(channel.getView().getMembers().get(0)));
   
    for (;;) {
      String line = Util.readStringFromStdin(": ");
      channel.send(null, line);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.