/** * Sets the receiver for this channel. Receiver will in turn handle all messages, view changes, * implement state transfer logic and so on. * * @param r the receiver instance for this channel * @see Receiver * * */ public void setReceiver(Receiver r) { ch.setReceiver(r); }
public JChannel receiver(Receiver r) {return setReceiver(r);} public Address getAddress() {return state == State.CLOSED ? null : local_addr;}
@Override public void resume() { channel.setReceiver(null); channel.setReceiver(new QuorumCheckerReceiver()); }
public synchronized void closeChannel() { connected = false; channel.setReceiver(null); if (logger.isTraceEnabled()) { logger.trace(this + "::Closing Channel: " + channelName, new Exception("Trace")); } channel.close(); }
public Draw(JChannel channel) throws Exception { this.channel=channel; channel.setReceiver(this); channel.addChannelListener(this); }
public Draw(JChannel channel, boolean use_state, long state_timeout) throws Exception { this.channel=channel; channel.setReceiver(this); channel.addChannelListener(this); this.use_state=use_state; this.state_timeout=state_timeout; }
public void start(JChannel ch) throws Exception { this.ch=ch; ch.setReceiver(new ReceiverAdapter() { public void viewAccepted(View view) { System.out.println("-- view: " + view); } }); loop(); }
protected Bridge(final JChannel ch, final String cluster_name, String channel_name, AddressGenerator addr_generator) throws Exception { this.channel=ch; channel.setName(channel_name); channel.setReceiver(this); channel.addAddressGenerator(addr_generator); this.cluster_name=cluster_name; }
/** * Expects an already connected channel. Creates a PullPushAdapter and starts it */ public ReplicatedTree(JChannel channel) throws Exception { this.channel=channel; channel.setReceiver(this); viewAccepted(channel.getView()); start(); }
public void start(String props) throws Exception { channel=new JChannel(props); channel.setReceiver(this); channel.connect("ViewDemo"); while(true) { Util.sleep(10000); } }
/** Method called from other app, injecting channel */ public void start(JChannel ch) throws Exception { channel=ch; channel.setReceiver(this); channel.connect("ChatCluster"); eventLoop(); channel.close(); }
protected void _init(JChannel ch, long sleep_time, String name) throws Exception { this.sleep_time=sleep_time; channel=ch; if(name != null) channel.setName(name); channel.connect(getClass().getSimpleName()); channel.setReceiver(receiver); try { MBeanServer server=Util.getMBeanServer(); JmxConfigurator.registerChannel(channel, server, "jgroups-" + name, channel.getClusterName(), true); } catch(Throwable ex) { System.err.println("registering the channel with JMX failed: " + ex); } }
void start(String props, String channel_name) throws Exception { ch=new JChannel(props); ch.setName(channel_name); ch.setReceiver(new ReceiverAdapter() { public void viewAccepted(View view) { System.out.println("-- view: " + view); } }); loop(); }
/** * Creates a channel with the given properties. Connects to the channel, then creates a PullPushAdapter * and starts it */ public ReplicatedTree(String groupname, String props, long state_fetch_timeout) throws Exception { if(groupname != null) this.groupname=groupname; if(props != null) this.props=props; this.state_fetch_timeout=state_fetch_timeout; channel=new JChannel(this.props); channel.setReceiver(this); channel.connect(this.groupname); start(); }
private void createJChannel() throws Exception { System.out.println("Creating Channel"); receiver = new MyReceiver(numberOfNodes, this); jChannel = new JChannel(config); jChannel.setReceiver(receiver); jChannel.connect(CLUSTER); receiver.waitUntilClusterIsFormed(); Util.registerChannel(jChannel, JMX_DOMAIN); members.addAll(jChannel.getView().getMembers()); }
public Draw(String props, boolean no_channel, boolean jmx, boolean use_state, long state_timeout, boolean use_unicasts, String name, boolean send_own_state_on_merge, AddressGenerator gen) throws Exception { this.no_channel=no_channel; this.jmx=jmx; this.use_state=use_state; this.state_timeout=state_timeout; this.use_unicasts=use_unicasts; if(no_channel) return; channel=new JChannel(props).addAddressGenerator(gen).setName(name); channel.setReceiver(this).addChannelListener(this); this.send_own_state_on_merge=send_own_state_on_merge; }
public void start(String props, String name) throws Exception { ch=new JChannel(props); ch.setName(name); ch.setReceiver(this); ch.connect("FlowControlTest"); loop(); Util.close(ch); }
private void start(String props, String name, boolean nohup) throws Exception { channel=new JChannel(props); if(name != null) channel.name(name); channel.setReceiver(this); channel.connect("ChatCluster"); if(!nohup) { eventLoop(); channel.close(); } }
public void start(String props, String name, boolean unicast) throws Exception { ch=new JChannel(props); if(name != null) ch.setName(name); ch.setReceiver(this); ch.connect("ping"); while(true) { Util.keyPress("enter to ping"); Address dest=null; if(unicast) dest=Util.pickRandomElement(members); Message msg=new Message(dest, PING_REQ); msg.setFlag(Message.Flag.DONT_BUNDLE, Message.Flag.NO_FC); start=System.nanoTime(); ch.send(msg); } }
protected void createBridge() { try { if(log.isTraceEnabled()) log.trace("I'm the coordinator, creating a channel (props=" + bridge_props + ", cluster_name=" + bridge_name + ")"); bridge=new JChannel(bridge_props); bridge.setDiscardOwnMessages(true); // don't receive my own messages bridge.setReceiver(new Receiver()); bridge.connect(bridge_name); } catch(Exception e) { log.error(Util.getMessage("FailedCreatingBridgeChannelProps") + bridge_props + ")", e); } }