/** {@inheritDoc} */ public ManagedGroup addChild(String name, String description) { mainLock.lock(); try { beforeMutableOperationInner(); return new DefaultManagedGroup(this, name, description); } finally { mainLock.unlock(); } }
/** {@inheritDoc} */ Object getRegistrant() { return ManagementUtil.from(getName(), getDescription(), attributes, ops); } }
/** {@inheritDoc} */ public synchronized ManagedGroup add(Object o) { if (o == null) { throw new NullPointerException("o is null"); } mainLock.lock(); try { beforeMutableOperationInner(); if (isRegistered()) { throw new IllegalStateException("Cannot add objects when this group is registered"); } BeanInfo bi; try { bi = Introspector.getBeanInfo(o.getClass()); } catch (java.beans.IntrospectionException e) { // /CLOVER:OFF throw new IllegalArgumentException(e); // cannot happen // /CLOVER:ON } attributes.putAll(DefaultManagedAttribute.fromPropertyDescriptors(bi.getPropertyDescriptors(), o)); ops.putAll(DefaultManagedOperation.fromMethodDescriptors(bi.getMethodDescriptors(), o)); os.add(o); return this; } finally { mainLock.unlock(); } }