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(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)); }