Package org.jgroups

Examples of org.jgroups.JChannel$MyProbeHandler


        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


   }

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

      return new JChannel(syncConfig);
   }

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

   // 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

    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

    @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

  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

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

    this.configuration = configuration ;
  }

  public Channel createChannel(String id) throws Exception {
   
    JChannel channel = new MuxChannel(this);
   
    // We need to synchronize on shared transport,
        // so we don't attempt to init a shared transport multiple times
    TP transport = channel.getProtocolStack().getTransport();
    if(transport.isSingleton()) {
      synchronized(transport) {
        init(transport);
      }
    } else {
      init(transport);
    }
   
    channel.setName(configuration.getNodeName() + "/" + id);
   
    TransportConfiguration.Topology topology = configuration.getTransport().getTopology();
    if (topology != null) {
      channel.setAddressGenerator(new TopologyAddressGenerator(channel, topology.getSite(), topology.getRack(), topology.getMachine()));
    }
   
    MBeanServer server = configuration.getMBeanServer();
    if (server != null) {
            try {
                this.channels.put(channel, id);
                JmxConfigurator.registerChannel(channel, server, id);
            } catch (Exception e) {
              logger.warn(e.getMessage(), e);
            }
            channel.addChannelListener(this);
        }
   
    return channel;
  }
View Full Code Here

  }

  public void start(String props, String name, String clusterName, boolean isDiscardOwn) throws Exception {
   
   
    channel = new JChannel();
    if(null != name) {
      channel.setName(name);
    }
    channel.setReceiver(this);
    channel.setDiscardOwnMessages(true);
View Full Code Here

TOP

Related Classes of org.jgroups.JChannel$MyProbeHandler

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.