/** * Deregister the MBean for this * <code>Valve</code> object. * * @param valve The Valve to be managed * * @exception Exception if an MBean cannot be deregistered * @deprecated Unused. Will be removed in Tomcat 8.0.x */ @Deprecated static void destroyMBean(Valve valve, Container container) throws Exception { ((Contained)valve).setContainer(container); String mname = createManagedName(valve); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, valve); try { ((Contained)valve).setContainer(null); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } if( mserver.isRegistered(oname) ) { mserver.unregisterMBean(oname); } }
/** * Deregister the MBean for this * <code>Valve</code> object. * * @param valve The Valve to be managed * * @exception Exception if an MBean cannot be deregistered */ static void destroyMBean(Valve valve, Container container) throws Exception { ((Contained)valve).setContainer(container); String mname = createManagedName(valve); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, valve); try { ((Contained)valve).setContainer(null); } catch (Throwable t) { ; } if( mserver.isRegistered(oname) ) { mserver.unregisterMBean(oname); } }
/** * Deregister the MBean for this * <code>Valve</code> object. * * @param valve The Valve to be managed * * @exception Exception if an MBean cannot be deregistered */ public static void destroyMBean(Valve valve, Container container) throws Exception { ((Contained)valve).setContainer(container); String mname = createManagedName(valve); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, valve); try { ((Contained)valve).setContainer(null); } catch (Throwable t) { ; } mserver.unregisterMBean(oname); }
/** * <p>Add a new Valve to the end of the pipeline associated with this * Container. Prior to adding the Valve, the Valve's * <code>setContainer()</code> method will be called, if it implements * <code>Contained</code>, with the owning Container as an argument. * The method may throw an * <code>IllegalArgumentException</code> if this Valve chooses not to * be associated with this Container, or <code>IllegalStateException</code> * if it is already associated with a different Container.</p> * * @param valve Valve to be added * * @exception IllegalArgumentException if this Container refused to * accept the specified Valve * @exception IllegalArgumentException if the specifie Valve refuses to be * associated with this Container * @exception IllegalStateException if the specified Valve is already * associated with a different Container */ public void addValve(Valve valve) { // Validate that we can add this Valve if (valve instanceof Contained) ((Contained) valve).setContainer(this.container); // Start the new component if necessary if (started && (valve instanceof Lifecycle)) { try { ((Lifecycle) valve).start(); } catch (LifecycleException e) { log("StandardPipeline.addValve: start: ", e); } } // Add this Valve to the set associated with this Pipeline synchronized (valves) { Valve results[] = new Valve[valves.length +1]; System.arraycopy(valves, 0, results, 0, valves.length); results[valves.length] = valve; valves = results; } }
/** * Deregister the MBean for this <code>Valve</code> object. * * @param valve * The Valve to be managed * * @exception Exception * if an MBean cannot be deregistered * @deprecated Unused. Will be removed in Tomcat 8.0.x */ @Deprecated static void destroyMBean(Valve valve, Container container) throws Exception { ((Contained) valve).setContainer(container); String mname = createManagedName(valve); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, valve); try { ((Contained) valve).setContainer(null); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } if (mserver.isRegistered(oname)) { mserver.unregisterMBean(oname); } }
/** * Deregister the MBean for this * <code>Valve</code> object. * * @param valve The Valve to be managed * * @exception Exception if an MBean cannot be deregistered */ static void destroyMBean(Valve valve, Container container) throws Exception { ((Contained)valve).setContainer(container); String mname = createManagedName(valve); ManagedBean managed = registry.findManagedBean(mname); if (managed == null) { return; } String domain = managed.getDomain(); if (domain == null) domain = mserver.getDefaultDomain(); ObjectName oname = createObjectName(domain, valve); try { ((Contained)valve).setContainer(null); } catch (Throwable t) { ExceptionUtils.handleThrowable(t); } if( mserver.isRegistered(oname) ) { mserver.unregisterMBean(oname); } }
/** * <p>Add a new Valve to the end of the pipeline associated with this * Container. Prior to adding the Valve, the Valve's * <code>setContainer()</code> method will be called, if it implements * <code>Contained</code>, with the owning Container as an argument. * The method may throw an * <code>IllegalArgumentException</code> if this Valve chooses not to * be associated with this Container, or <code>IllegalStateException</code> * if it is already associated with a different Container.</p> * * @param valve Valve to be added * * @exception IllegalArgumentException if this Container refused to * accept the specified Valve * @exception IllegalArgumentException if the specified Valve refuses to be * associated with this Container * @exception IllegalStateException if the specified Valve is already * associated with a different Container */ @Override public void addValve(Valve valve) { // Validate that we can add this Valve if (valve instanceof Contained) ((Contained) valve).setContainer(this.container); // Start the new component if necessary if (getState().isAvailable()) { if (valve instanceof Lifecycle) { try { ((Lifecycle) valve).start(); } catch (LifecycleException e) { log.error("StandardPipeline.addValve: start: ", e); } } } // Add this Valve to the set associated with this Pipeline if (first == null) { first = valve; valve.setNext(basic); } else { Valve current = first; while (current != null) { if (current.getNext() == basic) { current.setNext(valve); valve.setNext(basic); break; } current = current.getNext(); } } container.fireContainerEvent(Container.ADD_VALVE_EVENT, valve); }
/** * <p>Add a new Valve to the end of the pipeline associated with this * Container. Prior to adding the Valve, the Valve's * <code>setContainer()</code> method will be called, if it implements * <code>Contained</code>, with the owning Container as an argument. * The method may throw an * <code>IllegalArgumentException</code> if this Valve chooses not to * be associated with this Container, or <code>IllegalStateException</code> * if it is already associated with a different Container.</p> * * @param valve Valve to be added * * @exception IllegalArgumentException if this Container refused to * accept the specified Valve * @exception IllegalArgumentException if the specifie Valve refuses to be * associated with this Container * @exception IllegalStateException if the specified Valve is already * associated with a different Container */ public void addValve(Valve valve) { // Validate that we can add this Valve if (valve instanceof Contained) ((Contained) valve).setContainer(this.container); // Start the new component if necessary if (started) { if (valve instanceof Lifecycle) { try { ((Lifecycle) valve).start(); } catch (LifecycleException e) { log.error("StandardPipeline.addValve: start: ", e); } } // Register the newly added valve registerValve(valve); } // Add this Valve to the set associated with this Pipeline if (first == null) { first = valve; valve.setNext(basic); } else { Valve current = first; while (current != null) { if (current.getNext() == basic) { current.setNext(valve); valve.setNext(basic); break; } current = current.getNext(); } } }
/** * Remove the specified Valve from the pipeline associated with this * Container, if it is found; otherwise, do nothing. If the Valve is * found and removed, the Valve's <code>setContainer(null)</code> method * will be called if it implements <code>Contained</code>. * * @param valve Valve to be removed */ public void removeValve(Valve valve) { Valve current; if(first == valve) { first = first.getNext(); current = null; } else { current = first; } while (current != null) { if (current.getNext() == valve) { current.setNext(valve.getNext()); break; } current = current.getNext(); } if (first == basic) first = null; if (valve instanceof Contained) ((Contained) valve).setContainer(null); // Stop this valve if necessary if (started) { if (valve instanceof Lifecycle) { try { ((Lifecycle) valve).stop(); } catch (LifecycleException e) { log.error("StandardPipeline.removeValve: stop: ", e); } } // Unregister the removed valave unregisterValve(valve); } }
/** * <p> * Add a new Valve to the end of the pipeline associated with this * Container. Prior to adding the Valve, the Valve's * <code>setContainer()</code> method will be called, if it implements * <code>Contained</code>, with the owning Container as an argument. The * method may throw an <code>IllegalArgumentException</code> if this Valve * chooses not to be associated with this Container, or * <code>IllegalStateException</code> if it is already associated with a * different Container. * </p> * * @param valve * Valve to be added * * @exception IllegalArgumentException * if this Container refused to accept the specified Valve * @exception IllegalArgumentException * if the specified Valve refuses to be associated with this * Container * @exception IllegalStateException * if the specified Valve is already associated with a * different Container */ @Override public void addValve(Valve valve) { // Validate that we can add this Valve if (valve instanceof Contained) ((Contained) valve).setContainer(this.container); // Start the new component if necessary if (getState().isAvailable()) { if (valve instanceof Lifecycle) { try { ((Lifecycle) valve).start(); } catch (LifecycleException e) { log.error("StandardPipeline.addValve: start: ", e); } } } // Add this Valve to the set associated with this Pipeline if (first == null) { first = valve; valve.setNext(basic); } else { Valve current = first; while (current != null) { if (current.getNext() == basic) { current.setNext(valve); valve.setNext(basic); break; } current = current.getNext(); } } container.fireContainerEvent(Container.ADD_VALVE_EVENT, valve); }
public void addValve(Valve valve) { if (valve instanceof Contained) ((Contained) valve).setContainer(this.container); synchronized (valves) { Valve results[] = new Valve[valves.length +1]; System.arraycopy(valves, 0, results, 0, valves.length); results[valves.length] = valve; valves = results; } }
@Override public void setContainer(final Container container) { this.container = container; if (delegate != null && Contained.class.isInstance(delegate)) { Contained.class.cast(delegate).setContainer(container); } }
/** * Remove the specified Valve from the pipeline associated with this * Container, if it is found; otherwise, do nothing. If the Valve is * found and removed, the Valve's <code>setContainer(null)</code> method * will be called if it implements <code>Contained</code>. * * @param valve Valve to be removed */ public void removeValve(Valve valve) { synchronized (valves) { // Locate this Valve in our list int j = -1; for (int i = 0; i < valves.length; i++) { if (valve == valves[i]) { j = i; break; } } if (j < 0) return; // Remove this valve from our list Valve results[] = new Valve[valves.length - 1]; int n = 0; for (int i = 0; i < valves.length; i++) { if (i == j) continue; results[n++] = valves[i]; } valves = results; try { if (valve instanceof Contained) ((Contained) valve).setContainer(null); } catch (Throwable t) { ; } } // Stop this valve if necessary if (started && (valve instanceof Lifecycle)) { try { ((Lifecycle) valve).stop(); } catch (LifecycleException e) { log("StandardPipeline.removeValve: stop: ", e); } } }
public void setBasic(Valve valve) { this.basic = valve; ((Contained) valve).setContainer(container); }