public void destroy() throws Exception { // END CR 6368085 if( ! initialized ) return; /* CR 6368085 initialized=false; */ // START CR 6368085 super.destroy(); // END CR 6368085 // if we created it, make sure it's also destroyed ((StandardService)service).destroy(); }
@Override public AccessLog getAccessLog() { if (accessLogScanComplete) { return accessLog; } Valve valves[] = getPipeline().getValves(); for (Valve valve : valves) { if (valve instanceof AccessLog) { accessLog = (AccessLog) valve; break; } } accessLogScanComplete = true; return accessLog; }
/** * Add a child Container, only if the proposed child is an implementation * of Host. * * @param child Child container to be added */ public void addChild(Container child) { if (!(child instanceof Host)) throw new IllegalArgumentException(rb.getString(LogFacade.CHILD_OF_ENGINE_MUST_BE_HOST_EXCEPTION)); super.addChild(child); }
@Override public final String toString() { StringBuilder sb = new StringBuilder(); Container parent = getParent(); if (parent != null) { sb.append(parent.toString()); sb.append('.'); } sb.append(this.getClass().getSimpleName()); sb.append('['); sb.append(getName()); sb.append(']'); return sb.toString(); }
@Override protected void initInternal() throws LifecycleException { BlockingQueue<Runnable> startStopQueue = new LinkedBlockingQueue<>(); startStopExecutor = new ThreadPoolExecutor( getStartStopThreadsInternal(), getStartStopThreadsInternal(), 10, TimeUnit.SECONDS, startStopQueue, new StartStopThreadFactory(getName() + "-startStop-")); startStopExecutor.allowCoreThreadTimeOut(true); super.initInternal(); }
/** * Log the specified message and exception to our current Logger * (if any). * * @param message Message to be logged * @param throwable Related exception */ protected void log(String message, Throwable throwable) { message = neutralizeForLog(message); org.apache.catalina.Logger logger = getLogger(); if (logger != null) logger.log(logName() + ": " + message, throwable); else { log.log(Level.SEVERE, message, throwable); } }
getLogger(); Cluster cluster = getClusterInternal(); if ((cluster != null) && (cluster instanceof Lifecycle)) ((Lifecycle) cluster).start(); Realm realm = getRealmInternal(); if ((realm != null) && (realm instanceof Lifecycle)) ((Lifecycle) realm).start(); Container children[] = findChildren(); List<Future<Void>> results = new ArrayList<>(); for (int i = 0; i < children.length; i++) { setState(LifecycleState.STARTING); threadStart();
log.info(sm.getString("containerBase.alreadyStarted", logName())); return; ((Lifecycle) loader).start(); logger = null; getLogger(); if ((logger != null) && (logger instanceof Lifecycle)) ((Lifecycle) logger).start(); Container children[] = findChildren(); for (int i = 0; i < children.length; i++) { if (children[i] instanceof Lifecycle) threadStart();
((Lifecycle) loader).start(); logger = null; getLogger(); if ((logger != null) && (logger instanceof Lifecycle)) ((Lifecycle) logger).start(); Container children[] = findChildren(); for (int i = 0; i < children.length; i++) { children[i].start(); setState(LifecycleState.STARTING); threadStart();
@Override protected void destroyInternal() throws LifecycleException { Realm realm = getRealmInternal(); if (realm instanceof Lifecycle) { ((Lifecycle) realm).destroy(); } Cluster cluster = getClusterInternal(); if (cluster instanceof Lifecycle) { ((Lifecycle) cluster).destroy(); } // Stop the Valves in our pipeline (including the basic), if any if (pipeline instanceof Lifecycle) { ((Lifecycle) pipeline).destroy(); } // Remove children now this container is being destroyed for (Container child : findChildren()) { removeChild(child); } // Required if the child is destroyed directly. if (parent != null) { parent.removeChild(this); } // If init fails, this may be null if (startStopExecutor != null) { startStopExecutor.shutdownNow(); } super.destroyInternal(); }
public void destroy() throws Exception { if( started ) { stop(); } initialized=false; // unregister this component if ( oname != null ) { try { if( controller == oname ) { Registry.getRegistry(null, null) .unregisterComponent(oname); if(log.isDebugEnabled()) log.debug("unregistering " + oname); } } catch( Throwable t ) { log.error("Error unregistering ", t ); } } if (parent != null) { parent.removeChild(this); } // Stop our child containers, if any Container children[] = findChildren(); for (int i = 0; i < children.length; i++) { removeChild(children[i]); } }
@Override protected void destroyInternal() throws LifecycleException { // Stop the Valves in our pipeline (including the basic), if any if (pipeline instanceof Lifecycle) { ((Lifecycle) pipeline).destroy(); } // Remove children now this container is being destroyed for (Container child : findChildren()) { removeChild(child); } // Required if the child is destroyed directly. if (parent != null) { parent.removeChild(this); } super.destroyInternal(); }
/** * Remove the specified Valve from the pipeline associated with this * Container, if it is found; otherwise, do nothing. * * @param valve Valve to be removed */ public synchronized void removeValve(Valve valve) { pipeline.removeValve(valve); fireContainerEvent(REMOVE_VALVE_EVENT, valve); }
@Override public void addValve(GlassFishValve valve) { super.addValve(valve); if (valve instanceof SingleSignOn) { sso = (SingleSignOn) valve; } }
/** * Add a new child Container to those associated with this Container, * if supported. Prior to adding this Container to the set of children, * the child's <code>setParent()</code> method must be called, with this * Container as an argument. This method may thrown an * <code>IllegalArgumentException</code> if this Container chooses not * to be attached to the specified Container, in which case it is not added * * @param child New child Container to be added * * @exception IllegalArgumentException if this exception is thrown by * the <code>setParent()</code> method of the child Container * @exception IllegalArgumentException if the new child does not have * a name unique from that of existing children of this Container * @exception IllegalStateException if this Container does not support * child Containers */ @Override public void addChild(Container child) { if (Globals.IS_SECURITY_ENABLED) { PrivilegedAction<Void> dp = new PrivilegedAddChild(child); AccessController.doPrivileged(dp); } else { addChildInternal(child); } }
domain = ((ContainerBase) container_).getDomain(); } else { domain = server.getDefaultDomain();
private void registerValve(Valve valve) { if( valve instanceof ValveBase && ((ValveBase)valve).getObjectName()==null ) { try { String domain=((ContainerBase)container).getDomain(); if( container instanceof StandardContext ) { domain=((StandardContext)container).getEngineName(); } if( container instanceof StandardWrapper) { Container ctx=((StandardWrapper)container).getParent(); domain=((StandardContext)ctx).getEngineName(); } ObjectName vname=((ValveBase)valve).createObjectName( domain, ((ContainerBase)container).getJmxName()); if( vname != null ) { ((ValveBase)valve).setObjectName(vname); Registry.getRegistry(null, null).registerComponent (valve, vname, valve.getClass().getName()); ((ValveBase)valve).setController (((ContainerBase)container).getJmxName()); } } catch( Throwable t ) { log.info( "Can't register valve " + valve , t ); } } }
/** * Return the abbreviated name of this container for logging messages */ protected String logName() { String className = this.getClass().getName(); int period = className.lastIndexOf("."); if (period >= 0) className = className.substring(period + 1); return (className + "[" + getName() + "]"); }
/** * Starts the children of this container. */ protected void startChildren() { Container children[] = findChildren(); for (int i = 0; i < children.length; i++) { if (children[i] instanceof Lifecycle) { try { ((Lifecycle) children[i]).start(); } catch (Throwable t) { String msg = MessageFormat.format(rb.getString(LogFacade.CONTAINER_NOT_STARTED_EXCEPTION), children[i]); log.log(Level.SEVERE, msg, t); if (children[i] instanceof Context) { ((Context) children[i]).setAvailable(false); } else if (children[i] instanceof Wrapper) { ((Wrapper) children[i]).setAvailable(Long.MAX_VALUE); } } } } }
getLogger(); Cluster cluster = getClusterInternal(); if (cluster instanceof Lifecycle) { ((Lifecycle) cluster).start(); Realm realm = getRealmInternal(); if (realm instanceof Lifecycle) { ((Lifecycle) realm).start(); Container children[] = findChildren(); List<Future<Void>> results = new ArrayList<>(); for (int i = 0; i < children.length; i++) { setState(LifecycleState.STARTING); threadStart();