1 10 package org.exoplatform.container.jmx; 11 12 import org.exoplatform.container.ExoContainer; 13 import org.picocontainer.PicoContainer; 14 import org.picocontainer.defaults.AbstractComponentAdapter; 15 22 public class MX4JComponentAdapter extends AbstractComponentAdapter { 23 24 private Object instance_ ; 25 26 public MX4JComponentAdapter(Object key, Class implementation) { 27 super(key, implementation) ; 28 } 29 30 public Object getComponentInstance(PicoContainer container) { 31 if(instance_ != null ) return instance_ ; 32 ExoContainer exocontainer = (ExoContainer) container ; 33 try { 34 synchronized(container) { 35 instance_ = exocontainer.createComponent(getComponentImplementation()) ; 36 exocontainer.manageMBean(this.getComponentKey(), instance_) ; 37 } 38 } catch (Exception ex) { 39 throw new RuntimeException ("Cannot instantiate component " + getComponentImplementation(), ex) ; 40 } 41 return instance_ ; 42 } 43 44 public void verify(PicoContainer container) { } 45 } | Popular Tags |