private void addChildInternal(Container child) { if(log.isLoggable(Level.FINEST)) log.log(Level.FINEST, "Add child " + child + " " + this); synchronized(children) { if (children.get(child.getName()) != null) { String msg = MessageFormat.format(rb.getString(LogFacade.DUPLICATE_CHILD_NAME_EXCEPTION), child.getName()); throw new IllegalArgumentException(msg); } child.setParent(this); // May throw IAE if (started && (child instanceof Lifecycle)) { try { ((Lifecycle) child).start(); } catch (LifecycleException e) { log.log(Level.SEVERE, LogFacade.CONTAINER_BASE_ADD_CHILD_START, e); throw new IllegalStateException (rb.getString(LogFacade.CONTAINER_BASE_ADD_CHILD_START) + e); } } children.put(child.getName(), child); if (notifyContainerListeners) { fireContainerEvent(ADD_CHILD_EVENT, child); } } }
private void addChildInternal(Container child) { if( log.isDebugEnabled() ) log.debug("Add child " + child + " " + this); synchronized(children) { if (children.get(child.getName()) != null) throw new IllegalArgumentException("addChild: Child name '" + child.getName() + "' is not unique"); child.setParent(this); // May throw IAE children.put(child.getName(), child); // Start child if (started && (child instanceof Lifecycle)) { boolean success = false; try { ((Lifecycle) child).start(); success = true; } catch (LifecycleException e) { log.error("ContainerBase.addChild: start: ", e); throw new IllegalStateException ("ContainerBase.addChild: start: " + e); } finally { if (!success) { children.remove(child.getName()); } } } fireContainerEvent(ADD_CHILD_EVENT, child); } }
private synchronized void addChildInternal(Container child) { if( log.isDebugEnabled() ) log.debug("Add child " + child + " " + this); if (child.getName() == null) throw new IllegalArgumentException(sm.getString("containerBase.addChild.nullName")); if (children.get(child.getName()) != null) throw new IllegalArgumentException(sm.getString("containerBase.addChild.notUnique", child.getName())); child.setParent(this); // May throw IAE children.put(child.getName(), child); // Start child if (started && startChildren && (child instanceof Lifecycle)) { boolean success = false; try { ((Lifecycle) child).start(); success = true; } catch (LifecycleException e) { throw new IllegalStateException(sm.getString("containerBase.addChild.start", child.getName()), e); } finally { if (!success) { children.remove(child.getName()); } } } fireContainerEvent(ADD_CHILD_EVENT, child); }
private synchronized void addChildInternal(Container child) { if (child.getName() == null) throw MESSAGES.containerChildWithNullName(); if (children.get(child.getName()) != null) throw MESSAGES.containerChildNameNotUnique(child.getName()); child.setParent(this); // May throw IAE children.put(child.getName(), child); // Start child if (started && startChildren && (child instanceof Lifecycle)) { boolean success = false; try { ((Lifecycle) child).start(); success = true; } catch (LifecycleException e) { throw MESSAGES.containerChildStartFailed(child.getName(), e); } finally { if (!success) { children.remove(child.getName()); } } } fireContainerEvent(ADD_CHILD_EVENT, child); }
private void addChildInternal(Container child) { if( log.isDebugEnabled() ) log.debug("Add child " + child + " " + this); synchronized(children) { if (children.get(child.getName()) != null) throw new IllegalArgumentException("addChild: Child name '" + child.getName() + "' is not unique"); child.setParent(this); // May throw IAE children.put(child.getName(), child); } // Start child // Don't do this inside sync block - start can be a slow process and // locking the children object can cause problems elsewhere if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { try { child.start(); } catch (LifecycleException e) { log.error("ContainerBase.addChild: start: ", e); throw new IllegalStateException ("ContainerBase.addChild: start: " + e); } } fireContainerEvent(ADD_CHILD_EVENT, child); }
private void addChildInternal(Container child) { if( log.isDebugEnabled() ) log.debug("Add child " + child + " " + this); synchronized(children) { if (children.get(child.getName()) != null) throw new IllegalArgumentException("addChild: Child name '" + child.getName() + "' is not unique"); child.setParent(this); // May throw IAE children.put(child.getName(), child); } // Start child // Don't do this inside sync block - start can be a slow process and // locking the children object can cause problems elsewhere try { if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { child.start(); } } catch (LifecycleException e) { log.error("ContainerBase.addChild: start: ", e); throw new IllegalStateException("ContainerBase.addChild: start: " + e); } finally { fireContainerEvent(ADD_CHILD_EVENT, child); } }
private void addChildInternal(Container child) { if( log.isDebugEnabled() ) log.debug("Add child " + child + " " + this); synchronized(children) { if (children.get(child.getName()) != null) throw new IllegalArgumentException( sm.getString("containerbase.child.notUnique", child.getName())); child.setParent(this); // May throw IAE children.put(child.getName(), child); } // Start child // Don't do this inside sync block - start can be a slow process and // locking the children object can cause problems elsewhere try { if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { child.start(); } } catch (LifecycleException e) { throw new IllegalStateException(sm.getString("containerbase.child.start"), e); } finally { fireContainerEvent(ADD_CHILD_EVENT, child); } }
private void addChildInternal(Container child) { if( log.isDebugEnabled() ) log.debug("Add child " + child + " " + this); synchronized(children) { if (children.get(child.getName()) != null) throw new IllegalArgumentException("addChild: Child name '" + child.getName() + "' is not unique"); child.setParent(this); // May throw IAE children.put(child.getName(), child); } // Start child // Don't do this inside sync block - start can be a slow process and // locking the children object can cause problems elsewhere if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { try { child.start(); } catch (LifecycleException e) { log.error("ContainerBase.addChild: start: ", e); throw new IllegalStateException ("ContainerBase.addChild: start: " + e); } } fireContainerEvent(ADD_CHILD_EVENT, child); }
private void addChildInternal(Container child) { if( log.isDebugEnabled() ) log.debug("Add child " + child + " " + this); synchronized(children) { if (children.get(child.getName()) != null) throw new IllegalArgumentException("addChild: Child name '" + child.getName() + "' is not unique"); child.setParent(this); // May throw IAE children.put(child.getName(), child); } // Start child // Don't do this inside sync block - start can be a slow process and // locking the children object can cause problems elsewhere if ((getState().isAvailable() || LifecycleState.STARTING_PREP.equals(getState())) && startChildren) { try { child.start(); } catch (LifecycleException e) { log.error("ContainerBase.addChild: start: ", e); throw new IllegalStateException ("ContainerBase.addChild: start: " + e); } } fireContainerEvent(ADD_CHILD_EVENT, child); }
child.getName() + "' is not unique"); child.setParent(this); // May throw IAE children.put(child.getName(), child);
child.getName() + "' is not unique"); child.setParent(this); // May throw IAE children.put(child.getName(), child);
child.getName() + "' is not unique"); child.setParent(this); // May throw IAE children.put(child.getName(), child);
child.setParent(null); try {
child.setParent(null); try {
child.setParent(null); try {