/** * unregister this bean (and its participants) with the MBeanServer */ public void unregister() { for (LogRecordWrapper p : participants) JMXServer.getAgent().unregisterMBean(p.getName()); super.unregister(); }
public boolean unregisterMBean(String name) { try { getServer().unregisterMBean(new ObjectName(name)); return true; } catch (MalformedObjectNameException e) { tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_5(name, e); } catch (InstanceNotFoundException e) { tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_5(name, e); } catch (MBeanRegistrationException e) { // can't happen - none of our beans implement the MBeanRegistration interface tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_6(name, e); } return false; }
/** * register this bean (and its participants) with the MBeanServer */ public void register() { super.register(); for (LogRecordWrapper p : participants) JMXServer.getAgent().registerMBean(p.getName(), p); }
/** * Initialise the MBean */ public void start() { JMXServer.getAgent().registerMBean(STORE_MBEAN_NAME, this); }
public void unregister(String name) { if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("Unregistering: " + name); JMXServer.getAgent().unregisterMBean(name); }
public ObjectInstance registerMBean(String name, ObjStoreItemMBean bean) { try { if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debug("registering bean " + name); //tsLogger.i18NLogger.info_tools_osb_util_JMXServer_m_1(name); return getServer().registerMBean(bean, new ObjectName(name)); } catch (InstanceAlreadyExistsException e) { tsLogger.i18NLogger.info_tools_osb_util_JMXServer_m_2(name); } catch (javax.management.JMException e) { tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_3(name, e); } return null; }
public Set<ObjectName> queryNames(String name, QueryExp query) throws MalformedObjectNameException { return getServer().queryNames(new ObjectName(name), query); } }
/** * Construct a holder for Participant and Recovery Store proxies. There is one instance for each connection * to a JVM. In practice there will only ever be one instance. * * @param serviceUrl the url for the MBean server to connect to. Use default to connect to the local MBean Server * @param listener optionally register a listener for notifications * @throws JMException if there are JMX errors during registration of MBeans and notification listeners * @throws IOException if there are errors on the connection to the MBean Server */ private StoreManagerProxy(String serviceUrl, NotificationListener listener) throws JMException, IOException { if ("default".equals(serviceUrl)) { mbsc = JMXServer.getAgent().getServer(); } else { // create an RMI connector JMXServiceURL url = new JMXServiceURL(serviceUrl); // connect to the target MBean server jmxc = JMXConnectorFactory.connect(url, null); mbsc = jmxc.getMBeanServerConnection(); } recoveryStoreON = ObjectName.getInstance(RECOVERY_BEAN_NAME); participantStoreON = ObjectName.getInstance(PARTICIPANT_BEAN_NAME); rsProxy = new RecoveryStoreProxy(JMX.newMBeanProxy( mbsc, recoveryStoreON, RecoveryStoreBeanMBean.class, true)); psProxy = new ParticipantStoreProxy(JMX.newMBeanProxy( mbsc, participantStoreON, ParticipantStoreBeanMBean.class, true)); if (listener != null) { mbsc.addNotificationListener(recoveryStoreON, listener, null, null); mbsc.addNotificationListener(participantStoreON, listener, null, null); } }
/** * Helper method for remote clients to connect to an MBean Server * * @param serviceUrl the url on which the target MBean Server resides * @throws IOException if the serviceUrl is invalid or if the connection cannot be started */ public static void startServerConnector(String serviceUrl) throws IOException { jmxCServer = JMXConnectorServerFactory.newJMXConnectorServer( new JMXServiceURL(serviceUrl), null, JMXServer.getAgent().getServer()); // accept JMX connections jmxCServer.start(); }
public ActionBean(UidWrapper w) { super(w); boolean isJTS = JMXServer.isJTS() && w.getType().endsWith("ArjunaTransactionImple"); // Participants in a JTS transaction are represented by entries in the ObjectStore List<UidWrapper> recuids = null; if (isJTS) { try { Class<ActionBeanWrapperInterface> cl = (Class<ActionBeanWrapperInterface>) Class.forName(JMXServer.AJT_WRAPPER_TYPE); Constructor<ActionBeanWrapperInterface> constructor = cl.getConstructor(ActionBean.class, UidWrapper.class); ra = constructor.newInstance(this, w); ra.activate(); } catch (Exception e) { // ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("Error constructing " + JMXServer.AJT_WRAPPER_TYPE + ": " + e); ra = createWrapper(w, true); } /* * for JTS actions the participants will have entries in the ObjectStore. * these entries will be associated with the current MBean (refer to * the method findParticipants below for details) */ recuids = w.probe(JMXServer.AJT_RECORD_TYPE, JMXServer.AJT_XAREC_TYPE); } else { ra = createWrapper(w, true); // com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeManager.manager() } sminfo = new StateManagerWrapper(StoreManager.getRecoveryStore(), getUid(), getType()); for (ParticipantStatus lt : ParticipantStatus.values()) { findParticipants(recuids, ra.getRecords(lt), lt); } }
public ObjectInstance registerMBean(String name, ObjStoreItemMBean bean) { try { if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debug("registering bean " + name); //tsLogger.i18NLogger.info_tools_osb_util_JMXServer_m_1(name); return getServer().registerMBean(bean, new ObjectName(name)); } catch (InstanceAlreadyExistsException e) { tsLogger.i18NLogger.info_tools_osb_util_JMXServer_m_2(name); } catch (javax.management.JMException e) { tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_3(name, e); } return null; }
public Set<ObjectName> queryNames(String name, QueryExp query) throws MalformedObjectNameException { return getServer().queryNames(new ObjectName(name), query); } }
/** * Construct a holder for Participant and Recovery Store proxies. There is one instance for each connection * to a JVM. In practice there will only ever be one instance. * * @param serviceUrl the url for the MBean server to connect to. Use default to connect to the local MBean Server * @param listener optionally register a listener for notifications * @throws JMException if there are JMX errors during registration of MBeans and notification listeners * @throws IOException if there are errors on the connection to the MBean Server */ private StoreManagerProxy(String serviceUrl, NotificationListener listener) throws JMException, IOException { if ("default".equals(serviceUrl)) { mbsc = JMXServer.getAgent().getServer(); } else { // create an RMI connector JMXServiceURL url = new JMXServiceURL(serviceUrl); // connect to the target MBean server jmxc = JMXConnectorFactory.connect(url, null); mbsc = jmxc.getMBeanServerConnection(); } recoveryStoreON = ObjectName.getInstance(RECOVERY_BEAN_NAME); participantStoreON = ObjectName.getInstance(PARTICIPANT_BEAN_NAME); rsProxy = new RecoveryStoreProxy(JMX.newMBeanProxy( mbsc, recoveryStoreON, RecoveryStoreBeanMBean.class, true)); psProxy = new ParticipantStoreProxy(JMX.newMBeanProxy( mbsc, participantStoreON, ParticipantStoreBeanMBean.class, true)); if (listener != null) { mbsc.addNotificationListener(recoveryStoreON, listener, null, null); mbsc.addNotificationListener(participantStoreON, listener, null, null); } }
/** * Helper method for remote clients to connect to an MBean Server * * @param serviceUrl the url on which the target MBean Server resides * @throws IOException if the serviceUrl is invalid or if the connection cannot be started */ public static void startServerConnector(String serviceUrl) throws IOException { jmxCServer = JMXConnectorServerFactory.newJMXConnectorServer( new JMXServiceURL(serviceUrl), null, JMXServer.getAgent().getServer()); // accept JMX connections jmxCServer.start(); }
/** * Initialise the MBean */ public void start() { JMXServer.getAgent().registerMBean(STORE_MBEAN_NAME, this); }
public void unregister(String name) { if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("Unregistering: " + name); JMXServer.getAgent().unregisterMBean(name); }
public ActionBean(UidWrapper w) { super(w); boolean isJTS = JMXServer.isJTS() && w.getType().contains("ArjunaTransactionImple"); if (isJTS) { try { UidWrapper.setRecordWrapperTypeName(w.getType()); Class<ActionBeanWrapperInterface> cl = (Class<ActionBeanWrapperInterface>) Class.forName(w.getClassName()); Constructor<ActionBeanWrapperInterface> constructor = cl.getConstructor(ActionBean.class, UidWrapper.class); ra = constructor.newInstance(this, w); ra.activate(); } catch (Exception e) { // ClassNotFoundException, NoSuchMethodException, InvocationTargetException, IllegalAccessException, InstantiationException if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.trace("Error constructing " + JMXServer.AJT_WRAPPER_TYPE + ": " + e); ra = createWrapper(w, true); } /* * For JTS we also store participant details under "CosTransactions/XAResourceRecord" * We may at some point want to augment the beans created in findParticipants below with * w.probe(JMXServer.AJT_RECORD_TYPE); */ } else { ra = createWrapper(w, true); // com.arjuna.ats.arjuna.coordinator.abstractrecord.RecordTypeManager.manager() } sminfo = new StateManagerWrapper(StoreManager.getRecoveryStore(), getUid(), getType()); for (ParticipantStatus lt : ParticipantStatus.values()) { findParticipants(recuids, ra.getRecords(lt), lt); } }
public ObjectInstance registerMBean(String name, ObjStoreItemMBean bean) { try { if (tsLogger.logger.isDebugEnabled()) tsLogger.logger.debug("registering bean " + name); //tsLogger.i18NLogger.info_tools_osb_util_JMXServer_m_1(name); return getServer().registerMBean(bean, new ObjectName(name)); } catch (InstanceAlreadyExistsException e) { tsLogger.i18NLogger.info_tools_osb_util_JMXServer_m_2(name); } catch (javax.management.JMException e) { tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_3(name, e); } return null; }
public boolean unregisterMBean(String name) { try { getServer().unregisterMBean(new ObjectName(name)); return true; } catch (MalformedObjectNameException e) { tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_5(name, e); } catch (InstanceNotFoundException e) { if (tsLogger.logger.isTraceEnabled()) tsLogger.logger.tracef("registering bean %s", name); // tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_5(name, e); } catch (MBeanRegistrationException e) { // can't happen - none of our beans implement the MBeanRegistration interface tsLogger.i18NLogger.warn_tools_osb_util_JMXServer_m_6(name, e); } return false; }
public Set<ObjectName> queryNames(String name, QueryExp query) throws MalformedObjectNameException { return getServer().queryNames(new ObjectName(name), query); } }