public Recoverer() { String serverId = TransactionManagerServices.getConfiguration().getServerId(); if (serverId == null) serverId = ""; this.jmxName = "bitronix.tm:type=Recoverer,ServerId=" + ManagementRegistrar.makeValidName(serverId); ManagementRegistrar.register(jmxName, this); }
public Recoverer() { String serverId = TransactionManagerServices.getConfiguration().getServerId(); if (serverId == null) serverId = ""; this.jmxName = "bitronix.tm:type=Recoverer,ServerId=" + ManagementRegistrar.makeValidName(serverId); ManagementRegistrar.register(jmxName, this); }
public Recoverer() { String serverId = TransactionManagerServices.getConfiguration().getServerId(); if (serverId == null) serverId = ""; this.jmxName = "bitronix.tm:type=Recoverer,ServerId=" + ManagementRegistrar.makeValidName(serverId); ManagementRegistrar.register(jmxName, this); }
public Recoverer() { String serverId = TransactionManagerServices.getConfiguration().getServerId(); if (serverId == null) serverId = ""; this.jmxName = "bitronix.tm:type=Recoverer,ServerId=" + ManagementRegistrar.makeValidName(serverId); ManagementRegistrar.register(jmxName, this); }
protected JmsPooledConnection(PoolingConnectionFactory poolingConnectionFactory, XAConnection connection) { this.poolingConnectionFactory = poolingConnectionFactory; this.xaConnection = connection; this.lastReleaseDate = new Date(MonotonicClock.currentTimeMillis()); addStateChangeEventListener(new JmsPooledConnectionStateChangeListener()); if (LrcXAConnectionFactory.class.getName().equals(poolingConnectionFactory.getClassName())) { if (log.isDebugEnabled()) { log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing twoPcOrderingPosition to ALWAYS_LAST_POSITION"); } poolingConnectionFactory.setTwoPcOrderingPosition(Scheduler.ALWAYS_LAST_POSITION); if (log.isDebugEnabled()) { log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing deferConnectionRelease to true"); } poolingConnectionFactory.setDeferConnectionRelease(true); if (log.isDebugEnabled()) { log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing useTmJoin to true"); } poolingConnectionFactory.setUseTmJoin(true); } this.jmxName = "bitronix.tm:type=JMS,UniqueName=" + ManagementRegistrar.makeValidName(poolingConnectionFactory.getUniqueName()) + ",Id=" + poolingConnectionFactory.incCreatedResourcesCounter(); ManagementRegistrar.register(jmxName, this); }
protected JmsPooledConnection(PoolingConnectionFactory poolingConnectionFactory, XAConnection connection) { this.poolingConnectionFactory = poolingConnectionFactory; this.xaConnection = connection; this.lastReleaseDate = new Date(MonotonicClock.currentTimeMillis()); addStateChangeEventListener(new JmsPooledConnectionStateChangeListener()); if (poolingConnectionFactory.getClassName().equals(LrcXAConnectionFactory.class.getName())) { if (log.isDebugEnabled()) log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing twoPcOrderingPosition to ALWAYS_LAST_POSITION"); poolingConnectionFactory.setTwoPcOrderingPosition(Scheduler.ALWAYS_LAST_POSITION); if (log.isDebugEnabled()) log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing deferConnectionRelease to true"); poolingConnectionFactory.setDeferConnectionRelease(true); if (log.isDebugEnabled()) log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing useTmJoin to true"); poolingConnectionFactory.setUseTmJoin(true); } this.jmxName = "bitronix.tm:type=JMS,UniqueName=" + ManagementRegistrar.makeValidName(poolingConnectionFactory.getUniqueName()) + ",Id=" + poolingConnectionFactory.incCreatedResourcesCounter(); ManagementRegistrar.register(jmxName, this); }
protected JmsPooledConnection(PoolingConnectionFactory poolingConnectionFactory, XAConnection connection) { this.poolingConnectionFactory = poolingConnectionFactory; this.xaConnection = connection; this.lastReleaseDate = new Date(MonotonicClock.currentTimeMillis()); addStateChangeEventListener(new JmsPooledConnectionStateChangeListener()); if (LrcXAConnectionFactory.class.getName().equals(poolingConnectionFactory.getClassName())) { if (log.isDebugEnabled()) { log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing twoPcOrderingPosition to ALWAYS_LAST_POSITION"); } poolingConnectionFactory.setTwoPcOrderingPosition(Scheduler.ALWAYS_LAST_POSITION); if (log.isDebugEnabled()) { log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing deferConnectionRelease to true"); } poolingConnectionFactory.setDeferConnectionRelease(true); if (log.isDebugEnabled()) { log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing useTmJoin to true"); } poolingConnectionFactory.setUseTmJoin(true); } this.jmxName = "bitronix.tm:type=JMS,UniqueName=" + ManagementRegistrar.makeValidName(poolingConnectionFactory.getUniqueName()) + ",Id=" + poolingConnectionFactory.incCreatedResourcesCounter(); ManagementRegistrar.register(jmxName, this); }
protected JmsPooledConnection(PoolingConnectionFactory poolingConnectionFactory, XAConnection connection) { this.poolingConnectionFactory = poolingConnectionFactory; this.xaConnection = connection; this.lastReleaseDate = new Date(MonotonicClock.currentTimeMillis()); addStateChangeEventListener(new JmsPooledConnectionStateChangeListener()); if (poolingConnectionFactory.getClassName().equals(LrcXAConnectionFactory.class.getName())) { if (log.isDebugEnabled()) log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing twoPcOrderingPosition to ALWAYS_LAST_POSITION"); poolingConnectionFactory.setTwoPcOrderingPosition(Scheduler.ALWAYS_LAST_POSITION); if (log.isDebugEnabled()) log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing deferConnectionRelease to true"); poolingConnectionFactory.setDeferConnectionRelease(true); if (log.isDebugEnabled()) log.debug("emulating XA for resource " + poolingConnectionFactory.getUniqueName() + " - changing useTmJoin to true"); poolingConnectionFactory.setUseTmJoin(true); } this.jmxName = "bitronix.tm:type=JMS,UniqueName=" + ManagementRegistrar.makeValidName(poolingConnectionFactory.getUniqueName()) + ",Id=" + poolingConnectionFactory.incCreatedResourcesCounter(); ManagementRegistrar.register(jmxName, this); }
/** * Initializes the pool by creating the initial amount of connections. */ public synchronized void init() { try { if (this.pool != null) return; buildXAPool(); this.jmxName = "bitronix.tm:type=JDBC,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catch (Exception ex) { throw new ResourceConfigurationException("cannot create JDBC datasource named " + getUniqueName(), ex); } }
/** * Initialize the pool by creating the initial amount of connections. */ @Override public synchronized void init() { try { if (pool != null) return; buildXAPool(); this.jmxName = "bitronix.tm:type=JMS,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catch (Exception ex) { throw new ResourceConfigurationException("cannot create JMS connection factory named " + getUniqueName(), ex); } }
/** * Initializes the pool by creating the initial amount of connections. */ public synchronized void init() { try { if (this.pool != null) return; buildXAPool(); this.jmxName = "bitronix.tm:type=JDBC,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catch (Exception ex) { throw new ResourceConfigurationException("cannot create JDBC datasource named " + getUniqueName(), ex); } }
/** * Initializes the pool by creating the initial amount of connections. */ @Override public synchronized void init() { if (this.pool != null) return; try { buildXAPool(); this.jmxName = "bitronix.tm:type=JDBC,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catch (Exception ex) { throw new ResourceConfigurationException("cannot create JDBC datasource named " + getUniqueName(), ex); } }
@Test public void testCanRegister() throws Exception { final int iterations = 100000; final List<TestBean> beans = new ArrayList<TestBean>(iterations); for (int i = 0; i < iterations; i++) { if (i > 0) ManagementRegistrar.unregister(objectName); TestBean testBean = new TestBean("#" + i); beans.add(testBean); // holding a hard reference to ensure the instances are not GCed. ManagementRegistrar.register(objectName, testBean); } ManagementRegistrar.normalizeAndRunQueuedCommands(); assertEquals(beans.get(beans.size() - 1).getName(), mBeanServer.getAttribute(new ObjectName(objectName), "Name")); }
/** * Initialize the pool by creating the initial amount of connections. */ public synchronized void init() { try { if (pool != null) return; buildXAPool(); this.jmxName = "bitronix.tm:type=JMS,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catch (Exception ex) { throw new ResourceConfigurationException("cannot create JMS connection factory named " + getUniqueName(), ex); } }
/** * Initializes the pool by creating the initial amount of connections. */ @Override public synchronized void init() { if (this.pool != null) return; try { buildXAPool(); this.jmxName = "bitronix.tm:type=JDBC,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catch (Exception ex) { throw new ResourceConfigurationException("cannot create JDBC datasource named " + getUniqueName(), ex); } }
/** * Initialize the pool by creating the initial amount of connections. */ public synchronized void init() { try { if (pool != null) return; buildXAPool(); this.jmxName = "bitronix.tm:type=JMS,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catch (Exception ex) { throw new ResourceConfigurationException("cannot create JMS connection factory named " + getUniqueName(), ex); } }
@Test(expected = InstanceNotFoundException.class) public void testCanUnregister() throws Exception { TestBean testBean = new TestBean("1"); ManagementRegistrar.register(objectName, testBean); ManagementRegistrar.unregister(objectName); ManagementRegistrar.normalizeAndRunQueuedCommands(); mBeanServer.getAttribute(new ObjectName(objectName), "Name"); } }
@Test public void testCanRegister() throws Exception { final int iterations = 100000; final List<TestBean> beans = new ArrayList<TestBean>(iterations); for (int i = 0; i < iterations; i++) { if (i > 0) ManagementRegistrar.unregister(objectName); TestBean testBean = new TestBean("#" + i); beans.add(testBean); // holding a hard reference to ensure the instances are not GCed. ManagementRegistrar.register(objectName, testBean); } ManagementRegistrar.normalizeAndRunQueuedCommands(); assertEquals(beans.get(beans.size() - 1).getName(), mBeanServer.getAttribute(new ObjectName(objectName), "Name")); }
/** * Initialize the pool by creating the initial amount of connections. */ @Override public synchronized void init() { try { if (pool != null) return; buildXAPool(); this.jmxName = "bitronix.tm:type=JMS,UniqueName=" + ManagementRegistrar.makeValidName(getUniqueName()); ManagementRegistrar.register(jmxName, this); } catch (Exception ex) { throw new ResourceConfigurationException("cannot create JMS connection factory named " + getUniqueName(), ex); } }
@Test(expected = InstanceNotFoundException.class) public void testCanUnregister() throws Exception { TestBean testBean = new TestBean("1"); ManagementRegistrar.register(objectName, testBean); ManagementRegistrar.unregister(objectName); ManagementRegistrar.normalizeAndRunQueuedCommands(); mBeanServer.getAttribute(new ObjectName(objectName), "Name"); } }