/** * Join the group. * * @throws Exception */ public void join() throws Exception { synchronized (this.joined) { if (!this.joined) { PipeAdvertisement pipeAdvertisment = PipeUtil.getAdvertisement(getPeerGroup(), getPeerGroup().getPeerName(), PipeService.UnicastType, null); DiscoveryService ds = getPeerGroup().getDiscoveryService(); ds.publish(pipeAdvertisment); ds.remotePublish(pipeAdvertisment); ExecutorService executors = this.networkHandler.getJXTAExecutorService(); executors.submit(new Server()); executors.submit(new PipeDiscover()); getPeerGroup().getRendezVousService().setAutoStart(true, 12000); this.joined = true; } } }
private int info(String name) { ShellObject obj = env.get(name); if (obj == null) { println("flush: env object" + name + " not found"); return ShellApp.appMiscError; } Object adv = obj.getObject(); if (adv instanceof Advertisement) { long life = discovery.getAdvLifeTime((Advertisement) adv); long exp = discovery.getAdvExpirationTime((Advertisement) adv); println( "Expires on : " + new Date(life + System.currentTimeMillis()) + "\nExpires for others in : " + exp + " ms"); } else { shortHelp(); } return ShellApp.appNoError; }