Refine search
/** Update single parent to child relationship. * @param parent The parent of the child. * @param oldChild The previous value of the child. If this is non null and differs from <code>child</code>, then a remove event is generated. * @param child The current child. If this is non null and differs from <code>oldChild</code>, then an add event is generated. * @param relationship The name of the relationship * @param addRemove If true add/remove is called for the new/old children as well as the relationships */ public void update(Object parent, Object oldChild, final Object child, String relationship,boolean addRemove) { if (oldChild!=null && !oldChild.equals(child)) { remove(parent,oldChild,relationship); if (addRemove) removeBean(oldChild); } if (child!=null && !child.equals(oldChild)) { if (addRemove) addBean(child); add(parent,child,relationship); } }
/** * @param threadPool The threadPool to set. */ public void setThreadPool(ThreadPool threadPool) { if (_threadPool!=null) removeBean(_threadPool); _container.update(this, _threadPool, threadPool, "threadpool",false); _threadPool = threadPool; if (_threadPool!=null) addBean(_threadPool); }
public void setServer(Server server) { Server old_server=_server; if (old_server!=null && old_server!=server) old_server.getContainer().removeBean(this); _server=server; if (_server!=null && _server!=old_server) _server.getContainer().addBean(this); }
/** Update single parent to child relationship. * @param parent The parent of the child. * @param oldChild The previous value of the child. If this is non null and differs from <code>child</code>, then a remove event is generated. * @param child The current child. If this is non null and differs from <code>oldChild</code>, then an add event is generated. * @param relationship The name of the relationship */ public void update(Object parent, Object oldChild, final Object child, String relationship) { if (oldChild!=null && !oldChild.equals(child)) remove(parent,oldChild,relationship); if (child!=null && !child.equals(oldChild)) add(parent,child,relationship); }
public static void run() throws Exception Server server = new Server(); SocketConnector connector = new SocketConnector(); connector.setSoLingerTime(-1); connector.setPort(8080); server.setConnectors(new Connector[] { connector }); server.getContainer().addEventListener(mBeanContainer); mBeanContainer.start();
DefaultHandler defaultHandler = null; server = new Server(); server.setSendServerVersion(getSendServerVersion()); server.getContainer().addEventListener(mBeanContainer);
connector.setMaxIdleTime(this.configuration.getConnectorMaxIdleTime()); ((AbstractConnector) connector).setSoLingerTime(this.configuration.getSoLingerTime()); Server server = new Server(); server.setThreadPool(new ThreadPoolWrapper()); server.setConnectors(new Connector[]{connector}); ContextHandlerCollection contexts = new ContextHandlerCollection(); HandlerCollection handlers = new HandlerCollection(); sslParams.put(getKey(url), isSsl ? ssl : null); if (mbeanContainer != null) { server.getContainer().addEventListener(mbeanContainer);
server = new Server(); server.getContainer().addEventListener(mbContainer); server.addBean(mbContainer); mbContainer.addBean(Log.getLog());
public static void addToAllConnectors(Server server) { for (Connector connector : server.getConnectors()) { if (connector instanceof Container) ((Container)connector).addBean(new ConnectorStatistics()); } }
@Override public void setServer(Server server) { super.setServer(server); server.getContainer().update(this, null, _selectorManager, "selectManager"); if (_privateThreadPool) server.getContainer().update(this, null, _privateThreadPool, "threadpool", true); else _threadPool = server.getThreadPool(); }
public void setManagedAttribute(String name, Object value) { Object old = _managedAttributes.put(name,value); getServer().getContainer().update(this,old,value,name,true); }
@Override public void addEventListener(Container.Listener listener) { if (_listeners.contains(listener)) return; _listeners.add(listener); // tell it about existing beans for (Bean b:_beans) { listener.beanAdded(this,b._bean); // handle inheritance if (listener instanceof InheritedListener && b.isManaged() && b._bean instanceof Container) { if (b._bean instanceof ContainerLifeCycle) ((ContainerLifeCycle)b._bean).addBean(listener, false); else ((Container)b._bean).addBean(listener); } } }
public void destroy() { if (!isStopped()) throw new IllegalStateException("!STOPPED"); super.destroy(); if (_server!=null) _server.getContainer().removeBean(this); }
private void unmanage(Bean bean) { if (bean._managed!=Managed.UNMANAGED) { if (bean._managed==Managed.MANAGED && bean._bean instanceof Container) { for (Container.Listener l:_listeners) { if (l instanceof InheritedListener) ((Container)bean._bean).removeBean(l); } } bean._managed=Managed.UNMANAGED; } }
_scanner.scan(); _scanner.start(); _contexts.getServer().getContainer().addBean(_scanner);
private void setupJmx(Container server, Environment env) { if (asList(env.getActiveProfiles()).contains(JMX)) { MBeanContainer mbContainer = new MBeanContainer(ManagementFactory.getPlatformMBeanServer()); server.addEventListener(mbContainer); server.addBean(mbContainer); } }
public void start() { ServletContainerFactory.registerContext(this); container.addEventListener(this); }
/** Update multiple parent to child relationship. * @param parent The parent of the child. * @param oldChildren The previous array of children. A remove event is generated for any child in this array but not in the <code>children</code> array. * This array is modified and children that remain in the new children array are nulled out of the old children array. * @param children The current array of children. An add event is generated for any child in this array but not in the <code>oldChildren</code> array. * @param relationship The name of the relationship */ public void update(Object parent, Object[] oldChildren, final Object[] children, String relationship) { update(parent,oldChildren,children,relationship,false); }
public static void addToAllConnectors(Server server) { for (Connector connector : server.getConnectors()) { if (connector instanceof Container) ((Container)connector).addBean(new ConnectorStatistics()); } }
@Override public void setServer(Server server) { super.setServer(server); server.getContainer().update(this, null, _selectorManager, "selectManager"); if (_privateThreadPool) server.getContainer().update(this, null, _privateThreadPool, "threadpool", true); else _threadPool = server.getThreadPool(); }