public NamingContextInfo[] copyNamingContexts(Object serverId) throws NamingException { if (Trace.logger.isLoggable(BasicLevel.DEBUG)) Trace.logger.log(BasicLevel.DEBUG, "ContextManager.getNamingContexts(" + serverId + ')'); Vector contexts = new Vector(); Enumeration nameEnum = storageManager.getContextNames(); Enumeration idEnum = storageManager.getContextIds(); while (idEnum.hasMoreElements()) { NamingContextId ncid = (NamingContextId)idEnum.nextElement(); CompositeName name = (CompositeName)nameEnum.nextElement(); NamingContext nc = getNamingContext(ncid, false); if (nc.getOwnerId().equals(serverId)) { NamingContext ncCopy = (NamingContext)nc.clone(); contexts.addElement( new NamingContextInfo(ncCopy, name)); } } NamingContextInfo[] res = new NamingContextInfo[contexts.size()]; contexts.copyInto(res); return res; }
public void addNamingContext(NamingContextInfo ncInfo) throws NamingException { if (Trace.logger.isLoggable(BasicLevel.DEBUG)) Trace.logger.log(BasicLevel.DEBUG, "ContextManager.addNamingContext(" + ncInfo + ')'); NamingContext nc = ncInfo.getNamingContext(); CompositeName name = ncInfo.getCompositeName(); storageManager.addNamingContext( nc, name); put(nc); put(name, nc); }
private void onUpdateEvent(AgentId from, ChangeOwnerEvent evt) throws NamingException { if (Trace.logger.isLoggable(BasicLevel.DEBUG)) Trace.logger.log(BasicLevel.DEBUG, "ReplicationManager.onUpdateEvent(" + from + ',' + evt + ')'); NamingContextInfo[] contexts = evt.getNamingContexts(); for (int i = 0; i < contexts.length; i++) { NamingContext nc = getServerImpl().getNamingContext( contexts[i].getNamingContext().getId()); if (nc == null) { // The InitJndiServerNot sent by // the server that created this context may not // have been received. getServerImpl().addNamingContext(contexts[i]); // TODO : NTA uncomment and implement retryRequestsWaitingForMissingContext // retryRequestsWaitingForMissingContext( // contexts[i].getNamingContext().getId()); } else { nc.setOwnerId(contexts[i].getNamingContext().getOwnerId()); getServerImpl().resetNamingContext( contexts[i].getNamingContext()); // DF: must retry the sync and write // requests to the new owner. } } }
private void onUpdateEvent(AgentId from, ChangeOwnerEvent evt) throws NamingException { if (Trace.logger.isLoggable(BasicLevel.DEBUG)) Trace.logger.log(BasicLevel.DEBUG, "ReplicationManager.onUpdateEvent(" + from + ',' + evt + ')'); NamingContextInfo[] contexts = evt.getNamingContexts(); for (int i = 0; i < contexts.length; i++) { NamingContext nc = getServerImpl().getNamingContext( contexts[i].getNamingContext().getId()); if (nc == null) { // The InitJndiServerNot sent by // the server that created this context may not // have been received. getServerImpl().addNamingContext(contexts[i]); // TODO : NTA uncomment and implement retryRequestsWaitingForMissingContext // retryRequestsWaitingForMissingContext( // contexts[i].getNamingContext().getId()); } else { nc.setOwnerId(contexts[i].getNamingContext().getOwnerId()); getServerImpl().resetNamingContext( contexts[i].getNamingContext()); // DF: must retry the sync and write // requests to the new owner. } } }
public void addNamingContext(NamingContextInfo ncInfo) throws NamingException { if (Trace.logger.isLoggable(BasicLevel.DEBUG)) Trace.logger.log(BasicLevel.DEBUG, "ContextManager.addNamingContext(" + ncInfo + ')'); NamingContext nc = ncInfo.getNamingContext(); CompositeName name = ncInfo.getCompositeName(); storageManager.addNamingContext( nc, name); put(nc); put(name, nc); }
public NamingContextInfo[] copyNamingContexts(Object serverId) throws NamingException { if (Trace.logger.isLoggable(BasicLevel.DEBUG)) Trace.logger.log(BasicLevel.DEBUG, "ContextManager.getNamingContexts(" + serverId + ')'); Vector contexts = new Vector(); Enumeration nameEnum = storageManager.getContextNames(); Enumeration idEnum = storageManager.getContextIds(); while (idEnum.hasMoreElements()) { NamingContextId ncid = (NamingContextId)idEnum.nextElement(); CompositeName name = (CompositeName)nameEnum.nextElement(); NamingContext nc = getNamingContext(ncid, false); if (nc.getOwnerId().equals(serverId)) { NamingContext ncCopy = (NamingContext)nc.clone(); contexts.addElement( new NamingContextInfo(ncCopy, name)); } } NamingContextInfo[] res = new NamingContextInfo[contexts.size()]; contexts.copyInto(res); return res; }
if(!looseCoupling) { NamingContext nc = getServerImpl().getNamingContext( contexts[i].getNamingContext().getId()); if (nc == null) { getServerImpl().addNamingContext(contexts[i]); newNames.addElement(contexts[i].getCompositeName()); NamingContext nc; try{ nc = getServerImpl().getNamingContext(contexts[i].getCompositeName()); }catch(MissingRecordException mre){ nc=null; nc = getServerImpl().newNamingContext( getId(),null,contexts[i].getCompositeName()); contexts[i].getNamingContext().setOwnerId(getId()); Enumeration enumRecord = contexts[i].getNamingContext().getEnumRecord(); while (enumRecord.hasMoreElements()) { Record record =(Record) enumRecord.nextElement(); nc.addRecord(record); if(record instanceof ContextRecord){ CompositeName parentPath = contexts[i].getCompositeName(); record_compositeName.put(record,parentPath); composite_context.put(contexts[i].getCompositeName(),nc);
public NamingContextInfo[] changeOwner( CompositeName cn, Object formerOwnerId, Object newOwnerId) throws NamingException { Vector updatedContexts = new Vector(); Enumeration idEnum = storageManager.getContextIds(); Enumeration nameEnum = storageManager.getContextNames(); while (idEnum.hasMoreElements()) { NamingContextId ncid = (NamingContextId)idEnum.nextElement(); CompositeName name = (CompositeName)nameEnum.nextElement(); NamingContext nc = getNamingContext(ncid, false); if (nc.getOwnerId().equals(formerOwnerId) && (name.equals(cn) || cn == null)) { nc.setOwnerId(newOwnerId); storageManager.storeNamingContext(nc); updatedContexts.addElement( new NamingContextInfo(nc, name)); reloadMBean(nc); } } NamingContextInfo[] res = new NamingContextInfo[updatedContexts.size()]; updatedContexts.copyInto(res); return res; }
for (int i = 0; i < contexts.length; i++) { if(!looseCoupling) { NamingContext nc = getServerImpl().getNamingContext( contexts[i].getNamingContext().getId()); if (nc == null) { getServerImpl().addNamingContext(contexts[i]); newNames.addElement(contexts[i].getCompositeName()); NamingContext nc; try{ nc = getServerImpl().getNamingContext(contexts[i].getCompositeName()); }catch(MissingRecordException mre){ nc=null; nc = getServerImpl().newNamingContext( getId(),null,contexts[i].getCompositeName()); contexts[i].getNamingContext().setOwnerId(getId()); Enumeration enumRecord = contexts[i].getNamingContext().getEnumRecord(); while (enumRecord.hasMoreElements()) { Record record =(Record) enumRecord.nextElement(); nc.addRecord(record); if(record instanceof ContextRecord){ CompositeName parentPath = contexts[i].getCompositeName(); record_compositeName.put(record,parentPath); composite_context.put(contexts[i].getCompositeName(),nc);
public NamingContextInfo[] changeOwner( CompositeName cn, Object formerOwnerId, Object newOwnerId) throws NamingException { Vector updatedContexts = new Vector(); Enumeration idEnum = storageManager.getContextIds(); Enumeration nameEnum = storageManager.getContextNames(); while (idEnum.hasMoreElements()) { NamingContextId ncid = (NamingContextId)idEnum.nextElement(); CompositeName name = (CompositeName)nameEnum.nextElement(); NamingContext nc = getNamingContext(ncid, false); if (nc.getOwnerId().equals(formerOwnerId) && (name.equals(cn) || cn == null)) { nc.setOwnerId(newOwnerId); storageManager.storeNamingContext(nc); updatedContexts.addElement( new NamingContextInfo(nc, name)); reloadMBean(nc); } } NamingContextInfo[] res = new NamingContextInfo[updatedContexts.size()]; updatedContexts.copyInto(res); return res; }