List of usage examples for java.rmi NotBoundException printStackTrace
public void printStackTrace()
From source file:org.kchine.rpf.db.MainNodeManager.java
public static void main(String args[]) throws Exception { try {/*from ww w . j a v a 2s .c om*/ // for (Object // key:PoolUtils.orderO(System.getProperties().keySet())) // {System.out.println(key+" = "+System.getProperty((String)key));} _registry = (DBLayer) ServerDefaults.getRmiRegistry(); _nodeManagerName = System.getProperty("node.manager.name"); if (System.getProperty("node.name") != null && !System.getProperty("node.name").equals("")) { _nodeManagerName += '_' + System.getProperty("node.name"); _nodeData = _registry.getNodeData("NODE_NAME='" + System.getProperty("node.name") + "'") .elementAt(0); } boolean chronjob = System.getProperty("job") != null && System.getProperty("job").equalsIgnoreCase("chron"); if (chronjob) { killTask(); createTask(); return; } boolean srv = System.getProperty("server") != null && System.getProperty("server").equalsIgnoreCase("true"); if (srv) { NodeManager manager = new NodeManagerImpl(_registry); ManagedServant oldServant = null; try { oldServant = ((ManagedServant) _registry.lookup(_nodeManagerName)); } catch (NotBoundException e) { } if (oldServant != null) { log.info("Found an old servant with this name<" + _nodeManagerName + ">. Killing old servant."); try { PoolUtils.die(oldServant); } catch (RemoteException re) { log.info("Old servant wouldn't die! "); } } _registry.rebind(_nodeManagerName, manager); Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { public void run() { try { log.info("Shutting Down"); _registry.unbind(_nodeManagerName); } catch (Exception e) { e.printStackTrace(); } } })); } boolean javajob = System.getProperty("job") != null && System.getProperty("job").equalsIgnoreCase("java"); if (javajob) { initKillWorker(); initCreateWorker(); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.ublog.benchmark.social.SocialBenchmark.java
private GraphInterface getRemoteGraphServer(String serverName, int serverPort) { if (System.getSecurityManager() == null) { System.setSecurityManager(new RMISecurityManager()); }/*from www .j a va 2s . c o m*/ try { if (logger.isInfoEnabled()) { logger.info("Trying to connect to graph server"); } Registry reg = LocateRegistry.getRegistry(serverName, serverPort); System.out.println("reg " + reg.list().toString()); return (GraphInterface) reg.lookup("Graph"); } catch (NotBoundException ex) { Logger.getLogger("global").log(null, ex); return null; } catch (RemoteException ex) { ex.printStackTrace(); Logger.getLogger("global").log(null, ex); return null; } }