@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); } } }
private void manage(Bean bean) { if (bean._managed!=Managed.MANAGED) { bean._managed=Managed.MANAGED; if (bean._bean instanceof Container) { for (Container.Listener l:_listeners) { if (l instanceof InheritedListener) { if (bean._bean instanceof ContainerLifeCycle) ((ContainerLifeCycle)bean._bean).addBean(l,false); else ((Container)bean._bean).addBean(l); } } } if (bean._bean instanceof AbstractLifeCycle) { ((AbstractLifeCycle)bean._bean).setStopTimeout(getStopTimeout()); } } }
public static void addToAllConnectors(Server server) { for (Connector connector : server.getConnectors()) { if (connector instanceof Container) ((Container)connector).addBean(new ConnectorStatistics()); } }
public static void addToAllConnectors(Server server) { for (Connector connector : server.getConnectors()) { if (connector instanceof Container) ((Container)connector).addBean(new ConnectionStatistics()); } } }
public static void addToAllConnectors(Server server) { for (Connector connector : server.getConnectors()) { if (connector instanceof Container) ((Container)connector).addBean(new ConnectorStatistics()); } }
public static void addToAllConnectors(Server server) { for (Connector connector : server.getConnectors()) { if (connector instanceof Container) ((Container)connector).addBean(new ConnectorStatistics()); } }
/** * Add an associated bean. * The bean will be added to the servers {@link Container} * and if it is a {@link LifeCycle} instance, it will be * started/stopped along with the Server. Any beans that are also * {@link Destroyable}, will be destroyed with the server. * @param o the bean object to add */ @Override public boolean addBean(Object o) { if (super.addBean(o)) { _container.addBean(o); return true; } return false; }
/** * Add an associated bean. * The bean will be added to the servers {@link Container} * and if it is a {@link LifeCycle} instance, it will be * started/stopped along with the Server. Any beans that are also * {@link Destroyable}, will be destroyed with the server. * @param o the bean object to add */ @Override public boolean addBean(Object o) { if (super.addBean(o)) { _container.addBean(o); return true; } return false; }
/** * Add an associated bean. * The bean will be added to the servers {@link Container} * and if it is a {@link LifeCycle} instance, it will be * started/stopped along with the Server. Any beans that are also * {@link Destroyable}, will be destroyed with the server. * @param o the bean object to add */ @Override public boolean addBean(Object o) { if (super.addBean(o)) { _container.addBean(o); return true; } return false; }
/** * Add an associated bean. * The bean will be added to the servers {@link Container} * and if it is a {@link LifeCycle} instance, it will be * started/stopped along with the Server. Any beans that are also * {@link Destroyable}, will be destroyed with the server. * @param o the bean object to add */ @Override public boolean addBean(Object o) { if (super.addBean(o)) { _container.addBean(o); return true; } return false; }
/** * Add an associated bean. * The bean will be added to the servers {@link Container} * and if it is a {@link LifeCycle} instance, it will be * started/stopped along with the Server. Any beans that are also * {@link Destroyable}, will be destroyed with the server. * @param o the bean object to add */ @Override public boolean addBean(Object o) { if (super.addBean(o)) { _container.addBean(o); return true; } return false; }
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); } }
/** 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); } }
@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); } } }
/** 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); } }
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); }
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); }
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); }
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); }
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); }