/** Names a channel, same as {@link #setName(String)} */ public Channel name(String name) {ch.name(name); return this;}
public static String printViews(JChannel ... channels) { StringBuilder sb=new StringBuilder(); for(JChannel ch: channels) sb.append(String.format("%s: %s\n", ch.name(), ch.getView())); return sb.toString(); }
public void start(String ... options) throws Exception { String props="udp.xml", name=null; options(options); if(options !=null) { for(int i=0; i < options.length; i++) { if(options[i].startsWith("-props")) { props=options[++i]; continue; } if(options[i].startsWith("-name")) { name=options[++i]; } } } ch=new JChannel(props).name(name).receiver(this); TP transport=ch.getProtocolStack().getTransport(); // uncomment below to disable the regular and OOB thread pools // transport.setOOBThreadPool(new DirectExecutor()); // transport.setDefaultThreadPool(new DirectExecutor()); //ThreadPoolExecutor thread_pool=new ThreadPoolExecutor(4, 4, 30000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(5000)); //transport.setDefaultThreadPool(thread_pool); //transport.setOOBThreadPool(thread_pool); //transport.setInternalThreadPool(thread_pool); ch.connect("rt"); View v=ch.getView(); if(v.size() > 2) throw new IllegalStateException(String.format("More than 2 members found (%s); terminating\n", v)); }
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() throws Exception { channel=new JChannel(props).name(name); channel.setReceiver(new ReceiverAdapter() { public void viewAccepted(View view) { setInternalState(view.getMembers()); } public void setInternalState(java.util.List<Address> mbrs) { members.clear(); for(Address mbr : mbrs) addNode(mbr); coordinator=mbrs.size() <= 1 || (mbrs.size() > 1 && mbrs.iterator().next().equals(my_addr)); repaint(); } }); channel.connect(channel_name); my_addr=channel.getAddress(); if(my_addr != null) setTitle(my_addr.toString()); pack(); setVisible(true); }
protected void start(String props, String name) throws Exception { channel=new JChannel(props).name(name); // TP transport=channel.getProtocolStack().getTransport(); // transport.setThreadPool(new DirectExecutor()); disp=new RpcDispatcher(channel, this).setMembershipListener(this); disp.setMethodLookup(ignored -> requestMethod); channel.connect("rt"); View view=channel.getView(); if(view.size() > 2) System.err.printf("More than 2 members found (%s); terminating\n", view); else loop(); Util.close(channel, disp); }
public void start(String props, boolean jmx, String name) throws Exception { channel=new JChannel(props).name(name); disp=new RpcDispatcher(channel, this) // no concurrent processing on incoming method calls .setMembershipListener(this).setMethodLookup(id -> METHODS[0]); if(jmx) { MBeanServer srv=Util.getMBeanServer(); if(srv == null) throw new Exception("No MBeanServers found"); JmxConfigurator.registerChannel(channel, srv, "jgroups", channel.getClusterName(), true); } channel.connect("rpc-speed-test"); View view=channel.getView(); if(view.size() > 2) System.err.printf("More than 2 members in cluster: %s; terminating\n", view); else loop(); Util.close(disp, channel); }
new MFC(), new FRAG2()}; JChannel ch=new JChannel(prot_stack).name(args[0]);
/** Names a channel, same as {@link #setName(String)} */ public Channel name(String name) {ch.name(name); return this;}
public static String printViews(JChannel ... channels) { StringBuilder sb=new StringBuilder(); for(JChannel ch: channels) sb.append(String.format("%s: %s\n", ch.name(), ch.getView())); return sb.toString(); }
private void start(String props, String name) throws Exception { channel=new JChannel(props); if(name != null) channel.name(name); channel.setReceiver(this); channel.connect("ChatCluster"); eventLoop(); channel.close(); }
private void start(String props, String name) throws Exception { channel=new JChannel(props); if(name != null) channel.name(name); channel.setReceiver(this); channel.connect("ChatCluster"); eventLoop(); channel.close(); }
public void start(String ... options) throws Exception { String props="udp.xml", name=null; options(options); if(options !=null) { for(int i=0; i < options.length; i++) { if(options[i].startsWith("-props")) { props=options[++i]; continue; } if(options[i].startsWith("-name")) { name=options[++i]; } } } ch=new JChannel(props).name(name).receiver(this); TP transport=ch.getProtocolStack().getTransport(); // uncomment below to disable the regular and OOB thread pools // transport.setOOBThreadPool(new DirectExecutor()); // transport.setDefaultThreadPool(new DirectExecutor()); //ThreadPoolExecutor thread_pool=new ThreadPoolExecutor(4, 4, 30000, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(5000)); //transport.setDefaultThreadPool(thread_pool); //transport.setOOBThreadPool(thread_pool); //transport.setInternalThreadPool(thread_pool); ch.connect("rt"); View v=ch.getView(); if(v.size() > 2) throw new IllegalStateException(String.format("More than 2 members found (%s); terminating\n", v)); }
public void start() throws Exception { channel=new JChannel(props).name(name); channel.setReceiver(new ReceiverAdapter() { public void viewAccepted(View view) { setInternalState(view.getMembers()); } public void setInternalState(java.util.List<Address> mbrs) { members.clear(); for(Address mbr : mbrs) addNode(mbr); coordinator=mbrs.size() <= 1 || (mbrs.size() > 1 && mbrs.iterator().next().equals(my_addr)); repaint(); } }); channel.connect(channel_name); my_addr=channel.getAddress(); if(my_addr != null) setTitle(my_addr.toString()); pack(); setVisible(true); }
protected void start(String props, String name) throws Exception { channel=new JChannel(props).name(name); // TP transport=channel.getProtocolStack().getTransport(); // transport.setThreadPool(new DirectExecutor()); disp=new RpcDispatcher(channel, this).setMembershipListener(this); disp.setMethodLookup(ignored -> requestMethod); channel.connect("rt"); View view=channel.getView(); if(view.size() > 2) System.err.printf("More than 2 members found (%s); terminating\n", view); else loop(); Util.close(channel, disp); }
public void start(String props, boolean jmx, String name) throws Exception { channel=new JChannel(props).name(name); disp=new RpcDispatcher(channel, this) // no concurrent processing on incoming method calls .setMembershipListener(this).setMethodLookup(id -> METHODS[0]); if(jmx) { MBeanServer srv=Util.getMBeanServer(); if(srv == null) throw new Exception("No MBeanServers found"); JmxConfigurator.registerChannel(channel, srv, "jgroups", channel.getClusterName(), true); } channel.connect("rpc-speed-test"); View view=channel.getView(); if(view.size() > 2) System.err.printf("More than 2 members in cluster: %s; terminating\n", view); else loop(); Util.close(disp, channel); }
new MFC(), new FRAG2()}; JChannel ch=new JChannel(prot_stack).name(args[0]);