本文整理了Java中org.apache.catalina.Container.setParent()
方法的一些代码示例,展示了Container.setParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Container.setParent()
方法的具体详情如下:
包路径:org.apache.catalina.Container
类名称:Container
方法名:setParent
[英]Set the parent Container to which this Container is being added as a child. This Container may refuse to become attached to the specified Container by throwing an exception.
[中]
代码示例来源:origin: org.glassfish.main.web/web-core
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);
}
}
}
代码示例来源:origin: tomcat/catalina
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);
}
}
代码示例来源:origin: jboss.web/jbossweb
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);
}
代码示例来源:origin: org.jboss.web/jbossweb
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);
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina
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);
}
代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core
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);
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
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);
}
}
代码示例来源:origin: codefollower/Tomcat-Research
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);
}
代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina
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);
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
child.getName() +
"' is not unique");
child.setParent(this); // May throw IAE
children.put(child.getName(), child);
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
child.getName() +
"' is not unique");
child.setParent(this); // May throw IAE
children.put(child.getName(), child);
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
child.getName() +
"' is not unique");
child.setParent(this); // May throw IAE
children.put(child.getName(), child);
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
child.setParent(null);
try {
代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9
child.setParent(null);
try {
代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7
child.setParent(null);
try {
内容来源于网络,如有侵权,请联系作者删除!