/** * Stop the registry. After the call, this object is useless. * @throws NoSuchObjectException if the registry has not been exported. */ public synchronized void stop() throws NoSuchObjectException { if (TraceCarol.isDebugCmiRegistry()) { TraceCarol.debugCmiRegistry("killer is stopping registry on port " + port); } LowerOrb.unexportObject(impl); impl = null; } }
public Remote lookup(String n) throws NotBoundException, RemoteException { Object obj; synchronized (lreg) { obj = lreg.get(n); } if (obj != null) { if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("local lookup of " + n); return (Remote) obj; } try { if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("global lookup of " + n); Remote cs = (Remote) DistributedEquiv.getGlobal(REG_PREFIX + n); if (cs != null) { if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("returned a cluster stub"); return cs; } } catch (ConfigException e) { throw new RemoteException(e.toString()); } throw new NotBoundException(n); }
public void unbind(String n) throws NotBoundException, RemoteException { Object obj; synchronized (lreg) { obj = lreg.remove(n); if (obj != null) { if (TraceCarol.isDebugCmiRegistry()) { TraceCarol.debugCmiRegistry("Local unbind of " + n); } return; } if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("Global unbind of " + n); try { if (!DistributedEquiv.unexportObject(REG_PREFIX + n)) { throw new NotBoundException(n); } } catch (ConfigException e) { throw new RemoteException(e.toString()); } } }
try { cc = ClusterObject.getClusterConfig(obj); if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("Global bind of " + n); } catch (Exception e) { if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("Local bind of " + n);
public void rebind(String n, Remote obj) throws RemoteException { Object cur; ClusterConfig cc = null; try { cc = ClusterObject.getClusterConfig(obj); if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("Global rebind of " + n); } catch (Exception e) { if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("Local rebind of " + n); } synchronized (lreg) { if (cc == null) { lreg.put(n, obj); } else { if (!cc.isGlobalAtBind()) { throw new RemoteException("not implemented"); } try { String name = REG_PREFIX + n; DistributedEquiv.unexportObject(name); DistributedEquiv.exportObject(name, obj); } catch (ConfigException e) { throw new RemoteException(e.toString()); } } } }
public static ClusterRegistryKiller start(int port) throws RemoteException { if (TraceCarol.isDebugCmiRegistry()) TraceCarol.debugCmiRegistry("registry starting on port " + port); ClusterRegistryImpl creg = new ClusterRegistryImpl(); ClusterRegistry stub = (ClusterRegistry) LowerOrb.exportRegistry(creg, port); ClusterRegistryKiller k = new ClusterRegistryKiller(creg, port); return k; }