JBoss hornetq SVN: r8063 - trunk/src/main/org/hornetq/core/logging.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-10-07 07:22:11 -0400 (Wed, 07 Oct 2009)
New Revision: 8063
Modified:
trunk/src/main/org/hornetq/core/logging/Logger.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-167: Refactor logging so as not to delegate always to JUL
* wrap call to System.getProperty in a try block in case the client runs in a secured environment
Modified: trunk/src/main/org/hornetq/core/logging/Logger.java
===================================================================
--- trunk/src/main/org/hornetq/core/logging/Logger.java 2009-10-07 10:31:54 UTC (rev 8062)
+++ trunk/src/main/org/hornetq/core/logging/Logger.java 2009-10-07 11:22:11 UTC (rev 8063)
@@ -64,8 +64,15 @@
LogDelegateFactory delegateFactory;
// If a system property is specified then this overrides any delegate factory which is set
- // programmatically - this is primarily of use so we can configure the logger delegate on the client side
- String className = System.getProperty(LOGGER_DELEGATE_FACTORY_CLASS_NAME);
+ // programmatically - this is primarily of use so we can configure the logger delegate on the client side.
+ // call to System.getProperty is wrapped in a try block as it will fail if the client runs in a secured environment
+ String className = JULLogDelegateFactory.class.getName();
+ try
+ {
+ className = System.getProperty(LOGGER_DELEGATE_FACTORY_CLASS_NAME);
+ } catch (Exception e)
+ {
+ }
if (className != null)
{
16 years, 3 months
JBoss hornetq SVN: r8061 - trunk.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-10-07 05:07:31 -0400 (Wed, 07 Oct 2009)
New Revision: 8061
Modified:
trunk/build-hornetq.xml
Log:
fixed integration-tests failures
* include Apache commons logging jar since it is required by JBoss Transaction Manager which
is used by some integration tests
Modified: trunk/build-hornetq.xml
===================================================================
--- trunk/build-hornetq.xml 2009-10-07 02:30:02 UTC (rev 8060)
+++ trunk/build-hornetq.xml 2009-10-07 09:07:31 UTC (rev 8061)
@@ -255,6 +255,9 @@
<path refid="jboss.jbossts.classpath"/>
<path refid="apache.xerces.classpath"/>
<path refid="log4j.log4j.classpath"/>
+ <!-- we must include Apache commons logging -->
+ <!-- as a transitive dependency from JBoss TM -->
+ <path refid="apache.logging.classpath"/>
</path>
<path id="emma.unit.test.execution.classpath">
@@ -279,6 +282,8 @@
<path refid="jboss.jbossts.classpath"/>
<path refid="apache.xerces.classpath"/>
<path refid="log4j.log4j.classpath"/>
+ <!-- we must include Apache commons logging -->
+ <!-- as a transitive dependency from JBoss TM -->
<path refid="apache.logging.classpath"/>
<pathelement location="${test.dir}/config"/>
<pathelement location="${src.config.dir}/common"/>
16 years, 3 months
JBoss hornetq SVN: r8060 - in branches/Replication_Clebert: src/main/org/hornetq/core/replication/impl and 2 other directories.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-06 22:30:02 -0400 (Tue, 06 Oct 2009)
New Revision: 8060
Modified:
branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/BatchingIDGenerator.java
branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicatedJournalImpl.java
branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java
Log:
Fixes on replicating ID generation
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/BatchingIDGenerator.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/BatchingIDGenerator.java 2009-10-06 22:44:02 UTC (rev 8059)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/BatchingIDGenerator.java 2009-10-07 02:30:02 UTC (rev 8060)
@@ -38,8 +38,6 @@
private static final Logger log = Logger.getLogger(BatchingIDGenerator.class);
- public static final byte ID_COUNTER_RECORD = 24;
-
// Attributes ----------------------------------------------------
// Static --------------------------------------------------------
@@ -127,7 +125,7 @@
{
try
{
- journalStorage.appendAddRecord(journalID, ID_COUNTER_RECORD, new IDCounterEncoding(id), true);
+ journalStorage.appendAddRecord(journalID, JournalStorageManager.ID_COUNTER_RECORD, new IDCounterEncoding(id), true);
}
catch (Exception e)
{
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-06 22:44:02 UTC (rev 8059)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-07 02:30:02 UTC (rev 8060)
@@ -94,6 +94,8 @@
public static final byte PERSISTENT_ID_RECORD = 23;
+ public static final byte ID_COUNTER_RECORD = 24;
+
// type + expiration + timestamp + priority
public static final int SIZE_FIELDS = SIZE_INT + SIZE_LONG + SIZE_LONG + SIZE_BYTE;
@@ -235,9 +237,16 @@
{
throw new IllegalArgumentException("Unsupported journal type " + config.getJournalType());
}
+
+ if (config.isBackup())
+ {
+ this.idGenerator = null;
+ }
+ else
+ {
+ this.idGenerator = new BatchingIDGenerator(0, CHECKPOINT_BATCH_SIZE, bindingsJournal);
+ }
- this.idGenerator = new BatchingIDGenerator(0, CHECKPOINT_BATCH_SIZE, bindingsJournal);
-
Journal localMessage = new JournalImpl(config.getJournalFileSize(),
config.getJournalMinFiles(),
config.getJournalCompactMinFiles(),
@@ -1087,7 +1096,7 @@
persistentID = encoding.uuid;
}
- else if (rec == BatchingIDGenerator.ID_COUNTER_RECORD)
+ else if (rec == ID_COUNTER_RECORD)
{
idGenerator.loadState(record.id, buffer);
}
@@ -1131,7 +1140,10 @@
}
// Must call close to make sure last id is persisted
- idGenerator.close();
+ if (idGenerator != null)
+ {
+ idGenerator.close();
+ }
bindingsJournal.stop();
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicatedJournalImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicatedJournalImpl.java 2009-10-06 22:44:02 UTC (rev 8059)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicatedJournalImpl.java 2009-10-07 02:30:02 UTC (rev 8060)
@@ -40,16 +40,20 @@
// Attributes ----------------------------------------------------
+ private static final boolean trace = false;
+
private final ReplicationManager replicationManager;
private final Journal replicatedJournal;
private final byte journalID;
- public ReplicatedJournalImpl(byte journaID, Journal replicatedJournal, ReplicationManager replicationManager)
+ public ReplicatedJournalImpl(final byte journaID,
+ final Journal replicatedJournal,
+ final ReplicationManager replicationManager)
{
super();
- this.journalID = journaID;
+ journalID = journaID;
this.replicatedJournal = replicatedJournal;
this.replicationManager = replicationManager;
}
@@ -67,7 +71,7 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendAddRecord(long, byte, byte[], boolean)
*/
- public void appendAddRecord(long id, byte recordType, byte[] record, boolean sync) throws Exception
+ public void appendAddRecord(final long id, final byte recordType, final byte[] record, final boolean sync) throws Exception
{
this.appendAddRecord(id, recordType, new ByteArrayEncoding(record), sync);
}
@@ -80,9 +84,12 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendAddRecord(long, byte, org.hornetq.core.journal.EncodingSupport, boolean)
*/
- public void appendAddRecord(long id, byte recordType, EncodingSupport record, boolean sync) throws Exception
+ public void appendAddRecord(final long id, final byte recordType, final EncodingSupport record, final boolean sync) throws Exception
{
- System.out.println("Append record id = " + id + " recordType = " + recordType);
+ if (trace)
+ {
+ System.out.println("Append record id = " + id + " recordType = " + recordType);
+ }
replicationManager.appendAddRecord(journalID, id, recordType, record);
replicatedJournal.appendAddRecord(id, recordType, record, sync);
}
@@ -95,7 +102,7 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendAddRecordTransactional(long, long, byte, byte[])
*/
- public void appendAddRecordTransactional(long txID, long id, byte recordType, byte[] record) throws Exception
+ public void appendAddRecordTransactional(final long txID, final long id, final byte recordType, final byte[] record) throws Exception
{
this.appendAddRecordTransactional(txID, id, recordType, new ByteArrayEncoding(record));
}
@@ -108,9 +115,15 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendAddRecordTransactional(long, long, byte, org.hornetq.core.journal.EncodingSupport)
*/
- public void appendAddRecordTransactional(long txID, long id, byte recordType, EncodingSupport record) throws Exception
+ public void appendAddRecordTransactional(final long txID,
+ final long id,
+ final byte recordType,
+ final EncodingSupport record) throws Exception
{
- System.out.println("Append record TXid = " + id + " recordType = " + recordType);
+ if (trace)
+ {
+ System.out.println("Append record TXid = " + id + " recordType = " + recordType);
+ }
replicationManager.appendAddRecordTransactional(journalID, txID, id, recordType, record);
replicatedJournal.appendAddRecordTransactional(txID, id, recordType, record);
}
@@ -121,9 +134,12 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendCommitRecord(long, boolean)
*/
- public void appendCommitRecord(long txID, boolean sync) throws Exception
+ public void appendCommitRecord(final long txID, final boolean sync) throws Exception
{
- System.out.println("AppendCommit " + txID);
+ if (trace)
+ {
+ System.out.println("AppendCommit " + txID);
+ }
replicationManager.appendCommitRecord(journalID, txID);
replicatedJournal.appendCommitRecord(txID, sync);
}
@@ -134,12 +150,15 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendDeleteRecord(long, boolean)
*/
- public void appendDeleteRecord(long id, boolean sync) throws Exception
+ public void appendDeleteRecord(final long id, final boolean sync) throws Exception
{
- System.out.println("AppendDelete " + id);
+ if (trace)
+ {
+ System.out.println("AppendDelete " + id);
+ }
replicationManager.appendDeleteRecord(journalID, id);
replicatedJournal.appendDeleteRecord(id, sync);
- }
+ }
/**
* @param txID
@@ -148,7 +167,7 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendDeleteRecordTransactional(long, long, byte[])
*/
- public void appendDeleteRecordTransactional(long txID, long id, byte[] record) throws Exception
+ public void appendDeleteRecordTransactional(final long txID, final long id, final byte[] record) throws Exception
{
this.appendDeleteRecordTransactional(txID, id, new ByteArrayEncoding(record));
}
@@ -160,9 +179,12 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendDeleteRecordTransactional(long, long, org.hornetq.core.journal.EncodingSupport)
*/
- public void appendDeleteRecordTransactional(long txID, long id, EncodingSupport record) throws Exception
+ public void appendDeleteRecordTransactional(final long txID, final long id, final EncodingSupport record) throws Exception
{
- System.out.println("AppendDelete txID=" + txID + " id=" + id);
+ if (trace)
+ {
+ System.out.println("AppendDelete txID=" + txID + " id=" + id);
+ }
replicationManager.appendDeleteRecordTransactional(journalID, txID, id, record);
replicatedJournal.appendDeleteRecordTransactional(txID, id, record);
}
@@ -173,9 +195,12 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendDeleteRecordTransactional(long, long)
*/
- public void appendDeleteRecordTransactional(long txID, long id) throws Exception
+ public void appendDeleteRecordTransactional(final long txID, final long id) throws Exception
{
- System.out.println("AppendDelete (noencoding) txID=" + txID + " id=" + id);
+ if (trace)
+ {
+ System.out.println("AppendDelete (noencoding) txID=" + txID + " id=" + id);
+ }
replicationManager.appendDeleteRecordTransactional(journalID, txID, id);
replicatedJournal.appendDeleteRecordTransactional(txID, id);
}
@@ -187,7 +212,7 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendPrepareRecord(long, byte[], boolean)
*/
- public void appendPrepareRecord(long txID, byte[] transactionData, boolean sync) throws Exception
+ public void appendPrepareRecord(final long txID, final byte[] transactionData, final boolean sync) throws Exception
{
this.appendPrepareRecord(txID, new ByteArrayEncoding(transactionData), sync);
}
@@ -199,9 +224,12 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendPrepareRecord(long, org.hornetq.core.journal.EncodingSupport, boolean)
*/
- public void appendPrepareRecord(long txID, EncodingSupport transactionData, boolean sync) throws Exception
+ public void appendPrepareRecord(final long txID, final EncodingSupport transactionData, final boolean sync) throws Exception
{
- System.out.println("AppendPrepare txID=" + txID);
+ if (trace)
+ {
+ System.out.println("AppendPrepare txID=" + txID);
+ }
replicationManager.appendPrepareRecord(journalID, txID, transactionData);
replicatedJournal.appendPrepareRecord(txID, transactionData, sync);
}
@@ -212,9 +240,12 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendRollbackRecord(long, boolean)
*/
- public void appendRollbackRecord(long txID, boolean sync) throws Exception
+ public void appendRollbackRecord(final long txID, final boolean sync) throws Exception
{
- System.out.println("AppendRollback " + txID);
+ if (trace)
+ {
+ System.out.println("AppendRollback " + txID);
+ }
replicationManager.appendRollbackRecord(journalID, txID);
replicatedJournal.appendRollbackRecord(txID, sync);
}
@@ -227,7 +258,7 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendUpdateRecord(long, byte, byte[], boolean)
*/
- public void appendUpdateRecord(long id, byte recordType, byte[] record, boolean sync) throws Exception
+ public void appendUpdateRecord(final long id, final byte recordType, final byte[] record, final boolean sync) throws Exception
{
this.appendUpdateRecord(id, recordType, new ByteArrayEncoding(record), sync);
}
@@ -240,9 +271,12 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendUpdateRecord(long, byte, org.hornetq.core.journal.EncodingSupport, boolean)
*/
- public void appendUpdateRecord(long id, byte recordType, EncodingSupport record, boolean sync) throws Exception
+ public void appendUpdateRecord(final long id, final byte recordType, final EncodingSupport record, final boolean sync) throws Exception
{
- System.out.println("AppendUpdateRecord id = " + id + " , recordType = " + recordType);
+ if (trace)
+ {
+ System.out.println("AppendUpdateRecord id = " + id + " , recordType = " + recordType);
+ }
replicationManager.appendUpdateRecord(journalID, id, recordType, record);
replicatedJournal.appendUpdateRecord(id, recordType, record, sync);
}
@@ -255,7 +289,10 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendUpdateRecordTransactional(long, long, byte, byte[])
*/
- public void appendUpdateRecordTransactional(long txID, long id, byte recordType, byte[] record) throws Exception
+ public void appendUpdateRecordTransactional(final long txID,
+ final long id,
+ final byte recordType,
+ final byte[] record) throws Exception
{
this.appendUpdateRecordTransactional(txID, id, recordType, new ByteArrayEncoding(record));
}
@@ -268,9 +305,15 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#appendUpdateRecordTransactional(long, long, byte, org.hornetq.core.journal.EncodingSupport)
*/
- public void appendUpdateRecordTransactional(long txID, long id, byte recordType, EncodingSupport record) throws Exception
+ public void appendUpdateRecordTransactional(final long txID,
+ final long id,
+ final byte recordType,
+ final EncodingSupport record) throws Exception
{
- System.out.println("AppendUpdateRecord txid=" + txID + " id = " + id + " , recordType = " + recordType);
+ if (trace)
+ {
+ System.out.println("AppendUpdateRecord txid=" + txID + " id = " + id + " , recordType = " + recordType);
+ }
replicationManager.appendUpdateRecordTransactional(journalID, txID, id, recordType, record);
replicatedJournal.appendUpdateRecordTransactional(txID, id, recordType, record);
}
@@ -283,9 +326,9 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#load(java.util.List, java.util.List, org.hornetq.core.journal.TransactionFailureCallback)
*/
- public long load(List<RecordInfo> committedRecords,
- List<PreparedTransactionInfo> preparedTransactions,
- TransactionFailureCallback transactionFailure) throws Exception
+ public long load(final List<RecordInfo> committedRecords,
+ final List<PreparedTransactionInfo> preparedTransactions,
+ final TransactionFailureCallback transactionFailure) throws Exception
{
return replicatedJournal.load(committedRecords, preparedTransactions, transactionFailure);
}
@@ -296,7 +339,7 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#load(org.hornetq.core.journal.LoaderCallback)
*/
- public long load(LoaderCallback reloadManager) throws Exception
+ public long load(final LoaderCallback reloadManager) throws Exception
{
return replicatedJournal.load(reloadManager);
}
@@ -306,7 +349,7 @@
* @throws Exception
* @see org.hornetq.core.journal.Journal#perfBlast(int)
*/
- public void perfBlast(int pages) throws Exception
+ public void perfBlast(final int pages) throws Exception
{
replicatedJournal.perfBlast(pages);
}
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2009-10-06 22:44:02 UTC (rev 8059)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2009-10-07 02:30:02 UTC (rev 8060)
@@ -31,7 +31,6 @@
import org.hornetq.core.server.HornetQServer;
/**
- * A ReplicationPacketHandler
*
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
*
@@ -46,6 +45,8 @@
// Attributes ----------------------------------------------------
+ private static final boolean trace = false;
+
private final HornetQServer server;
private Channel channel;
@@ -55,13 +56,9 @@
private Journal messagingJournal;
private JournalStorageManager storage;
-
- private volatile boolean started;
- // Static --------------------------------------------------------
-
// Constructors --------------------------------------------------
- public ReplicationEndpointImpl(HornetQServer server)
+ public ReplicationEndpointImpl(final HornetQServer server)
{
this.server = server;
}
@@ -71,7 +68,7 @@
* (non-Javadoc)
* @see org.hornetq.core.remoting.ChannelHandler#handlePacket(org.hornetq.core.remoting.Packet)
*/
- public void handlePacket(Packet packet)
+ public void handlePacket(final Packet packet)
{
try
{
@@ -127,13 +124,11 @@
storage = new JournalStorageManager(config, null);
storage.start();
- this.bindingsJournal = storage.getBindingsJournal();
- this.messagingJournal = storage.getMessageJournal();
+ bindingsJournal = storage.getBindingsJournal();
+ messagingJournal = storage.getMessageJournal();
// We only need to load internal structures on the backup...
storage.loadInternalOnly();
-
- started = true;
}
/* (non-Javadoc)
@@ -141,7 +136,6 @@
*/
public void stop() throws Exception
{
- started = false;
channel.close();
storage.stop();
}
@@ -157,7 +151,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.replication.ReplicationEndpoint#setChannel(org.hornetq.core.remoting.Channel)
*/
- public void setChannel(Channel channel)
+ public void setChannel(final Channel channel)
{
this.channel = channel;
}
@@ -171,13 +165,12 @@
/**
* @param packet
*/
- private void handleCommitRollback(Packet packet) throws Exception
+ private void handleCommitRollback(final Packet packet) throws Exception
{
ReplicationCommitMessage commitMessage = (ReplicationCommitMessage)packet;
Journal journalToUse = getJournal(commitMessage.getJournalID());
-
-
+
if (commitMessage.isRollback())
{
journalToUse.appendRollbackRecord(commitMessage.getTxId(), false);
@@ -191,7 +184,7 @@
/**
* @param packet
*/
- private void handlePrepare(Packet packet) throws Exception
+ private void handlePrepare(final Packet packet) throws Exception
{
ReplicationPrepareMessage prepareMessage = (ReplicationPrepareMessage)packet;
@@ -203,7 +196,7 @@
/**
* @param packet
*/
- private void handleAppendDeleteTX(Packet packet) throws Exception
+ private void handleAppendDeleteTX(final Packet packet) throws Exception
{
ReplicationDeleteTXMessage deleteMessage = (ReplicationDeleteTXMessage)packet;
@@ -217,7 +210,7 @@
/**
* @param packet
*/
- private void handleAppendDelete(Packet packet) throws Exception
+ private void handleAppendDelete(final Packet packet) throws Exception
{
ReplicationDeleteMessage deleteMessage = (ReplicationDeleteMessage)packet;
@@ -229,7 +222,7 @@
/**
* @param packet
*/
- private void handleAppendAddTXRecord(Packet packet) throws Exception
+ private void handleAppendAddTXRecord(final Packet packet) throws Exception
{
ReplicationAddTXMessage addMessage = (ReplicationAddTXMessage)packet;
@@ -255,7 +248,7 @@
* @param packet
* @throws Exception
*/
- private void handleAppendAddRecord(Packet packet) throws Exception
+ private void handleAppendAddRecord(final Packet packet) throws Exception
{
ReplicationAddMessage addMessage = (ReplicationAddMessage)packet;
@@ -263,7 +256,10 @@
if (addMessage.isUpdate())
{
- System.out.println("Endpoint appendUpdate id = " + addMessage.getId());
+ if (trace)
+ {
+ System.out.println("Endpoint appendUpdate id = " + addMessage.getId());
+ }
journalToUse.appendUpdateRecord(addMessage.getId(),
addMessage.getRecordType(),
addMessage.getRecordData(),
@@ -271,7 +267,10 @@
}
else
{
- System.out.println("Endpoint append id = " + addMessage.getId());
+ if (trace)
+ {
+ System.out.println("Endpoint append id = " + addMessage.getId());
+ }
journalToUse.appendAddRecord(addMessage.getId(), addMessage.getRecordType(), addMessage.getRecordData(), false);
}
}
@@ -280,7 +279,7 @@
* @param journalID
* @return
*/
- private Journal getJournal(byte journalID)
+ private Journal getJournal(final byte journalID)
{
Journal journalToUse;
if (journalID == (byte)0)
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2009-10-06 22:44:02 UTC (rev 8059)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2009-10-07 02:30:02 UTC (rev 8060)
@@ -126,7 +126,6 @@
sf.setBlockOnNonPersistentSend(true);
sf.setBlockOnPersistentSend(true);
- sf.setBlockOnAcknowledge(true);
ClientSession createSession = sf.createSession(true, true);
@@ -246,8 +245,6 @@
{
break;
}
-
- System.out.println("Thread " + Thread.currentThread().getName() + " received " + message.getMessageID());
// There may be some missing or duplicate messages - but the order should be correct
@@ -257,7 +254,6 @@
lastCount = count;
- System.out.println("Client ACK: " + message.getMessageID());
message.acknowledge();
}
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java 2009-10-06 22:44:02 UTC (rev 8059)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java 2009-10-07 02:30:02 UTC (rev 8060)
@@ -23,6 +23,7 @@
import org.hornetq.core.journal.impl.JournalImpl;
import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
import org.hornetq.core.persistence.impl.journal.BatchingIDGenerator;
+import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.remoting.spi.HornetQBuffer;
import org.hornetq.tests.util.UnitTestCase;
@@ -142,7 +143,7 @@
for (RecordInfo record : records)
{
- if (record.userRecordType == BatchingIDGenerator.ID_COUNTER_RECORD)
+ if (record.userRecordType == JournalStorageManager.ID_COUNTER_RECORD)
{
HornetQBuffer buffer = ChannelBuffers.wrappedBuffer(record.data);
batch.loadState(record.id, buffer);
16 years, 3 months
JBoss hornetq SVN: r8059 - trunk.
by do-not-reply@jboss.org
Author: timfox
Date: 2009-10-06 18:44:02 -0400 (Tue, 06 Oct 2009)
New Revision: 8059
Modified:
trunk/build-hornetq.xml
Log:
fixed build
Modified: trunk/build-hornetq.xml
===================================================================
--- trunk/build-hornetq.xml 2009-10-06 21:15:26 UTC (rev 8058)
+++ trunk/build-hornetq.xml 2009-10-06 22:44:02 UTC (rev 8059)
@@ -279,6 +279,7 @@
<path refid="jboss.jbossts.classpath"/>
<path refid="apache.xerces.classpath"/>
<path refid="log4j.log4j.classpath"/>
+ <path refid="apache.logging.classpath"/>
<pathelement location="${test.dir}/config"/>
<pathelement location="${src.config.dir}/common"/>
</path>
@@ -1180,7 +1181,7 @@
haltonfailure="${junit.batchtest.haltonfailure}"
haltonerror="${junit.batchtest.haltonerror}">
<formatter type="plain" usefile="${junit.formatter.usefile}"/>
- <fileset dir="${test.jms.classes.dir}">
+ <fileset dir="${test.jms.classes.dir}">
<include name="**/jms/tests/**/${test-mask}.class"/>
<exclude name="**/jms/tests/XARecoveryTest.class"/>
<exclude name="**/jms/tests/XAResourceRecoveryTest.class"/>
16 years, 3 months
JBoss hornetq SVN: r8058 - branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-06 17:15:26 -0400 (Tue, 06 Oct 2009)
New Revision: 8058
Modified:
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
Log:
revert change on JournalCrashTest (it was not meant to be fixed on the branch)
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2009-10-06 21:13:54 UTC (rev 8057)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2009-10-06 21:15:26 UTC (rev 8058)
@@ -26,7 +26,6 @@
import org.hornetq.core.journal.RecordInfo;
import org.hornetq.core.journal.impl.AIOSequentialFileFactory;
import org.hornetq.core.journal.impl.JournalImpl;
-import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.SpawnedVMSupport;
@@ -259,7 +258,7 @@
*/
private void printJournal() throws Exception
{
- NIOSequentialFileFactory factory = new NIOSequentialFileFactory(getJournalDir());
+ AIOSequentialFileFactory factory = new AIOSequentialFileFactory(getJournalDir());
JournalImpl journal = new JournalImpl(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE,
2,
0,
16 years, 3 months
JBoss hornetq SVN: r8057 - trunk/tests/src/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-06 17:13:54 -0400 (Tue, 06 Oct 2009)
New Revision: 8057
Modified:
trunk/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
Log:
Fixing the test for cases where there is no AIO installed.
Modified: trunk/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2009-10-06 21:07:19 UTC (rev 8056)
+++ trunk/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2009-10-06 21:13:54 UTC (rev 8057)
@@ -24,8 +24,8 @@
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.journal.PreparedTransactionInfo;
import org.hornetq.core.journal.RecordInfo;
-import org.hornetq.core.journal.impl.AIOSequentialFileFactory;
import org.hornetq.core.journal.impl.JournalImpl;
+import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.SpawnedVMSupport;
@@ -258,7 +258,7 @@
*/
private void printJournal() throws Exception
{
- AIOSequentialFileFactory factory = new AIOSequentialFileFactory(getJournalDir());
+ NIOSequentialFileFactory factory = new NIOSequentialFileFactory(getJournalDir());
JournalImpl journal = new JournalImpl(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE,
2,
0,
16 years, 3 months
JBoss hornetq SVN: r8056 - branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-06 17:07:19 -0400 (Tue, 06 Oct 2009)
New Revision: 8056
Modified:
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
Log:
Fixing the test for cases where there is no AIO installed.
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2009-10-06 19:44:53 UTC (rev 8055)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/client/JournalCrashTest.java 2009-10-06 21:07:19 UTC (rev 8056)
@@ -26,6 +26,7 @@
import org.hornetq.core.journal.RecordInfo;
import org.hornetq.core.journal.impl.AIOSequentialFileFactory;
import org.hornetq.core.journal.impl.JournalImpl;
+import org.hornetq.core.journal.impl.NIOSequentialFileFactory;
import org.hornetq.core.server.HornetQServer;
import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.tests.util.SpawnedVMSupport;
@@ -258,7 +259,7 @@
*/
private void printJournal() throws Exception
{
- AIOSequentialFileFactory factory = new AIOSequentialFileFactory(getJournalDir());
+ NIOSequentialFileFactory factory = new NIOSequentialFileFactory(getJournalDir());
JournalImpl journal = new JournalImpl(ConfigurationImpl.DEFAULT_JOURNAL_FILE_SIZE,
2,
0,
16 years, 3 months
JBoss hornetq SVN: r8055 - in branches/Replication_Clebert: tests/src/org/hornetq/tests/integration/cluster/failover and 1 other directory.
by do-not-reply@jboss.org
Author: clebert.suconic(a)jboss.com
Date: 2009-10-06 15:44:53 -0400 (Tue, 06 Oct 2009)
New Revision: 8055
Added:
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedAsynchronousFailoverTest.java
Modified:
branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicatedJournalImpl.java
branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationTokenImpl.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
Changes & fixed
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicatedJournalImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicatedJournalImpl.java 2009-10-06 14:06:10 UTC (rev 8054)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicatedJournalImpl.java 2009-10-06 19:44:53 UTC (rev 8055)
@@ -22,13 +22,15 @@
import org.hornetq.core.journal.RecordInfo;
import org.hornetq.core.journal.TransactionFailureCallback;
import org.hornetq.core.journal.impl.JournalImpl.ByteArrayEncoding;
+import org.hornetq.core.persistence.impl.journal.JournalStorageManager;
import org.hornetq.core.replication.ReplicationManager;
/**
- * A ReplicatedJournalImpl
+ * Used by the {@link JournalStorageManager} to replicate journal calls.
*
* @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
*
+ * @see JournalStorageManager
*
*/
public class ReplicatedJournalImpl implements Journal
@@ -44,11 +46,6 @@
private final byte journalID;
- /**
- * @param journaID
- * @param replicatedJournal
- * @param replicationManager
- */
public ReplicatedJournalImpl(byte journaID, Journal replicatedJournal, ReplicationManager replicationManager)
{
super();
@@ -72,8 +69,7 @@
*/
public void appendAddRecord(long id, byte recordType, byte[] record, boolean sync) throws Exception
{
- replicationManager.appendAddRecord(journalID, id, recordType, new ByteArrayEncoding(record));
- replicatedJournal.appendAddRecord(id, recordType, record, sync);
+ this.appendAddRecord(id, recordType, new ByteArrayEncoding(record), sync);
}
/**
@@ -86,6 +82,7 @@
*/
public void appendAddRecord(long id, byte recordType, EncodingSupport record, boolean sync) throws Exception
{
+ System.out.println("Append record id = " + id + " recordType = " + recordType);
replicationManager.appendAddRecord(journalID, id, recordType, record);
replicatedJournal.appendAddRecord(id, recordType, record, sync);
}
@@ -100,8 +97,7 @@
*/
public void appendAddRecordTransactional(long txID, long id, byte recordType, byte[] record) throws Exception
{
- replicationManager.appendAddRecordTransactional(journalID, txID, id, recordType, new ByteArrayEncoding(record));
- replicatedJournal.appendAddRecordTransactional(txID, id, recordType, record);
+ this.appendAddRecordTransactional(txID, id, recordType, new ByteArrayEncoding(record));
}
/**
@@ -114,6 +110,7 @@
*/
public void appendAddRecordTransactional(long txID, long id, byte recordType, EncodingSupport record) throws Exception
{
+ System.out.println("Append record TXid = " + id + " recordType = " + recordType);
replicationManager.appendAddRecordTransactional(journalID, txID, id, recordType, record);
replicatedJournal.appendAddRecordTransactional(txID, id, recordType, record);
}
@@ -126,6 +123,7 @@
*/
public void appendCommitRecord(long txID, boolean sync) throws Exception
{
+ System.out.println("AppendCommit " + txID);
replicationManager.appendCommitRecord(journalID, txID);
replicatedJournal.appendCommitRecord(txID, sync);
}
@@ -138,9 +136,10 @@
*/
public void appendDeleteRecord(long id, boolean sync) throws Exception
{
+ System.out.println("AppendDelete " + id);
replicationManager.appendDeleteRecord(journalID, id);
replicatedJournal.appendDeleteRecord(id, sync);
- }
+ }
/**
* @param txID
@@ -151,8 +150,7 @@
*/
public void appendDeleteRecordTransactional(long txID, long id, byte[] record) throws Exception
{
- replicationManager.appendDeleteRecordTransactional(journalID, txID, id, new ByteArrayEncoding(record));
- replicatedJournal.appendDeleteRecordTransactional(txID, id, record);
+ this.appendDeleteRecordTransactional(txID, id, new ByteArrayEncoding(record));
}
/**
@@ -164,6 +162,7 @@
*/
public void appendDeleteRecordTransactional(long txID, long id, EncodingSupport record) throws Exception
{
+ System.out.println("AppendDelete txID=" + txID + " id=" + id);
replicationManager.appendDeleteRecordTransactional(journalID, txID, id, record);
replicatedJournal.appendDeleteRecordTransactional(txID, id, record);
}
@@ -176,6 +175,7 @@
*/
public void appendDeleteRecordTransactional(long txID, long id) throws Exception
{
+ System.out.println("AppendDelete (noencoding) txID=" + txID + " id=" + id);
replicationManager.appendDeleteRecordTransactional(journalID, txID, id);
replicatedJournal.appendDeleteRecordTransactional(txID, id);
}
@@ -189,8 +189,7 @@
*/
public void appendPrepareRecord(long txID, byte[] transactionData, boolean sync) throws Exception
{
- replicationManager.appendPrepareRecord(journalID, txID, new ByteArrayEncoding(transactionData));
- replicatedJournal.appendPrepareRecord(txID, transactionData, sync);
+ this.appendPrepareRecord(txID, new ByteArrayEncoding(transactionData), sync);
}
/**
@@ -202,6 +201,7 @@
*/
public void appendPrepareRecord(long txID, EncodingSupport transactionData, boolean sync) throws Exception
{
+ System.out.println("AppendPrepare txID=" + txID);
replicationManager.appendPrepareRecord(journalID, txID, transactionData);
replicatedJournal.appendPrepareRecord(txID, transactionData, sync);
}
@@ -214,6 +214,7 @@
*/
public void appendRollbackRecord(long txID, boolean sync) throws Exception
{
+ System.out.println("AppendRollback " + txID);
replicationManager.appendRollbackRecord(journalID, txID);
replicatedJournal.appendRollbackRecord(txID, sync);
}
@@ -228,8 +229,7 @@
*/
public void appendUpdateRecord(long id, byte recordType, byte[] record, boolean sync) throws Exception
{
- replicationManager.appendUpdateRecord(journalID, id, recordType, new ByteArrayEncoding(record));
- replicatedJournal.appendUpdateRecord(id, recordType, record, sync);
+ this.appendUpdateRecord(id, recordType, new ByteArrayEncoding(record), sync);
}
/**
@@ -242,6 +242,7 @@
*/
public void appendUpdateRecord(long id, byte recordType, EncodingSupport record, boolean sync) throws Exception
{
+ System.out.println("AppendUpdateRecord id = " + id + " , recordType = " + recordType);
replicationManager.appendUpdateRecord(journalID, id, recordType, record);
replicatedJournal.appendUpdateRecord(id, recordType, record, sync);
}
@@ -256,8 +257,7 @@
*/
public void appendUpdateRecordTransactional(long txID, long id, byte recordType, byte[] record) throws Exception
{
- replicationManager.appendUpdateRecordTransactional(journalID, txID, id, recordType, new ByteArrayEncoding(record));
- replicatedJournal.appendUpdateRecordTransactional(txID, id, recordType, record);
+ this.appendUpdateRecordTransactional(txID, id, recordType, new ByteArrayEncoding(record));
}
/**
@@ -270,6 +270,7 @@
*/
public void appendUpdateRecordTransactional(long txID, long id, byte recordType, EncodingSupport record) throws Exception
{
+ System.out.println("AppendUpdateRecord txid=" + txID + " id = " + id + " , recordType = " + recordType);
replicationManager.appendUpdateRecordTransactional(journalID, txID, id, recordType, record);
replicatedJournal.appendUpdateRecordTransactional(txID, id, recordType, record);
}
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2009-10-06 14:06:10 UTC (rev 8054)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationEndpointImpl.java 2009-10-06 19:44:53 UTC (rev 8055)
@@ -55,6 +55,8 @@
private Journal messagingJournal;
private JournalStorageManager storage;
+
+ private volatile boolean started;
// Static --------------------------------------------------------
@@ -130,6 +132,8 @@
// We only need to load internal structures on the backup...
storage.loadInternalOnly();
+
+ started = true;
}
/* (non-Javadoc)
@@ -137,6 +141,8 @@
*/
public void stop() throws Exception
{
+ started = false;
+ channel.close();
storage.stop();
}
@@ -161,6 +167,7 @@
// Protected -----------------------------------------------------
// Private -------------------------------------------------------
+
/**
* @param packet
*/
@@ -169,8 +176,8 @@
ReplicationCommitMessage commitMessage = (ReplicationCommitMessage)packet;
Journal journalToUse = getJournal(commitMessage.getJournalID());
-
+
if (commitMessage.isRollback())
{
journalToUse.appendRollbackRecord(commitMessage.getTxId(), false);
@@ -256,6 +263,7 @@
if (addMessage.isUpdate())
{
+ System.out.println("Endpoint appendUpdate id = " + addMessage.getId());
journalToUse.appendUpdateRecord(addMessage.getId(),
addMessage.getRecordType(),
addMessage.getRecordData(),
@@ -263,6 +271,7 @@
}
else
{
+ System.out.println("Endpoint append id = " + addMessage.getId());
journalToUse.appendAddRecord(addMessage.getId(), addMessage.getRecordType(), addMessage.getRecordData(), false);
}
}
Modified: branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationTokenImpl.java
===================================================================
--- branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationTokenImpl.java 2009-10-06 14:06:10 UTC (rev 8054)
+++ branches/Replication_Clebert/src/main/org/hornetq/core/replication/impl/ReplicationTokenImpl.java 2009-10-06 19:44:53 UTC (rev 8055)
@@ -46,7 +46,6 @@
public synchronized void linedUp()
{
pendings++;
- System.out.println("pendings (lined up) = " + pendings);
}
/** To be called by the replication manager, when data is confirmed on the channel */
@@ -68,7 +67,6 @@
/** You may have several actions to be done after a replication operation is completed. */
public synchronized void addReplicationAction(Runnable runnable)
{
- System.out.println("pendings on addFutureCompletion = " + pendings);
if (pendings == 0)
{
executor.execute(runnable);
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2009-10-06 14:06:10 UTC (rev 8054)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/AsynchronousFailoverTest.java 2009-10-06 19:44:53 UTC (rev 8055)
@@ -126,6 +126,7 @@
sf.setBlockOnNonPersistentSend(true);
sf.setBlockOnPersistentSend(true);
+ sf.setBlockOnAcknowledge(true);
ClientSession createSession = sf.createSession(true, true);
@@ -245,6 +246,8 @@
{
break;
}
+
+ System.out.println("Thread " + Thread.currentThread().getName() + " received " + message.getMessageID());
// There may be some missing or duplicate messages - but the order should be correct
@@ -254,6 +257,7 @@
lastCount = count;
+ System.out.println("Client ACK: " + message.getMessageID());
message.acknowledge();
}
Modified: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2009-10-06 14:06:10 UTC (rev 8054)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2009-10-06 19:44:53 UTC (rev 8055)
@@ -193,7 +193,7 @@
producer.send(message);
}
-
+
RemotingConnection conn = ((ClientSessionInternal)session).getConnection();
// Simulate failure on connection
Added: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java (rev 0)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/NettyReplicatedFailoverTest.java 2009-10-06 19:44:53 UTC (rev 8055)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.cluster.failover;
+
+import org.hornetq.core.config.Configuration;
+
+/**
+ * A NettyReplicatedFailoverTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class NettyReplicatedFailoverTest extends NettyFailoverTest
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ @Override
+ protected void createConfigs() throws Exception
+ {
+ Configuration config1 = super.createDefaultConfig();
+ config1.setBindingsDirectory(config1.getBindingsDirectory() + "_backup");
+ config1.setJournalDirectory(config1.getJournalDirectory() + "_backup");
+ config1.getAcceptorConfigurations().clear();
+ config1.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(false));
+ config1.setSecurityEnabled(false);
+ config1.setSharedStore(false);
+ config1.setBackup(true);
+ server1Service = super.createServer(true, config1);
+
+ Configuration config0 = super.createDefaultConfig();
+ config0.getAcceptorConfigurations().clear();
+ config0.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
+
+ config0.getConnectorConfigurations().put("toBackup", getConnectorTransportConfiguration(false));
+ config0.setBackupConnectorName("toBackup");
+ config0.setSecurityEnabled(false);
+ config0.setSharedStore(false);
+ server0Service = super.createServer(true, config0);
+
+ server1Service.start();
+ server0Service.start();
+ }
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Added: branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedAsynchronousFailoverTest.java
===================================================================
--- branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedAsynchronousFailoverTest.java (rev 0)
+++ branches/Replication_Clebert/tests/src/org/hornetq/tests/integration/cluster/failover/ReplicatedAsynchronousFailoverTest.java 2009-10-06 19:44:53 UTC (rev 8055)
@@ -0,0 +1,73 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.cluster.failover;
+
+import org.hornetq.core.config.Configuration;
+
+/**
+ * A ReplicatedAsynchronousFailoverTest
+ *
+ * @author <mailto:clebert.suconic@jboss.org">Clebert Suconic</a>
+ *
+ *
+ */
+public class ReplicatedAsynchronousFailoverTest extends AsynchronousFailoverTest
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+ @Override
+ protected void createConfigs() throws Exception
+ {
+ Configuration config1 = super.createDefaultConfig();
+ config1.setBindingsDirectory(config1.getBindingsDirectory() + "_backup");
+ config1.setJournalDirectory(config1.getJournalDirectory() + "_backup");
+ config1.getAcceptorConfigurations().clear();
+ config1.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(false));
+ config1.setSecurityEnabled(false);
+ config1.setSharedStore(false);
+ config1.setBackup(true);
+ server1Service = super.createServer(true, config1);
+
+ Configuration config0 = super.createDefaultConfig();
+ config0.getAcceptorConfigurations().clear();
+ config0.getAcceptorConfigurations().add(getAcceptorTransportConfiguration(true));
+
+ config0.getConnectorConfigurations().put("toBackup", getConnectorTransportConfiguration(false));
+ config0.setBackupConnectorName("toBackup");
+ config0.setSecurityEnabled(false);
+ config0.setSharedStore(false);
+ server0Service = super.createServer(true, config0);
+
+ server1Service.start();
+ server0Service.start();
+ }
+
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
16 years, 3 months
JBoss hornetq SVN: r8054 - in trunk: examples/jms/client-kickoff and 18 other directories.
by do-not-reply@jboss.org
Author: jmesnil
Date: 2009-10-06 10:06:10 -0400 (Tue, 06 Oct 2009)
New Revision: 8054
Added:
trunk/src/main/org/hornetq/core/management/ObjectNameBuilder.java
trunk/tests/src/org/hornetq/tests/integration/management/JMXDomainTest.java
Removed:
trunk/src/main/org/hornetq/core/management/ObjectNames.java
Modified:
trunk/docs/user-manual/en/configuration-index.xml
trunk/docs/user-manual/en/management.xml
trunk/examples/jms/client-kickoff/readme.html
trunk/examples/jms/client-kickoff/src/org/hornetq/jms/example/ClientKickoffExample.java
trunk/examples/jms/jmx/readme.html
trunk/examples/jms/jmx/src/org/hornetq/jms/example/JMXExample.java
trunk/examples/jms/message-counters/readme.html
trunk/examples/jms/message-counters/src/org/hornetq/jms/example/MessageCounterExample.java
trunk/examples/jms/xa-heuristic/readme.html
trunk/examples/jms/xa-heuristic/src/org/hornetq/jms/example/XAHeuristicExample.java
trunk/src/config/common/schema/hornetq-configuration.xsd
trunk/src/main/org/hornetq/core/config/Configuration.java
trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
trunk/src/main/org/hornetq/core/management/ManagementService.java
trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
trunk/tests/config/ConfigurationTest-full-config.xml
trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/DivertControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
trunk/tests/src/org/hornetq/tests/integration/management/ManagementControlHelper.java
trunk/tests/src/org/hornetq/tests/integration/management/ManagementTestBase.java
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java
trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-157: Allow JMX domain to be changed
* JMX domain can now be configured through the Configuration interface (jmx-domain in conf file)
* renamed ObjectNames to ObjectNameBuilder, provide a DEFAULT instances (for jmx clients using default jmx domain)
* added tests in JMXDomainTest with 2 HornetQ servers registered in the same MBeanServer
Modified: trunk/docs/user-manual/en/configuration-index.xml
===================================================================
--- trunk/docs/user-manual/en/configuration-index.xml 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/docs/user-manual/en/configuration-index.xml 2009-10-06 14:06:10 UTC (rev 8054)
@@ -212,6 +212,13 @@
<entry>true</entry>
</row>
<row>
+ <entry><link linkend="management.jmx.configuration"
+ >jmx-domain</link></entry>
+ <entry>String</entry>
+ <entry>the JMX domain used to registered HornetQ MBeans in the MBeanServer</entry>
+ <entry>org.hornetq</entry>
+ </row>
+ <row>
<entry><link linkend="large.message.configuring"
>large-messages-directory</link></entry>
<entry>String</entry>
Modified: trunk/docs/user-manual/en/management.xml
===================================================================
--- trunk/docs/user-manual/en/management.xml 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/docs/user-manual/en/management.xml 2009-10-06 14:06:10 UTC (rev 8054)
@@ -485,7 +485,7 @@
org.hornetq.jms.server.management.JMSQueueControl
</programlisting>
<para>The MBean's <literal>ObjectName</literal> are built using the helper class <literal
- >org.hornetq.core.management.ObjectNames</literal>. You can also use <literal
+ >org.hornetq.core.management.ObjectNameBuilder</literal>. You can also use <literal
>jconsole</literal> to find the <literal>ObjectName</literal> of the MBeans you want to
manage. </para>
<para>Managing HornetQ using JMX is identical to management of any Java Applications using
@@ -505,6 +505,14 @@
>Java Management guide</ulink> to configure the server for remote management (system
properties must be set in <literal>run.sh</literal> or <literal>run.bat</literal>
scripts).</para>
+ <para>By default, HornetQ server uses the JMX domain "org.hornetq". To manage several HornetQ servers
+ from the <emphasis>same</emphasis> MBeanServer, the JMX domain can be configured for each individual
+ HornetQ server by setting <literal>jmx-domain</literal> in <literal>hornetq-configuration.xml</literal>:
+ </para>
+ <programlisting>
+<!-- use a specific JMX domain for HornetQ MBeans -->
+<jmx-domain>my.org.hornetq</jmx-domain>
+ </programlisting>
<section>
<title>MBeanServer configuration</title>
<para>When HornetQ is run in standalone, it uses the Java Virtual Machine's <literal
Modified: trunk/examples/jms/client-kickoff/readme.html
===================================================================
--- trunk/examples/jms/client-kickoff/readme.html 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/examples/jms/client-kickoff/readme.html 2009-10-06 14:06:10 UTC (rev 8054)
@@ -68,7 +68,7 @@
<li>We create a MBean proxy to the HornetQServerControlMBean used to manage HornetQ server
(see <a href="../jmx/readme.html">JMX example</a> for a complete explanation of the different steps)</li>
<pre class="prettyprint">
- <code>ObjectName on = ObjectNames.getHornetQServerObjectName();
+ <code>ObjectName on = ObjectNameBuilder.DEFAULT.getHornetQServerObjectName();
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, String>());
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
HornetQServerControlMBean serverControl = (HornetQServerControlMBean)MBeanServerInvocationHandler.newProxyInstance(mbsc,
@@ -135,7 +135,7 @@
<li>HornetQ defines a set of MBeans for this core
API (<a href="../../../docs/api/org/jboss/messaging/core/management/package-summary.html">org.hornetq.core.management</a>
package) and its JMS API (in the <a href="../../../docs/api/org/jboss/messaging/jms/server/management/package-summary.html">org.hornetq.jms.server.management</a> package)
- <li><a href="../../../docs/api/org/jboss/messaging/core/management/ObjectNames.html">ObjectNames</a> is a helper class used to build the ObjectName of HornetQ manageable resources</li>
+ <li><a href="../../../docs/api/org/jboss/messaging/core/management/ObjectNameBuilder.html">ObjectNameBuilder</a> is a helper class used to build the ObjectName of HornetQ manageable resources</li>
</ul>
</body>
</html>
\ No newline at end of file
Modified: trunk/examples/jms/client-kickoff/src/org/hornetq/jms/example/ClientKickoffExample.java
===================================================================
--- trunk/examples/jms/client-kickoff/src/org/hornetq/jms/example/ClientKickoffExample.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/examples/jms/client-kickoff/src/org/hornetq/jms/example/ClientKickoffExample.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -29,7 +29,7 @@
import org.hornetq.common.example.HornetQExample;
import org.hornetq.core.management.HornetQServerControl;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
/**
* An example that shows how to kick off a client connected to HornetQby using JMX.
@@ -74,7 +74,7 @@
connection.start();
// Step 6. Create a HornetQServerControlMBean proxy to manage the server
- ObjectName on = ObjectNames.getHornetQServerObjectName();
+ ObjectName on = ObjectNameBuilder.DEFAULT.getHornetQServerObjectName();
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap<String, String>());
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
HornetQServerControl serverControl = (HornetQServerControl)MBeanServerInvocationHandler.newProxyInstance(mbsc,
Modified: trunk/examples/jms/jmx/readme.html
===================================================================
--- trunk/examples/jms/jmx/readme.html 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/examples/jms/jmx/readme.html 2009-10-06 14:06:10 UTC (rev 8054)
@@ -71,9 +71,9 @@
<p><em>Now that we have a message in the queue, we will manage the queue by retrieving the number of messages in the queue
(i.e. 1) and by removing the message which has been sent in step 8.</em></p>
- <li>We retrieve the <code>ObjectName</code> corresponding to the queue using a helper class <code>ObjectNames</code></li>
+ <li>We retrieve the <code>ObjectName</code> corresponding to the queue using a helper class <code>ObjectNameBuilder</code></li>
<pre class="prettyprint">
- <code>ObjectName on = ObjectNames.getJMSQueueObjectName(queue.getQueueName());</code>
+ <code>ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());</code>
</pre>
<li>We create a JMX Connector to connect to the server's MBeanServer using the <a href="http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html#connecting">standard JMX service URL</a></li>
@@ -159,7 +159,7 @@
<li>HornetQ defines a set of MBeans for this core
API (<a href="../../../docs/api/org/jboss/messaging/core/management/package-summary.html">org.hornetq.core.management</a>
package) and its JMS API (in the <a href="../../../docs/api/org/jboss/messaging/jms/server/management/package-summary.html">org.hornetq.jms.server.management</a> package)
- <li><a href="../../../docs/api/org/jboss/messaging/core/management/ObjectNames.html">ObjectNames</a> is a helper class used to build the ObjectName of HornetQ manageable resources</li>
+ <li><a href="../../../docs/api/org/jboss/messaging/core/management/ObjectNameBuilder.html">ObjectNameBuilder</a> is a helper class used to build the ObjectName of HornetQ manageable resources</li>
</ul>
</body>
</html>
\ No newline at end of file
Modified: trunk/examples/jms/jmx/src/org/hornetq/jms/example/JMXExample.java
===================================================================
--- trunk/examples/jms/jmx/src/org/hornetq/jms/example/JMXExample.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/examples/jms/jmx/src/org/hornetq/jms/example/JMXExample.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -31,7 +31,7 @@
import javax.naming.InitialContext;
import org.hornetq.common.example.HornetQExample;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.jms.server.management.JMSQueueControl;
/**
@@ -80,7 +80,7 @@
producer.send(message);
// Step 9. Retrieve the ObjectName of the queue. This is used to identify the server resources to manage
- ObjectName on = ObjectNames.getJMSQueueObjectName(queue.getQueueName());
+ ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());
// Step 10. Create JMX Connector to connect to the server's MBeanServer
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap());
Modified: trunk/examples/jms/message-counters/readme.html
===================================================================
--- trunk/examples/jms/message-counters/readme.html 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/examples/jms/message-counters/readme.html 2009-10-06 14:06:10 UTC (rev 8054)
@@ -72,7 +72,7 @@
<li>We retrieve the JMX MBean used to manage the JMS queue</li>
<pre class="prettyprint">
- <code>ObjectName on = ObjectNames.getJMSQueueObjectName(queue.getQueueName());
+ <code>ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap());
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
JMSQueueControl queueControl = (JMSQueueControl)MBeanServerInvocationHandler.newProxyInstance(mbsc,
Modified: trunk/examples/jms/message-counters/src/org/hornetq/jms/example/MessageCounterExample.java
===================================================================
--- trunk/examples/jms/message-counters/src/org/hornetq/jms/example/MessageCounterExample.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/examples/jms/message-counters/src/org/hornetq/jms/example/MessageCounterExample.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -32,7 +32,7 @@
import org.hornetq.common.example.HornetQExample;
import org.hornetq.core.management.MessageCounterInfo;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.jms.server.management.JMSQueueControl;
/**
@@ -80,7 +80,7 @@
Thread.sleep(3000);
// Step 7. Use JMX to retrieve the message counters using the JMSQueueControl
- ObjectName on = ObjectNames.getJMSQueueObjectName(queue.getQueueName());
+ ObjectName on = ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queue.getQueueName());
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), new HashMap());
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
JMSQueueControl queueControl = (JMSQueueControl)MBeanServerInvocationHandler.newProxyInstance(mbsc,
Modified: trunk/examples/jms/xa-heuristic/readme.html
===================================================================
--- trunk/examples/jms/xa-heuristic/readme.html 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/examples/jms/xa-heuristic/readme.html 2009-10-06 14:06:10 UTC (rev 8054)
@@ -172,7 +172,7 @@
<li>We list the prepared transactions</li>
<pre class="prettyprint">
<code>
- ObjectName serverObject = ObjectNames.getMessagingServerObjectName();
+ ObjectName serverObject = ObjectNameBuilder.DEFAULT.getMessagingServerObjectName();
String[] infos = (String[])mbsc.invoke(serverObject, "listPreparedTransactions", null, null);
System.out.println("Prepared transactions: ");
Modified: trunk/examples/jms/xa-heuristic/src/org/hornetq/jms/example/XAHeuristicExample.java
===================================================================
--- trunk/examples/jms/xa-heuristic/src/org/hornetq/jms/example/XAHeuristicExample.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/examples/jms/xa-heuristic/src/org/hornetq/jms/example/XAHeuristicExample.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -37,7 +37,7 @@
import org.hornetq.common.example.DummyXid;
import org.hornetq.common.example.HornetQExample;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.utils.UUIDGenerator;
/**
@@ -148,7 +148,7 @@
MBeanServerConnection mbsc = connector.getMBeanServerConnection();
//Step 27. List the prepared transactions
- ObjectName serverObject = ObjectNames.getHornetQServerObjectName();
+ ObjectName serverObject = ObjectNameBuilder.DEFAULT.getHornetQServerObjectName();
String[] infos = (String[])mbsc.invoke(serverObject, "listPreparedTransactions", null, null);
System.out.println("Prepared transactions: ");
Modified: trunk/src/config/common/schema/hornetq-configuration.xsd
===================================================================
--- trunk/src/config/common/schema/hornetq-configuration.xsd 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/src/config/common/schema/hornetq-configuration.xsd 2009-10-06 14:06:10 UTC (rev 8054)
@@ -41,6 +41,8 @@
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="jmx-management-enabled" type="xsd:boolean">
</xsd:element>
+ <xsd:element maxOccurs="1" minOccurs="0" name="jmx-domain" type="xsd:string">
+ </xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="message-counter-enabled" type="xsd:boolean">
</xsd:element>
<xsd:element maxOccurs="1" minOccurs="0" name="message-counter-sample-period" type="xsd:long">
Modified: trunk/src/main/org/hornetq/core/config/Configuration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/Configuration.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/src/main/org/hornetq/core/config/Configuration.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -93,6 +93,10 @@
void setJMXManagementEnabled(boolean enabled);
+ String getJMXDomain();
+
+ void setJMXDomain(String domain);
+
List<String> getInterceptorClassNames();
void setInterceptorClassNames(List<String> interceptors);
Modified: trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/src/main/org/hornetq/core/config/impl/ConfigurationImpl.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -67,6 +67,8 @@
public static final boolean DEFAULT_JMX_MANAGEMENT_ENABLED = true;
+ public static final String DEFAULT_JMX_DOMAIN = "org.hornetq";
+
public static final long DEFAULT_CONNECTION_TTL_OVERRIDE = -1;
public static final boolean DEFAULT_ASYNC_CONNECTION_EXECUTION_ENABLED = true;
@@ -191,6 +193,8 @@
protected boolean jmxManagementEnabled = DEFAULT_JMX_MANAGEMENT_ENABLED;
+ protected String jmxDomain = DEFAULT_JMX_DOMAIN;
+
protected long connectionTTLOverride = DEFAULT_CONNECTION_TTL_OVERRIDE;
protected boolean asyncConnectionExecutionEnabled = DEFAULT_ASYNC_CONNECTION_EXECUTION_ENABLED;
@@ -756,6 +760,16 @@
{
jmxManagementEnabled = enabled;
}
+
+ public String getJMXDomain()
+ {
+ return jmxDomain;
+ }
+
+ public void setJMXDomain(String domain)
+ {
+ jmxDomain = domain;
+ }
public void setAIOBufferTimeout(int timeout)
{
Modified: trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java
===================================================================
--- trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/src/main/org/hornetq/core/config/impl/FileConfiguration.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -123,6 +123,8 @@
jmxManagementEnabled = getBoolean(e, "jmx-management-enabled", jmxManagementEnabled);
+ jmxDomain = getString(e, "jmx-domain", jmxDomain, NOT_NULL_OR_EMPTY);
+
securityInvalidationInterval = getLong(e, "security-invalidation-interval", securityInvalidationInterval, GT_ZERO);
connectionTTLOverride = getLong(e, "connection-ttl-override", connectionTTLOverride, MINUS_ONE_OR_GT_ZERO);
Modified: trunk/src/main/org/hornetq/core/management/ManagementService.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/ManagementService.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/src/main/org/hornetq/core/management/ManagementService.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -67,6 +67,8 @@
SimpleString getManagementNotificationAddress();
+ ObjectNameBuilder getObjectNameBuilder();
+
// Resource Registration
HornetQServerControlImpl registerServer(PostOffice postOffice,
Copied: trunk/src/main/org/hornetq/core/management/ObjectNameBuilder.java (from rev 7996, trunk/src/main/org/hornetq/core/management/ObjectNames.java)
===================================================================
--- trunk/src/main/org/hornetq/core/management/ObjectNameBuilder.java (rev 0)
+++ trunk/src/main/org/hornetq/core/management/ObjectNameBuilder.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -0,0 +1,147 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.core.management;
+
+import static java.lang.String.format;
+import static javax.management.ObjectName.getInstance;
+import static javax.management.ObjectName.quote;
+
+import javax.management.ObjectName;
+
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.utils.SimpleString;
+
+/**
+ * A ObjectNameBuilder
+ *
+ * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
+ *
+ */
+public class ObjectNameBuilder
+{
+
+ // Constants -----------------------------------------------------
+
+ public static ObjectNameBuilder DEFAULT = new ObjectNameBuilder(ConfigurationImpl.DEFAULT_JMX_DOMAIN);
+
+ public static final String JMS_MODULE = "JMS";
+
+ public static final String CORE_MODULE = "Core";
+
+ // Attributes ----------------------------------------------------
+
+ private final String domain;
+
+ // Static --------------------------------------------------------
+
+ public static ObjectNameBuilder create(String domain)
+ {
+ return new ObjectNameBuilder(domain);
+ }
+
+ // Constructors --------------------------------------------------
+
+ private ObjectNameBuilder(String domain)
+ {
+ this.domain = domain;
+ }
+
+ // Public --------------------------------------------------------
+
+ public ObjectName getHornetQServerObjectName() throws Exception
+ {
+ return getInstance(domain + ":module=Core,type=Server");
+ }
+
+ public ObjectName getAddressObjectName(final SimpleString address) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "Address", address.toString());
+ }
+
+ public ObjectName getQueueObjectName(final SimpleString address, final SimpleString name) throws Exception
+ {
+ return getInstance(format("%s:module=%s,type=%s,address=%s,name=%s",
+ domain,
+ CORE_MODULE,
+ "Queue",
+ quote(address.toString()),
+ quote(name.toString())));
+ }
+
+ public ObjectName getDivertObjectName(final SimpleString name) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "Divert", name.toString());
+ }
+
+ public ObjectName getAcceptorObjectName(final String name) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "Acceptor", name);
+ }
+
+ public ObjectName getBroadcastGroupObjectName(final String name) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "BroadcastGroup", name);
+ }
+
+ public ObjectName getBridgeObjectName(final String name) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "JMSBridge", name);
+ }
+
+ public ObjectName getClusterConnectionObjectName(String name) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "ClusterConnection", name);
+ }
+
+ public ObjectName getDiscoveryGroupObjectName(final String name) throws Exception
+ {
+ return createObjectName(CORE_MODULE, "DiscoveryGroup", name);
+ }
+
+ public ObjectName getJMSServerObjectName() throws Exception
+ {
+ return getInstance(domain + ":module=JMS,type=Server");
+ }
+
+ public ObjectName getJMSQueueObjectName(final String name) throws Exception
+ {
+ return createObjectName(JMS_MODULE, "Queue", name);
+ }
+
+ public ObjectName getJMSTopicObjectName(final String name) throws Exception
+ {
+ return createObjectName(JMS_MODULE, "Topic", name);
+ }
+
+ public ObjectName getConnectionFactoryObjectName(final String name) throws Exception
+ {
+ return createObjectName(JMS_MODULE, "ConnectionFactory", name);
+ }
+
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ private ObjectName createObjectName(final String module, final String type, final String name) throws Exception
+ {
+ return getInstance(format("%s:module=%s,type=%s,name=%s", domain, module, type, quote(name)));
+ }
+
+ // Inner classes -------------------------------------------------
+
+
+
+}
Deleted: trunk/src/main/org/hornetq/core/management/ObjectNames.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/ObjectNames.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/src/main/org/hornetq/core/management/ObjectNames.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -1,134 +0,0 @@
-/*
- * Copyright 2009 Red Hat, Inc.
- * Red Hat licenses this file to you under the Apache License, version
- * 2.0 (the "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- * implied. See the License for the specific language governing
- * permissions and limitations under the License.
- */
-
-package org.hornetq.core.management;
-
-import static java.lang.String.format;
-import static javax.management.ObjectName.getInstance;
-import static javax.management.ObjectName.quote;
-
-import javax.management.ObjectName;
-
-import org.hornetq.utils.SimpleString;
-
-/**
- * A ObjectNames
- *
- * @author <a href="jmesnil(a)redhat.com">Jeff Mesnil</a>
- *
- */
-public class ObjectNames
-{
-
- // Constants -----------------------------------------------------
-
- public static final String DOMAIN = "org.hornetq";
-
- public static final String JMS_MODULE = "JMS";
-
- public static final String CORE_MODULE = "Core";
-
- // Attributes ----------------------------------------------------
-
- // Static --------------------------------------------------------
-
- public static ObjectName getHornetQServerObjectName() throws Exception
- {
- return getInstance(DOMAIN + ":module=Core,type=Server");
- }
-
- public static ObjectName getAddressObjectName(final SimpleString address) throws Exception
- {
- return createObjectName(CORE_MODULE, "Address", address.toString());
- }
-
- public static ObjectName getQueueObjectName(final SimpleString address, final SimpleString name) throws Exception
- {
- return getInstance(format("%s:module=%s,type=%s,address=%s,name=%s",
- DOMAIN,
- CORE_MODULE,
- "Queue",
- quote(address.toString()),
- quote(name.toString())));
- }
-
- public static ObjectName getDivertObjectName(final SimpleString name) throws Exception
- {
- return createObjectName(CORE_MODULE, "Divert", name.toString());
- }
-
- public static ObjectName getAcceptorObjectName(final String name) throws Exception
- {
- return createObjectName(CORE_MODULE, "Acceptor", name);
- }
-
- public static ObjectName getBroadcastGroupObjectName(final String name) throws Exception
- {
- return createObjectName(CORE_MODULE, "BroadcastGroup", name);
- }
-
- public static ObjectName getBridgeObjectName(final String name) throws Exception
- {
- return createObjectName(CORE_MODULE, "JMSBridge", name);
- }
-
- public static ObjectName getClusterConnectionObjectName(String name) throws Exception
- {
- return createObjectName(CORE_MODULE, "ClusterConnection", name);
- }
-
- public static ObjectName getDiscoveryGroupObjectName(final String name) throws Exception
- {
- return createObjectName(CORE_MODULE, "DiscoveryGroup", name);
- }
-
- public static ObjectName getJMSServerObjectName() throws Exception
- {
- return getInstance(DOMAIN + ":module=JMS,type=Server");
- }
-
- public static ObjectName getJMSQueueObjectName(final String name) throws Exception
- {
- return createObjectName(JMS_MODULE, "Queue", name);
- }
-
- public static ObjectName getJMSTopicObjectName(final String name) throws Exception
- {
- return createObjectName(JMS_MODULE, "Topic", name);
- }
-
- public static ObjectName getConnectionFactoryObjectName(final String name) throws Exception
- {
- return createObjectName(JMS_MODULE, "ConnectionFactory", name);
- }
-
- // Constructors --------------------------------------------------
-
- // Public --------------------------------------------------------
-
- // Package protected ---------------------------------------------
-
- // Protected -----------------------------------------------------
-
- // Private -------------------------------------------------------
-
- private static ObjectName createObjectName(final String module, final String type, final String name) throws Exception
- {
- return getInstance(format("%s:module=%s,type=%s,name=%s", DOMAIN, module, type, quote(name)));
- }
-
- // Inner classes -------------------------------------------------
-
-
-
-}
Modified: trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/src/main/org/hornetq/core/management/impl/ManagementServiceImpl.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -49,7 +49,7 @@
import org.hornetq.core.management.ManagementService;
import org.hornetq.core.management.Notification;
import org.hornetq.core.management.NotificationListener;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.management.ResourceNames;
import org.hornetq.core.messagecounter.MessageCounter;
import org.hornetq.core.messagecounter.MessageCounterManager;
@@ -126,6 +126,8 @@
private final Set<NotificationListener> listeners = new org.hornetq.utils.ConcurrentHashSet<NotificationListener>();
+ private final ObjectNameBuilder objectNameBuilder;
+
// Static --------------------------------------------------------
private static void checkDefaultManagementClusterCredentials(String user, String password)
@@ -157,12 +159,18 @@
registry = new HashMap<String, Object>();
broadcaster = new NotificationBroadcasterSupport();
notificationsEnabled = true;
+ objectNameBuilder = ObjectNameBuilder.create(configuration.getJMXDomain());
}
// Public --------------------------------------------------------
// ManagementService implementation -------------------------
+ public ObjectNameBuilder getObjectNameBuilder()
+ {
+ return objectNameBuilder;
+ }
+
public MessageCounterManager getMessageCounterManager()
{
return messageCounterManager;
@@ -197,7 +205,7 @@
messagingServer,
messageCounterManager,
broadcaster);
- ObjectName objectName = ObjectNames.getHornetQServerObjectName();
+ ObjectName objectName = objectNameBuilder.getHornetQServerObjectName();
registerInJMX(objectName, messagingServerControl);
registerInRegistry(ResourceNames.CORE_SERVER, messagingServerControl);
@@ -206,14 +214,14 @@
public synchronized void unregisterServer() throws Exception
{
- ObjectName objectName = ObjectNames.getHornetQServerObjectName();
+ ObjectName objectName = objectNameBuilder.getHornetQServerObjectName();
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_SERVER);
}
public synchronized void registerAddress(final SimpleString address) throws Exception
{
- ObjectName objectName = ObjectNames.getAddressObjectName(address);
+ ObjectName objectName = objectNameBuilder.getAddressObjectName(address);
AddressControlImpl addressControl = new AddressControlImpl(address, postOffice, securityRepository);
registerInJMX(objectName, addressControl);
@@ -228,7 +236,7 @@
public synchronized void unregisterAddress(final SimpleString address) throws Exception
{
- ObjectName objectName = ObjectNames.getAddressObjectName(address);
+ ObjectName objectName = objectNameBuilder.getAddressObjectName(address);
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_ADDRESS + address);
@@ -253,7 +261,7 @@
queueControl.setMessageCounter(counter);
messageCounterManager.registerMessageCounter(queue.getName().toString(), counter);
}
- ObjectName objectName = ObjectNames.getQueueObjectName(address, queue.getName());
+ ObjectName objectName = objectNameBuilder.getQueueObjectName(address, queue.getName());
registerInJMX(objectName, queueControl);
registerInRegistry(ResourceNames.CORE_QUEUE + queue.getName(), queueControl);
@@ -265,7 +273,7 @@
public synchronized void unregisterQueue(final SimpleString name, final SimpleString address) throws Exception
{
- ObjectName objectName = ObjectNames.getQueueObjectName(address, name);
+ ObjectName objectName = objectNameBuilder.getQueueObjectName(address, name);
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_QUEUE + name);
messageCounterManager.unregisterMessageCounter(name.toString());
@@ -273,7 +281,7 @@
public synchronized void registerDivert(Divert divert, DivertConfiguration config) throws Exception
{
- ObjectName objectName = ObjectNames.getDivertObjectName(divert.getUniqueName());
+ ObjectName objectName = objectNameBuilder.getDivertObjectName(divert.getUniqueName());
DivertControl divertControl = new DivertControlImpl(divert, config);
registerInJMX(objectName, new StandardMBean(divertControl, DivertControl.class));
registerInRegistry(ResourceNames.CORE_DIVERT + config.getName(), divertControl);
@@ -286,14 +294,14 @@
public synchronized void unregisterDivert(final SimpleString name) throws Exception
{
- ObjectName objectName = ObjectNames.getDivertObjectName(name);
+ ObjectName objectName = objectNameBuilder.getDivertObjectName(name);
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_DIVERT + name);
}
public synchronized void registerAcceptor(final Acceptor acceptor, final TransportConfiguration configuration) throws Exception
{
- ObjectName objectName = ObjectNames.getAcceptorObjectName(configuration.getName());
+ ObjectName objectName = objectNameBuilder.getAcceptorObjectName(configuration.getName());
AcceptorControl control = new AcceptorControlImpl(acceptor, configuration);
registerInJMX(objectName, new StandardMBean(control, AcceptorControl.class));
registerInRegistry(ResourceNames.CORE_ACCEPTOR + configuration.getName(), control);
@@ -326,7 +334,7 @@
public synchronized void unregisterAcceptor(final String name) throws Exception
{
- ObjectName objectName = ObjectNames.getAcceptorObjectName(name);
+ ObjectName objectName = objectNameBuilder.getAcceptorObjectName(name);
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_ACCEPTOR + name);
}
@@ -335,7 +343,7 @@
BroadcastGroupConfiguration configuration) throws Exception
{
broadcastGroup.setNotificationService(this);
- ObjectName objectName = ObjectNames.getBroadcastGroupObjectName(configuration.getName());
+ ObjectName objectName = objectNameBuilder.getBroadcastGroupObjectName(configuration.getName());
BroadcastGroupControl control = new BroadcastGroupControlImpl(broadcastGroup, configuration);
registerInJMX(objectName, new StandardMBean(control, BroadcastGroupControl.class));
registerInRegistry(ResourceNames.CORE_BROADCAST_GROUP + configuration.getName(), control);
@@ -343,7 +351,7 @@
public synchronized void unregisterBroadcastGroup(String name) throws Exception
{
- ObjectName objectName = ObjectNames.getBroadcastGroupObjectName(name);
+ ObjectName objectName = objectNameBuilder.getBroadcastGroupObjectName(name);
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_BROADCAST_GROUP + name);
}
@@ -352,7 +360,7 @@
DiscoveryGroupConfiguration configuration) throws Exception
{
discoveryGroup.setNotificationService(this);
- ObjectName objectName = ObjectNames.getDiscoveryGroupObjectName(configuration.getName());
+ ObjectName objectName = objectNameBuilder.getDiscoveryGroupObjectName(configuration.getName());
DiscoveryGroupControl control = new DiscoveryGroupControlImpl(discoveryGroup, configuration);
registerInJMX(objectName, new StandardMBean(control, DiscoveryGroupControl.class));
registerInRegistry(ResourceNames.CORE_DISCOVERY_GROUP + configuration.getName(), control);
@@ -360,7 +368,7 @@
public synchronized void unregisterDiscoveryGroup(String name) throws Exception
{
- ObjectName objectName = ObjectNames.getDiscoveryGroupObjectName(name);
+ ObjectName objectName = objectNameBuilder.getDiscoveryGroupObjectName(name);
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_DISCOVERY_GROUP + name);
}
@@ -368,7 +376,7 @@
public synchronized void registerBridge(Bridge bridge, BridgeConfiguration configuration) throws Exception
{
bridge.setNotificationService(this);
- ObjectName objectName = ObjectNames.getBridgeObjectName(configuration.getName());
+ ObjectName objectName = objectNameBuilder.getBridgeObjectName(configuration.getName());
BridgeControl control = new BridgeControlImpl(bridge, configuration);
registerInJMX(objectName, new StandardMBean(control, BridgeControl.class));
registerInRegistry(ResourceNames.CORE_BRIDGE + configuration.getName(), control);
@@ -376,7 +384,7 @@
public synchronized void unregisterBridge(String name) throws Exception
{
- ObjectName objectName = ObjectNames.getBridgeObjectName(name);
+ ObjectName objectName = objectNameBuilder.getBridgeObjectName(name);
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_BRIDGE + name);
}
@@ -384,7 +392,7 @@
public synchronized void registerCluster(final ClusterConnection cluster,
final ClusterConnectionConfiguration configuration) throws Exception
{
- ObjectName objectName = ObjectNames.getClusterConnectionObjectName(configuration.getName());
+ ObjectName objectName = objectNameBuilder.getClusterConnectionObjectName(configuration.getName());
ClusterConnectionControl control = new ClusterConnectionControlImpl(cluster, configuration);
registerInJMX(objectName, new StandardMBean(control, ClusterConnectionControl.class));
registerInRegistry(ResourceNames.CORE_CLUSTER_CONNECTION + configuration.getName(), control);
@@ -392,7 +400,7 @@
public synchronized void unregisterCluster(final String name) throws Exception
{
- ObjectName objectName = ObjectNames.getClusterConnectionObjectName(name);
+ ObjectName objectName = objectNameBuilder.getClusterConnectionObjectName(name);
unregisterFromJMX(objectName);
unregisterFromRegistry(ResourceNames.CORE_CLUSTER_CONNECTION + name);
}
Modified: trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java
===================================================================
--- trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/src/main/org/hornetq/jms/server/management/impl/JMSManagementServiceImpl.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -19,7 +19,6 @@
import org.hornetq.core.management.AddressControl;
import org.hornetq.core.management.ManagementService;
-import org.hornetq.core.management.ObjectNames;
import org.hornetq.core.management.QueueControl;
import org.hornetq.core.management.ResourceNames;
import org.hornetq.core.messagecounter.MessageCounter;
@@ -58,7 +57,7 @@
public synchronized JMSServerControl registerJMSServer(final JMSServerManager server) throws Exception
{
- ObjectName objectName = ObjectNames.getJMSServerObjectName();
+ ObjectName objectName = managementService.getObjectNameBuilder().getJMSServerObjectName();
JMSServerControlImpl control = new JMSServerControlImpl(server);
managementService.registerInJMX(objectName,
control);
@@ -68,7 +67,7 @@
public synchronized void unregisterJMSServer() throws Exception
{
- ObjectName objectName = ObjectNames.getJMSServerObjectName();
+ ObjectName objectName = managementService.getObjectNameBuilder().getJMSServerObjectName();
managementService.unregisterFromJMX(objectName);
managementService.unregisterFromRegistry(ResourceNames.JMS_SERVER);
}
@@ -85,7 +84,7 @@
coreQueueControl.isDurable(),
messageCounterManager.getMaxDayCount());
messageCounterManager.registerMessageCounter(queue.getName(), counter);
- ObjectName objectName = ObjectNames.getJMSQueueObjectName(queue.getQueueName());
+ ObjectName objectName = managementService.getObjectNameBuilder().getJMSQueueObjectName(queue.getQueueName());
JMSQueueControlImpl control = new JMSQueueControlImpl(queue,
coreQueueControl,
jndiBinding,
@@ -96,7 +95,7 @@
public synchronized void unregisterQueue(final String name) throws Exception
{
- ObjectName objectName = ObjectNames.getJMSQueueObjectName(name);
+ ObjectName objectName = managementService.getObjectNameBuilder().getJMSQueueObjectName(name);
managementService.unregisterFromJMX(objectName);
managementService.unregisterFromRegistry(ResourceNames.JMS_QUEUE + name);
}
@@ -104,7 +103,7 @@
public synchronized void registerTopic(final HornetQTopic topic,
final String jndiBinding) throws Exception
{
- ObjectName objectName = ObjectNames.getJMSTopicObjectName(topic.getTopicName());
+ ObjectName objectName = managementService.getObjectNameBuilder().getJMSTopicObjectName(topic.getTopicName());
AddressControl addressControl = (AddressControl)managementService.getResource(ResourceNames.CORE_ADDRESS + topic.getAddress());
JMSTopicControlImpl control = new JMSTopicControlImpl(topic, addressControl, jndiBinding, managementService);
managementService.registerInJMX(objectName, control);
@@ -113,7 +112,7 @@
public synchronized void unregisterTopic(final String name) throws Exception
{
- ObjectName objectName = ObjectNames.getJMSTopicObjectName(name);
+ ObjectName objectName = managementService.getObjectNameBuilder().getJMSTopicObjectName(name);
managementService.unregisterFromJMX(objectName);
managementService.unregisterFromRegistry(ResourceNames.JMS_TOPIC + name);
}
@@ -122,7 +121,7 @@
final HornetQConnectionFactory connectionFactory,
final List<String> bindings) throws Exception
{
- ObjectName objectName = ObjectNames.getConnectionFactoryObjectName(name);
+ ObjectName objectName = managementService.getObjectNameBuilder().getConnectionFactoryObjectName(name);
JMSConnectionFactoryControlImpl control = new JMSConnectionFactoryControlImpl(connectionFactory, name, bindings);
managementService.registerInJMX(objectName, control);
managementService.registerInRegistry(ResourceNames.JMS_CONNECTION_FACTORY + name, control);
@@ -130,7 +129,7 @@
public synchronized void unregisterConnectionFactory(final String name) throws Exception
{
- ObjectName objectName = ObjectNames.getConnectionFactoryObjectName(name);
+ ObjectName objectName = managementService.getObjectNameBuilder().getConnectionFactoryObjectName(name);
managementService.unregisterFromJMX(objectName);
managementService.unregisterFromRegistry(ResourceNames.JMS_CONNECTION_FACTORY + name);
}
Modified: trunk/tests/config/ConfigurationTest-full-config.xml
===================================================================
--- trunk/tests/config/ConfigurationTest-full-config.xml 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/config/ConfigurationTest-full-config.xml 2009-10-06 14:06:10 UTC (rev 8054)
@@ -16,6 +16,7 @@
<management-cluster-user>Frog</management-cluster-user>
<management-cluster-password>Wombat</management-cluster-password>
<jmx-management-enabled>false</jmx-management-enabled>
+ <jmx-domain>gro.qtenroh</jmx-domain>
<log-delegate-factory-class-name>ocelot</log-delegate-factory-class-name>
<message-counter-enabled>true</message-counter-enabled>
<message-counter-max-day-history>5</message-counter-max-day-history>
Modified: trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java
===================================================================
--- trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/jms-tests/src/org/hornetq/jms/tests/tools/container/LocalTestServer.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -49,7 +49,7 @@
import org.hornetq.core.config.TransportConfiguration;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.management.ResourceNames;
import org.hornetq.core.postoffice.Binding;
import org.hornetq.core.postoffice.BindingType;
@@ -439,7 +439,7 @@
public List<String> listAllSubscribersForTopic(String s) throws Exception
{
- ObjectName objectName = ObjectNames.getJMSTopicObjectName(s);
+ ObjectName objectName = ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(s);
TopicControl topic = (TopicControl)MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(),
objectName,
TopicControl.class,
Modified: trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/integration/jms/server/management/JMSServerControlTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -28,7 +28,7 @@
import org.hornetq.core.config.cluster.DiscoveryGroupConfiguration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.logging.Logger;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.remoting.impl.invm.TransportConstants;
@@ -96,7 +96,7 @@
String queueName = randomString();
checkNoBinding(context, queueJNDIBinding);
- checkNoResource(ObjectNames.getJMSQueueObjectName(queueName));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, queueJNDIBinding);
@@ -105,7 +105,7 @@
assertTrue(o instanceof Queue);
Queue queue = (Queue)o;
assertEquals(queueName, queue.getQueueName());
- checkResource(ObjectNames.getJMSQueueObjectName(queueName));
+ checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
}
@@ -115,18 +115,18 @@
String queueName = randomString();
checkNoBinding(context, queueJNDIBinding);
- checkNoResource(ObjectNames.getJMSQueueObjectName(queueName));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
JMSServerControl control = createManagementControl();
control.createQueue(queueName, queueJNDIBinding);
checkBinding(context, queueJNDIBinding);
- checkResource(ObjectNames.getJMSQueueObjectName(queueName));
+ checkResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
control.destroyQueue(queueName);
checkNoBinding(context, queueJNDIBinding);
- checkNoResource(ObjectNames.getJMSQueueObjectName(queueName));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(queueName));
}
public void testGetQueueNames() throws Exception
@@ -154,7 +154,7 @@
String topicName = randomString();
checkNoBinding(context, topicJNDIBinding);
- checkNoResource(ObjectNames.getJMSTopicObjectName(topicName));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
control.createTopic(topicName, topicJNDIBinding);
@@ -163,7 +163,7 @@
assertTrue(o instanceof Topic);
Topic topic = (Topic)o;
assertEquals(topicName, topic.getTopicName());
- checkResource(ObjectNames.getJMSTopicObjectName(topicName));
+ checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
}
public void testDestroyTopic() throws Exception
@@ -172,18 +172,18 @@
String topicName = randomString();
checkNoBinding(context, topicJNDIBinding);
- checkNoResource(ObjectNames.getJMSTopicObjectName(topicName));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
JMSServerControl control = createManagementControl();
control.createTopic(topicName, topicJNDIBinding);
checkBinding(context, topicJNDIBinding);
- checkResource(ObjectNames.getJMSTopicObjectName(topicName));
+ checkResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
control.destroyTopic(topicName);
checkNoBinding(context, topicJNDIBinding);
- checkNoResource(ObjectNames.getJMSTopicObjectName(topicName));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topicName));
}
public void testGetTopicNames() throws Exception
@@ -639,7 +639,7 @@
{
checkNoBinding(context, cfJNDIBinding.toString());
}
- checkNoResource(ObjectNames.getConnectionFactoryObjectName(cfName));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getConnectionFactoryObjectName(cfName));
JMSServerControl control = createManagementControl();
creator.createConnectionFactory(control, cfName, cfJNDIBindings);
@@ -652,7 +652,7 @@
Connection connection = cf.createConnection();
connection.close();
}
- checkResource(ObjectNames.getConnectionFactoryObjectName(cfName));
+ checkResource(ObjectNameBuilder.DEFAULT.getConnectionFactoryObjectName(cfName));
}
private JMSServerManager startHornetQServer(int discoveryPort) throws Exception
Modified: trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -34,7 +34,7 @@
import org.hornetq.core.management.BridgeControl;
import org.hornetq.core.management.Notification;
import org.hornetq.core.management.NotificationType;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQ;
@@ -70,7 +70,7 @@
public void testAttributes() throws Exception
{
- checkResource(ObjectNames.getBridgeObjectName(bridgeConfig.getName()));
+ checkResource(ObjectNameBuilder.DEFAULT.getBridgeObjectName(bridgeConfig.getName()));
BridgeControl bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
assertEquals(bridgeConfig.getName(), bridgeControl.getName());
@@ -93,7 +93,7 @@
public void testStartStop() throws Exception
{
- checkResource(ObjectNames.getBridgeObjectName(bridgeConfig.getName()));
+ checkResource(ObjectNameBuilder.DEFAULT.getBridgeObjectName(bridgeConfig.getName()));
BridgeControl bridgeControl = createBridgeControl(bridgeConfig.getName(), mbeanServer);
// started by the server
Modified: trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/integration/management/BridgeControlUsingCoreTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -33,7 +33,7 @@
import org.hornetq.core.config.cluster.BridgeConfiguration;
import org.hornetq.core.config.cluster.QueueConfiguration;
import org.hornetq.core.config.impl.ConfigurationImpl;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.management.ResourceNames;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
@@ -70,7 +70,7 @@
public void testAttributes() throws Exception
{
- checkResource(ObjectNames.getBridgeObjectName(bridgeConfig.getName()));
+ checkResource(ObjectNameBuilder.DEFAULT.getBridgeObjectName(bridgeConfig.getName()));
CoreMessagingProxy proxy = createProxy(bridgeConfig.getName());
assertEquals(bridgeConfig.getName(), (String)proxy.retrieveAttributeValue("name"));
@@ -93,7 +93,7 @@
public void testStartStop() throws Exception
{
- checkResource(ObjectNames.getBridgeObjectName(bridgeConfig.getName()));
+ checkResource(ObjectNameBuilder.DEFAULT.getBridgeObjectName(bridgeConfig.getName()));
CoreMessagingProxy proxy = createProxy(bridgeConfig.getName());
// started by the server
Modified: trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ClusterConnectionControlTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -33,7 +33,7 @@
import org.hornetq.core.config.cluster.QueueConfiguration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.management.ClusterConnectionControl;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQ;
@@ -73,7 +73,7 @@
public void testAttributes1() throws Exception
{
- checkResource(ObjectNames.getClusterConnectionObjectName(clusterConnectionConfig1.getName()));
+ checkResource(ObjectNameBuilder.DEFAULT.getClusterConnectionObjectName(clusterConnectionConfig1.getName()));
ClusterConnectionControl clusterConnectionControl = createManagementControl(clusterConnectionConfig1.getName());
@@ -107,7 +107,7 @@
public void testAttributes2() throws Exception
{
- checkResource(ObjectNames.getClusterConnectionObjectName(clusterConnectionConfig2.getName()));
+ checkResource(ObjectNameBuilder.DEFAULT.getClusterConnectionObjectName(clusterConnectionConfig2.getName()));
ClusterConnectionControl clusterConnectionControl = createManagementControl(clusterConnectionConfig2.getName());
@@ -131,7 +131,7 @@
public void testStartStop() throws Exception
{
- checkResource(ObjectNames.getClusterConnectionObjectName(clusterConnectionConfig1.getName()));
+ checkResource(ObjectNameBuilder.DEFAULT.getClusterConnectionObjectName(clusterConnectionConfig1.getName()));
ClusterConnectionControl clusterConnectionControl = createManagementControl(clusterConnectionConfig1.getName());
// started by the server
Modified: trunk/tests/src/org/hornetq/tests/integration/management/DivertControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/DivertControlTest.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/integration/management/DivertControlTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -22,7 +22,7 @@
import org.hornetq.core.config.cluster.QueueConfiguration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.management.DivertControl;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
import org.hornetq.core.remoting.impl.invm.InVMConnectorFactory;
import org.hornetq.core.server.HornetQ;
@@ -54,7 +54,7 @@
public void testAttributes() throws Exception
{
- checkResource(ObjectNames.getDivertObjectName(new SimpleString(divertConfig.getName())));
+ checkResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(new SimpleString(divertConfig.getName())));
DivertControl divertControl = createManagementControl(divertConfig.getName());
@@ -114,7 +114,7 @@
{
service.stop();
- checkNoResource(ObjectNames.getDivertObjectName(new SimpleString(divertConfig.getName())));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getDivertObjectName(new SimpleString(divertConfig.getName())));
service = null;
Modified: trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/integration/management/HornetQServerControlTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -23,7 +23,7 @@
import org.hornetq.core.config.TransportConfiguration;
import org.hornetq.core.config.impl.ConfigurationImpl;
import org.hornetq.core.management.HornetQServerControl;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.management.QueueControl;
import org.hornetq.core.messagecounter.impl.MessageCounterManagerImpl;
import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
@@ -158,11 +158,11 @@
HornetQServerControl serverControl = createManagementControl();
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
serverControl.createQueue(address.toString(), name.toString());
- checkResource(ObjectNames.getQueueObjectName(address, name));
+ checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, mbeanServer);
assertEquals(address.toString(), queueControl.getAddress());
assertEquals(name.toString(), queueControl.getName());
@@ -172,7 +172,7 @@
serverControl.destroyQueue(name.toString());
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
}
public void testCreateAndDestroyQueue_2() throws Exception
@@ -184,11 +184,11 @@
HornetQServerControl serverControl = createManagementControl();
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
serverControl.createQueue(address.toString(), name.toString(), filter, durable);
- checkResource(ObjectNames.getQueueObjectName(address, name));
+ checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, mbeanServer);
assertEquals(address.toString(), queueControl.getAddress());
assertEquals(name.toString(), queueControl.getName());
@@ -198,7 +198,7 @@
serverControl.destroyQueue(name.toString());
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
}
public void testCreateAndDestroyQueue_3() throws Exception
@@ -209,11 +209,11 @@
HornetQServerControl serverControl = createManagementControl();
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
serverControl.createQueue(address.toString(), name.toString(), durable);
- checkResource(ObjectNames.getQueueObjectName(address, name));
+ checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, mbeanServer);
assertEquals(address.toString(), queueControl.getAddress());
assertEquals(name.toString(), queueControl.getName());
@@ -223,7 +223,7 @@
serverControl.destroyQueue(name.toString());
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
}
public void testCreateAndDestroyQueueWithNullFilter() throws Exception
@@ -235,11 +235,11 @@
HornetQServerControl serverControl = createManagementControl();
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
serverControl.createQueue(address.toString(), name.toString(), filter, durable);
- checkResource(ObjectNames.getQueueObjectName(address, name));
+ checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, mbeanServer);
assertEquals(address.toString(), queueControl.getAddress());
assertEquals(name.toString(), queueControl.getName());
@@ -249,7 +249,7 @@
serverControl.destroyQueue(name.toString());
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
}
public void testCreateAndDestroyQueueWithEmptyStringForFilter() throws Exception
@@ -261,11 +261,11 @@
HornetQServerControl serverControl = createManagementControl();
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
serverControl.createQueue(address.toString(), name.toString(), filter, durable);
- checkResource(ObjectNames.getQueueObjectName(address, name));
+ checkResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
QueueControl queueControl = ManagementControlHelper.createQueueControl(address, name, mbeanServer);
assertEquals(address.toString(), queueControl.getAddress());
assertEquals(name.toString(), queueControl.getName());
@@ -275,7 +275,7 @@
serverControl.destroyQueue(name.toString());
- checkNoResource(ObjectNames.getQueueObjectName(address, name));
+ checkNoResource(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name));
}
public void testGetQueueNames() throws Exception
Added: trunk/tests/src/org/hornetq/tests/integration/management/JMXDomainTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/JMXDomainTest.java (rev 0)
+++ trunk/tests/src/org/hornetq/tests/integration/management/JMXDomainTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2009 Red Hat, Inc.
+ * Red Hat licenses this file to you under the Apache License, version
+ * 2.0 (the "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * permissions and limitations under the License.
+ */
+
+package org.hornetq.tests.integration.management;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.hornetq.core.config.Configuration;
+import org.hornetq.core.config.TransportConfiguration;
+import org.hornetq.core.config.impl.ConfigurationImpl;
+import org.hornetq.core.management.ObjectNameBuilder;
+import org.hornetq.core.remoting.impl.invm.InVMAcceptorFactory;
+import org.hornetq.core.remoting.impl.invm.TransportConstants;
+import org.hornetq.core.server.HornetQ;
+import org.hornetq.core.server.HornetQServer;
+
+/**
+ * A JMXDomainTest
+ *
+ * @author <a href="mailto:jmesnil@redhat.com">Jeff Mesnil</a>
+ *
+ *
+ */
+public class JMXDomainTest extends ManagementTestBase
+{
+
+ // Constants -----------------------------------------------------
+
+ // Attributes ----------------------------------------------------
+
+ // Static --------------------------------------------------------
+
+ // Constructors --------------------------------------------------
+
+ // Public --------------------------------------------------------
+
+ public void test2HornetQServersManagedFrom1MBeanServer() throws Exception
+ {
+
+ Configuration config_0 = createDefaultConfig();
+ config_0.setJMXManagementEnabled(true);
+
+ String jmxDomain_1 = ConfigurationImpl.DEFAULT_JMX_DOMAIN + ".1";
+
+ Configuration config_1 = new ConfigurationImpl();
+ Map<String, Object> params = new HashMap<String, Object>();
+ params.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
+ config_1.getAcceptorConfigurations().add(new TransportConfiguration(InVMAcceptorFactory.class.getName(), params));
+ config_1.setJMXDomain(jmxDomain_1);
+ config_1.setJMXManagementEnabled(true);
+
+ HornetQServer server_0 = HornetQ.newHornetQServer(config_0, mbeanServer, false);
+ HornetQServer server_1 = HornetQ.newHornetQServer(config_1, mbeanServer, false);
+
+ ObjectNameBuilder builder_0 = ObjectNameBuilder.DEFAULT;
+ ObjectNameBuilder builder_1 = ObjectNameBuilder.create(jmxDomain_1);
+
+ checkNoResource(builder_0.getHornetQServerObjectName());
+ checkNoResource(builder_1.getHornetQServerObjectName());
+
+ server_0.start();
+
+ checkResource(builder_0.getHornetQServerObjectName());
+ checkNoResource(builder_1.getHornetQServerObjectName());
+
+ server_1.start();
+
+ checkResource(builder_0.getHornetQServerObjectName());
+ checkResource(builder_1.getHornetQServerObjectName());
+
+ server_0.stop();
+
+ checkNoResource(builder_0.getHornetQServerObjectName());
+ checkResource(builder_1.getHornetQServerObjectName());
+
+ server_1.stop();
+
+ checkNoResource(builder_0.getHornetQServerObjectName());
+ checkNoResource(builder_1.getHornetQServerObjectName());
+
+ }
+ // Package protected ---------------------------------------------
+
+ // Protected -----------------------------------------------------
+
+ // Private -------------------------------------------------------
+
+ // Inner classes -------------------------------------------------
+
+}
Modified: trunk/tests/src/org/hornetq/tests/integration/management/ManagementControlHelper.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ManagementControlHelper.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ManagementControlHelper.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -27,7 +27,7 @@
import org.hornetq.core.management.DiscoveryGroupControl;
import org.hornetq.core.management.DivertControl;
import org.hornetq.core.management.HornetQServerControl;
-import org.hornetq.core.management.ObjectNames;
+import org.hornetq.core.management.ObjectNameBuilder;
import org.hornetq.core.management.QueueControl;
import org.hornetq.jms.server.management.ConnectionFactoryControl;
import org.hornetq.jms.server.management.JMSQueueControl;
@@ -52,57 +52,63 @@
public static AcceptorControl createAcceptorControl(String name, MBeanServer mbeanServer) throws Exception
{
- return (AcceptorControl)createProxy(ObjectNames.getAcceptorObjectName(name), AcceptorControl.class, mbeanServer);
+ return (AcceptorControl)createProxy(ObjectNameBuilder.DEFAULT.getAcceptorObjectName(name),
+ AcceptorControl.class,
+ mbeanServer);
}
public static BroadcastGroupControl createBroadcastGroupControl(String name, MBeanServer mbeanServer) throws Exception
{
- return (BroadcastGroupControl)createProxy(ObjectNames.getBroadcastGroupObjectName(name),
+ return (BroadcastGroupControl)createProxy(ObjectNameBuilder.DEFAULT.getBroadcastGroupObjectName(name),
BroadcastGroupControl.class,
mbeanServer);
}
public static DiscoveryGroupControl createDiscoveryGroupControl(String name, MBeanServer mbeanServer) throws Exception
{
- return (DiscoveryGroupControl)createProxy(ObjectNames.getDiscoveryGroupObjectName(name),
+ return (DiscoveryGroupControl)createProxy(ObjectNameBuilder.DEFAULT.getDiscoveryGroupObjectName(name),
DiscoveryGroupControl.class,
mbeanServer);
}
public static BridgeControl createBridgeControl(String name, MBeanServer mbeanServer) throws Exception
{
- return (BridgeControl)createProxy(ObjectNames.getBridgeObjectName(name), BridgeControl.class, mbeanServer);
+ return (BridgeControl)createProxy(ObjectNameBuilder.DEFAULT.getBridgeObjectName(name), BridgeControl.class, mbeanServer);
}
public static DivertControl createDivertControl(String name, MBeanServer mbeanServer) throws Exception
{
- return (DivertControl)createProxy(ObjectNames.getDivertObjectName(new SimpleString(name)),
+ return (DivertControl)createProxy(ObjectNameBuilder.DEFAULT.getDivertObjectName(new SimpleString(name)),
DivertControl.class,
mbeanServer);
}
public static ClusterConnectionControl createClusterConnectionControl(String name, MBeanServer mbeanServer) throws Exception
{
- return (ClusterConnectionControl)createProxy(ObjectNames.getClusterConnectionObjectName(name),
+ return (ClusterConnectionControl)createProxy(ObjectNameBuilder.DEFAULT.getClusterConnectionObjectName(name),
ClusterConnectionControl.class,
mbeanServer);
}
public static HornetQServerControl createHornetQServerControl(MBeanServer mbeanServer) throws Exception
{
- return (HornetQServerControl)createProxy(ObjectNames.getHornetQServerObjectName(),
+ return (HornetQServerControl)createProxy(ObjectNameBuilder.DEFAULT.getHornetQServerObjectName(),
HornetQServerControl.class,
mbeanServer);
}
public static QueueControl createQueueControl(SimpleString address, SimpleString name, MBeanServer mbeanServer) throws Exception
{
- return (QueueControl)createProxy(ObjectNames.getQueueObjectName(address, name), QueueControl.class, mbeanServer);
+ return (QueueControl)createProxy(ObjectNameBuilder.DEFAULT.getQueueObjectName(address, name),
+ QueueControl.class,
+ mbeanServer);
}
public static AddressControl createAddressControl(SimpleString address, MBeanServer mbeanServer) throws Exception
{
- return (AddressControl)createProxy(ObjectNames.getAddressObjectName(address), AddressControl.class, mbeanServer);
+ return (AddressControl)createProxy(ObjectNameBuilder.DEFAULT.getAddressObjectName(address),
+ AddressControl.class,
+ mbeanServer);
}
public static JMSQueueControl createJMSQueueControl(Queue queue, MBeanServer mbeanServer) throws Exception
@@ -112,24 +118,28 @@
public static JMSQueueControl createJMSQueueControl(String name, MBeanServer mbeanServer) throws Exception
{
- return (JMSQueueControl)createProxy(ObjectNames.getJMSQueueObjectName(name), JMSQueueControl.class, mbeanServer);
+ return (JMSQueueControl)createProxy(ObjectNameBuilder.DEFAULT.getJMSQueueObjectName(name),
+ JMSQueueControl.class,
+ mbeanServer);
}
public static JMSServerControl createJMSServerControl(MBeanServer mbeanServer) throws Exception
{
- return (JMSServerControl)createProxy(ObjectNames.getJMSServerObjectName(), JMSServerControl.class, mbeanServer);
+ return (JMSServerControl)createProxy(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(),
+ JMSServerControl.class,
+ mbeanServer);
}
public static ConnectionFactoryControl createConnectionFactoryControl(String name, MBeanServer mbeanServer) throws Exception
{
- return (ConnectionFactoryControl)createProxy(ObjectNames.getConnectionFactoryObjectName(name),
+ return (ConnectionFactoryControl)createProxy(ObjectNameBuilder.DEFAULT.getConnectionFactoryObjectName(name),
ConnectionFactoryControl.class,
mbeanServer);
}
public static TopicControl createTopicControl(Topic topic, MBeanServer mbeanServer) throws Exception
{
- return (TopicControl)createProxy(ObjectNames.getJMSTopicObjectName(topic.getTopicName()),
+ return (TopicControl)createProxy(ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(topic.getTopicName()),
TopicControl.class,
mbeanServer);
}
Modified: trunk/tests/src/org/hornetq/tests/integration/management/ManagementTestBase.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/ManagementTestBase.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/integration/management/ManagementTestBase.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -20,7 +20,7 @@
import org.hornetq.core.client.ClientConsumer;
import org.hornetq.core.client.ClientMessage;
import org.hornetq.core.client.ClientSession;
-import org.hornetq.tests.util.UnitTestCase;
+import org.hornetq.tests.util.ServiceTestBase;
import org.hornetq.utils.SimpleString;
/**
@@ -30,7 +30,7 @@
*
*
*/
-public abstract class ManagementTestBase extends UnitTestCase
+public abstract class ManagementTestBase extends ServiceTestBase
{
// Constants -----------------------------------------------------
Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/DefaultsFileConfigurationTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -49,6 +49,8 @@
assertEquals(ConfigurationImpl.DEFAULT_JMX_MANAGEMENT_ENABLED, conf.isJMXManagementEnabled());
+ assertEquals(ConfigurationImpl.DEFAULT_JMX_DOMAIN, conf.getJMXDomain());
+
assertEquals(0, conf.getInterceptorClassNames().size());
assertEquals(ConfigurationImpl.DEFAULT_CONNECTION_TTL_OVERRIDE, conf.getConnectionTTLOverride());
Modified: trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2009-10-06 09:53:21 UTC (rev 8053)
+++ trunk/tests/src/org/hornetq/tests/unit/core/config/impl/FileConfigurationTest.java 2009-10-06 14:06:10 UTC (rev 8054)
@@ -49,6 +49,7 @@
assertEquals("Frog", conf.getManagementClusterUser());
assertEquals("Wombat", conf.getManagementClusterPassword());
assertEquals(false, conf.isJMXManagementEnabled());
+ assertEquals("gro.qtenroh", conf.getJMXDomain());
assertEquals(true, conf.isMessageCounterEnabled());
assertEquals(5, conf.getMessageCounterMaxDayHistory());
assertEquals(123456, conf.getMessageCounterSamplePeriod());
16 years, 3 months
JBoss hornetq SVN: r8053 - in trunk: src/main/org/hornetq/core/management/impl and 12 other directories.
by do-not-reply@jboss.org
Author: ataylor
Date: 2009-10-06 05:53:21 -0400 (Tue, 06 Oct 2009)
New Revision: 8053
Modified:
trunk/src/main/org/hornetq/core/management/QueueControl.java
trunk/src/main/org/hornetq/core/management/impl/QueueControlImpl.java
trunk/src/main/org/hornetq/core/persistence/QueueBindingInfo.java
trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
trunk/src/main/org/hornetq/core/postoffice/Binding.java
trunk/src/main/org/hornetq/core/postoffice/QueueInfo.java
trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java
trunk/src/main/org/hornetq/core/postoffice/impl/DivertBinding.java
trunk/src/main/org/hornetq/core/postoffice/impl/LocalQueueBinding.java
trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
trunk/src/main/org/hornetq/core/server/Queue.java
trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java
trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
trunk/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java
trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
trunk/src/main/org/hornetq/core/server/impl/LastValueQueue.java
trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
trunk/tests/src/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java
trunk/tests/src/org/hornetq/tests/integration/management/QueueControlUsingCoreTest.java
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java
trunk/tests/src/org/hornetq/tests/unit/core/server/impl/QueueImplTest.java
Log:
https://jira.jboss.org/jira/browse/HORNETQ-170 - removed transient id's from being used for binding id. the persistent queue id is now used.
Modified: trunk/src/main/org/hornetq/core/management/QueueControl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/QueueControl.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/management/QueueControl.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -32,7 +32,7 @@
String getAddress();
- long getPersistenceID();
+ long getID();
boolean isTemporary();
Modified: trunk/src/main/org/hornetq/core/management/impl/QueueControlImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/management/impl/QueueControlImpl.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/management/impl/QueueControlImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -159,9 +159,9 @@
return queue.getMessagesAdded();
}
- public long getPersistenceID()
+ public long getID()
{
- return queue.getPersistenceID();
+ return queue.getID();
}
public long getScheduledCount()
Modified: trunk/src/main/org/hornetq/core/persistence/QueueBindingInfo.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/QueueBindingInfo.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/persistence/QueueBindingInfo.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -27,7 +27,7 @@
*/
public interface QueueBindingInfo
{
- long getPersistenceID();
+ long getId();
SimpleString getAddress();
Modified: trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
--- trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -310,7 +310,7 @@
public void updateScheduledDeliveryTime(final MessageReference ref) throws Exception
{
ScheduledDeliveryEncoding encoding = new ScheduledDeliveryEncoding(ref.getScheduledDeliveryTime(),
- ref.getQueue().getPersistenceID());
+ ref.getQueue().getID());
messageJournal.appendUpdateRecord(ref.getMessage().getMessageID(),
SET_SCHEDULED_DELIVERY_TIME,
@@ -400,7 +400,7 @@
public void updateScheduledDeliveryTimeTransactional(final long txID, final MessageReference ref) throws Exception
{
ScheduledDeliveryEncoding encoding = new ScheduledDeliveryEncoding(ref.getScheduledDeliveryTime(),
- ref.getQueue().getPersistenceID());
+ ref.getQueue().getID());
messageJournal.appendUpdateRecordTransactional(txID,
ref.getMessage().getMessageID(),
@@ -457,7 +457,7 @@
public void updateDeliveryCount(final MessageReference ref) throws Exception
{
- DeliveryCountUpdateEncoding updateInfo = new DeliveryCountUpdateEncoding(ref.getQueue().getPersistenceID(),
+ DeliveryCountUpdateEncoding updateInfo = new DeliveryCountUpdateEncoding(ref.getQueue().getID(),
ref.getDeliveryCount());
messageJournal.appendUpdateRecord(ref.getMessage().getMessageID(),
@@ -1003,11 +1003,7 @@
binding.getAddress(),
filterString);
- long id = this.generateUniqueID();
-
- queue.setPersistenceID(id);
-
- bindingsJournal.appendAddRecord(id, QUEUE_BINDING_RECORD, bindingEncoding, true);
+ bindingsJournal.appendAddRecord(binding.getID(), QUEUE_BINDING_RECORD, bindingEncoding, true);
}
public void deleteQueueBinding(final long queueBindingID) throws Exception
@@ -1037,7 +1033,7 @@
bindingEncoding.decode(buffer);
- bindingEncoding.setPersistenceID(id);
+ bindingEncoding.setId(id);
queueBindingInfos.add(bindingEncoding);
}
@@ -1265,7 +1261,7 @@
private static class PersistentQueueBindingEncoding implements EncodingSupport, QueueBindingInfo
{
- long persistenceID;
+ long id;
SimpleString name;
@@ -1286,14 +1282,14 @@
this.filterString = filterString;
}
- public long getPersistenceID()
+ public long getId()
{
- return persistenceID;
+ return id;
}
- public void setPersistenceID(final long id)
+ public void setId(final long id)
{
- this.persistenceID = id;
+ this.id = id;
}
public SimpleString getAddress()
Modified: trunk/src/main/org/hornetq/core/postoffice/Binding.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/Binding.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/postoffice/Binding.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -48,9 +48,7 @@
boolean isExclusive();
- int getID();
-
- void setID(int id);
+ long getID();
int getDistance();
}
Modified: trunk/src/main/org/hornetq/core/postoffice/QueueInfo.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/QueueInfo.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/postoffice/QueueInfo.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -40,7 +40,7 @@
private final SimpleString filterString;
- private final int id;
+ private final long id;
private List<SimpleString> filterStrings;
@@ -48,7 +48,7 @@
private final int distance;
- public QueueInfo(final SimpleString routingName, final SimpleString clusterName, final SimpleString address, final SimpleString filterString, final int id,
+ public QueueInfo(final SimpleString routingName, final SimpleString clusterName, final SimpleString address, final SimpleString filterString, final Long id,
final Integer distance)
{
if (routingName == null)
@@ -100,7 +100,7 @@
return distance;
}
- public int getID()
+ public long getID()
{
return id;
}
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/BindingsImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -51,7 +51,7 @@
private final Map<SimpleString, Integer> routingNamePositions = new ConcurrentHashMap<SimpleString, Integer>();
- private final Map<Integer, Binding> bindingsMap = new ConcurrentHashMap<Integer, Binding>();
+ private final Map<Long, Binding> bindingsMap = new ConcurrentHashMap<Long, Binding>();
private final List<Binding> exclusiveBindings = new CopyOnWriteArrayList<Binding>();
@@ -133,7 +133,7 @@
while (buff.hasRemaining())
{
- int bindingID = buff.getInt();
+ long bindingID = buff.getLong();
Binding binding = bindingsMap.get(bindingID);
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/DivertBinding.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/DivertBinding.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/DivertBinding.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -45,10 +45,12 @@
private final boolean exclusive;
- private int id;
+ private final long id;
- public DivertBinding(final SimpleString address, final Divert divert)
+ public DivertBinding(long id, final SimpleString address, final Divert divert)
{
+ this.id = id;
+
this.address = address;
this.divert = divert;
@@ -62,16 +64,11 @@
this.exclusive = divert.isExclusive();
}
- public int getID()
+ public long getID()
{
return id;
}
- public void setID(final int id)
- {
- this.id = id;
- }
-
public Filter getFilter()
{
return filter;
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/LocalQueueBinding.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/LocalQueueBinding.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/LocalQueueBinding.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -48,8 +48,6 @@
private final SimpleString name;
- private int id;
-
private SimpleString clusterName;
public LocalQueueBinding(final SimpleString address, final Queue queue, final SimpleString nodeID)
@@ -65,16 +63,11 @@
this.clusterName = name.concat(nodeID);
}
- public int getID()
+ public long getID()
{
- return id;
+ return queue.getID();
}
- public void setID(final int id)
- {
- this.id = id;
- }
-
public Filter getFilter()
{
return filter;
Modified: trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/postoffice/impl/PostOfficeImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -100,16 +100,6 @@
private final boolean persistIDCache;
- // Each queue has a transient ID which lasts the lifetime of its binding. This is used in clustering when routing
- // messages to particular queues on nodes. We could
- // use the queue name on the node to identify it. But sometimes we need to route to maybe 10s of thousands of queues
- // on a particular node, and all would
- // have to be specified in the message. Specify 10000 ints takes up a lot less space than 10000 arbitrary queue names
- // The drawback of this approach is we only allow up to 2^32 queues in memory at any one time
- private int transientIDSequence;
-
- private Set<Integer> transientIDs = new HashSet<Integer>();
-
private Map<SimpleString, QueueInfo> queueInfos = new HashMap<SimpleString, QueueInfo>();
private final Object notificationLock = new Object();
@@ -200,9 +190,6 @@
addressManager.clear();
queueInfos.clear();
-
- transientIDs.clear();
-
}
public boolean isStarted()
@@ -243,13 +230,13 @@
SimpleString address = (SimpleString)props.getProperty(ManagementHelper.HDR_ADDRESS);
- Integer transientID = (Integer)props.getProperty(ManagementHelper.HDR_BINDING_ID);
+ Long id = (Long)props.getProperty(ManagementHelper.HDR_BINDING_ID);
SimpleString filterString = (SimpleString)props.getProperty(ManagementHelper.HDR_FILTERSTRING);
Integer distance = (Integer)props.getProperty(ManagementHelper.HDR_DISTANCE);
- QueueInfo info = new QueueInfo(routingName, clusterName, address, filterString, transientID, distance);
+ QueueInfo info = new QueueInfo(routingName, clusterName, address, filterString, id, distance);
queueInfos.put(clusterName, info);
@@ -435,8 +422,6 @@
// even though failover is complete
public synchronized void addBinding(final Binding binding) throws Exception
{
- binding.setID(generateTransientID());
-
addressManager.addBinding(binding);
TypedProperties props = new TypedProperties();
@@ -449,7 +434,7 @@
props.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, binding.getRoutingName());
- props.putIntProperty(ManagementHelper.HDR_BINDING_ID, binding.getID());
+ props.putLongProperty(ManagementHelper.HDR_BINDING_ID, binding.getID());
props.putIntProperty(ManagementHelper.HDR_DISTANCE, binding.getDistance());
@@ -505,8 +490,6 @@
managementService.sendNotification(new Notification(null, NotificationType.BINDING_REMOVED, props));
- releaseTransientID(binding.getID());
-
return binding;
}
@@ -740,7 +723,7 @@
message.putStringProperty(ManagementHelper.HDR_ADDRESS, info.getAddress());
message.putStringProperty(ManagementHelper.HDR_CLUSTER_NAME, info.getClusterName());
message.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, info.getRoutingName());
- message.putIntProperty(ManagementHelper.HDR_BINDING_ID, info.getID());
+ message.putLongProperty(ManagementHelper.HDR_BINDING_ID, info.getID());
message.putStringProperty(ManagementHelper.HDR_FILTERSTRING, info.getFilterString());
message.putIntProperty(ManagementHelper.HDR_DISTANCE, info.getDistance());
@@ -822,30 +805,6 @@
return message;
}
- private int generateTransientID()
- {
- int start = transientIDSequence;
- do
- {
- int id = transientIDSequence++;
-
- if (!transientIDs.contains(id))
- {
- transientIDs.add(id);
-
- return id;
- }
- }
- while (transientIDSequence != start);
-
- throw new IllegalStateException("Run out of queue ids!");
- }
-
- private void releaseTransientID(final int id)
- {
- transientIDs.remove(id);
- }
-
private final PageMessageOperation getPageOperation(final Transaction tx)
{
// you could have races on the case two sessions using the same XID
Modified: trunk/src/main/org/hornetq/core/server/Queue.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/Queue.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/server/Queue.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -38,10 +38,8 @@
SimpleString getName();
- long getPersistenceID();
+ long getID();
- void setPersistenceID(long id);
-
Filter getFilter();
boolean isDurable();
Modified: trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/server/cluster/ClusterConnection.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -41,7 +41,7 @@
void handleReplicatedAddBinding(SimpleString address,
SimpleString uniqueName,
SimpleString routingName,
- int queueID,
+ long queueID,
SimpleString filterString,
SimpleString queueName,
int distance) throws Exception;
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/ClusterConnectionImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -577,14 +577,15 @@
SimpleString filterString = (SimpleString)message.getProperty(ManagementHelper.HDR_FILTERSTRING);
- Integer queueID = (Integer)message.getProperty(ManagementHelper.HDR_BINDING_ID);
+ Long queueID = (Long)message.getProperty(ManagementHelper.HDR_BINDING_ID);
if (queueID == null)
{
throw new IllegalStateException("queueID is null");
}
- RemoteQueueBinding binding = new RemoteQueueBindingImpl(queueAddress,
+ RemoteQueueBinding binding = new RemoteQueueBindingImpl(server.getStorageManager().generateUniqueID(),
+ queueAddress,
clusterName,
routingName,
queueID,
@@ -721,7 +722,7 @@
public void handleReplicatedAddBinding(final SimpleString address,
final SimpleString uniqueName,
final SimpleString routingName,
- final int queueID,
+ final long queueID,
final SimpleString filterString,
final SimpleString queueName,
final int distance) throws Exception
@@ -735,7 +736,8 @@
Queue queue = (Queue)queueBinding.getBindable();
- RemoteQueueBinding binding = new RemoteQueueBindingImpl(address,
+ RemoteQueueBinding binding = new RemoteQueueBindingImpl(server.getStorageManager().generateUniqueID(),
+ address,
uniqueName,
routingName,
queueID,
Modified: trunk/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/server/cluster/impl/RemoteQueueBindingImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -51,7 +51,7 @@
private final SimpleString routingName;
- private final int remoteQueueID;
+ private final long remoteQueueID;
private final Filter queueFilter;
@@ -63,19 +63,22 @@
private final SimpleString idsHeaderName;
- private int id;
+ private final long id;
private final int distance;
- public RemoteQueueBindingImpl(final SimpleString address,
+ public RemoteQueueBindingImpl(final long id,
+ final SimpleString address,
final SimpleString uniqueName,
final SimpleString routingName,
- final int remoteQueueID,
+ final Long remoteQueueID,
final SimpleString filterString,
- final Queue storeAndForwardQueue,
+ final Queue storeAndForwardQueue,
final SimpleString bridgeName,
final int distance) throws Exception
{
+ this.id = id;
+
this.address = address;
this.storeAndForwardQueue = storeAndForwardQueue;
@@ -100,16 +103,11 @@
this.distance = distance;
}
- public int getID()
+ public long getID()
{
return id;
}
- public void setID(final int id)
- {
- this.id = id;
- }
-
public SimpleString getAddress()
{
return address;
@@ -195,20 +193,20 @@
if (ids == null)
{
- ids = new byte[4];
+ ids = new byte[8];
}
else
{
- byte[] newIds = new byte[ids.length + 4];
+ byte[] newIds = new byte[ids.length + 8];
- System.arraycopy(ids, 0, newIds, 4, ids.length);
+ System.arraycopy(ids, 0, newIds, 8, ids.length);
ids = newIds;
}
ByteBuffer buff = ByteBuffer.wrap(ids);
- buff.putInt(remoteQueueID);
+ buff.putLong(remoteQueueID);
message.putBytesProperty(idsHeaderName, ids);
}
Modified: trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/server/impl/HornetQServerImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -843,7 +843,7 @@
if (queue.isDurable())
{
- storageManager.deleteQueueBinding(queue.getPersistenceID());
+ storageManager.deleteQueueBinding(queue.getID());
}
postOffice.removeBinding(queueName);
@@ -1169,7 +1169,7 @@
filter = new FilterImpl(queueBindingInfo.getFilterString());
}
- Queue queue = queueFactory.createQueue(queueBindingInfo.getPersistenceID(),
+ Queue queue = queueFactory.createQueue(queueBindingInfo.getId(),
queueBindingInfo.getAddress(),
queueBindingInfo.getQueueName(),
filter,
@@ -1178,7 +1178,7 @@
Binding binding = new LocalQueueBinding(queueBindingInfo.getAddress(), queue, nodeID);
- queues.put(queueBindingInfo.getPersistenceID(), queue);
+ queues.put(queueBindingInfo.getId(), queue);
postOffice.addBinding(binding);
@@ -1267,8 +1267,8 @@
filter = new FilterImpl(filterString);
}
- final Queue queue = queueFactory.createQueue(-1, address, queueName, filter, durable, temporary);
-
+ final Queue queue = queueFactory.createQueue(storageManager.generateUniqueID(), address, queueName, filter, durable, temporary);
+
binding = new LocalQueueBinding(address, queue, nodeID);
if (durable)
@@ -1339,7 +1339,7 @@
pagingManager,
storageManager);
- Binding binding = new DivertBinding(sAddress, divert);
+ Binding binding = new DivertBinding(storageManager.generateUniqueID(), sAddress, divert);
postOffice.addBinding(binding);
Modified: trunk/src/main/org/hornetq/core/server/impl/LastValueQueue.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/LastValueQueue.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/server/impl/LastValueQueue.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -232,7 +232,7 @@
}
else
{
- storageManager.deleteMessageTransactional(tx.getID(), getPersistenceID(), msg.getMessageID());
+ storageManager.deleteMessageTransactional(tx.getID(), getID(), msg.getMessageID());
}
}
}
Modified: trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java
===================================================================
--- trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/src/main/org/hornetq/core/server/impl/QueueImpl.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -76,7 +76,7 @@
public static final int NUM_PRIORITIES = 10;
- private volatile long persistenceID = -1;
+ private final long id;
private final SimpleString name;
@@ -140,7 +140,7 @@
private volatile SimpleString expiryAddress;
- public QueueImpl(final long persistenceID,
+ public QueueImpl(final long id,
final SimpleString address,
final SimpleString name,
final Filter filter,
@@ -151,7 +151,7 @@
final StorageManager storageManager,
final HierarchicalRepository<AddressSettings> addressSettingsRepository)
{
- this.persistenceID = persistenceID;
+ this.id = id;
this.address = address;
@@ -259,7 +259,7 @@
message.setStored();
}
- storageManager.storeReference(ref.getQueue().getPersistenceID(), message.getMessageID());
+ storageManager.storeReference(ref.getQueue().getID(), message.getMessageID());
}
if (scheduledDeliveryTime != null && durableRef)
@@ -283,7 +283,7 @@
tx.putProperty(TransactionPropertyIndexes.CONTAINS_PERSISTENT, true);
storageManager.storeReferenceTransactional(tx.getID(),
- ref.getQueue().getPersistenceID(),
+ ref.getQueue().getID(),
message.getMessageID());
}
@@ -373,16 +373,11 @@
return name;
}
- public long getPersistenceID()
+ public long getID()
{
- return persistenceID;
+ return id;
}
- public void setPersistenceID(final long id)
- {
- persistenceID = id;
- }
-
public Filter getFilter()
{
return filter;
@@ -662,7 +657,7 @@
if (durableRef)
{
- storageManager.storeAcknowledge(persistenceID, message.getMessageID());
+ storageManager.storeAcknowledge(id, message.getMessageID());
}
postAcknowledge(ref);
@@ -676,7 +671,7 @@
if (durableRef)
{
- storageManager.storeAcknowledgeTransactional(tx.getID(), persistenceID, message.getMessageID());
+ storageManager.storeAcknowledgeTransactional(tx.getID(), id, message.getMessageID());
tx.putProperty(TransactionPropertyIndexes.CONTAINS_PERSISTENT, true);
}
Modified: trunk/tests/src/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/tests/src/org/hornetq/tests/integration/cluster/restart/ClusterRestartTest.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -25,72 +25,149 @@
*/
public class ClusterRestartTest extends ClusterTestBase
{
- public void testRestartWithDurableQueues() throws Exception
+ public void testRestartWithQueuesCreateInDiffOrder() throws Exception
{
- /*setupServer(0, isFileStorage(), isNetty());
+ setupServer(0, isFileStorage(), isNetty());
setupServer(1, isFileStorage(), isNetty());
- setupServer(2, isFileStorage(), isNetty());
- setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1, 2);
+ setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1);
- setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0, 2);
+ setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0);
- setupClusterConnection("cluster2", "queues", false, 1, isNetty(), 2, 0, 1);
- startServers(0, 1, 2);
+ startServers(0, 1);
+
+ System.out.println("server 0 = " + getServer(0).getNodeID());
+ System.out.println("server 1 = " + getServer(1).getNodeID());
+
try
{
setupSessionFactory(0, isNetty());
setupSessionFactory(1, isNetty());
- setupSessionFactory(2, isNetty());
+ //create some dummy queues to ensure that the test queue has a high numbered binding
+ createQueue(0, "queues.testaddress2", "queue0", null, false);
+ createQueue(0, "queues.testaddress2", "queue1", null, false);
+ createQueue(0, "queues.testaddress2", "queue2", null, false);
+ createQueue(0, "queues.testaddress2", "queue3", null, false);
+ createQueue(0, "queues.testaddress2", "queue4", null, false);
+ createQueue(0, "queues.testaddress2", "queue5", null, false);
+ createQueue(0, "queues.testaddress2", "queue6", null, false);
+ createQueue(0, "queues.testaddress2", "queue7", null, false);
+ createQueue(0, "queues.testaddress2", "queue8", null, false);
+ createQueue(0, "queues.testaddress2", "queue9", null, false);
+ //now create the 2 queues and make sure they are durable
+ createQueue(0, "queues.testaddress", "queue10", null, true);
+ createQueue(1, "queues.testaddress", "queue10", null, true);
- createQueue(0, "queues.testaddress", "queue0", null, true);
- createQueue(1, "queues.testaddress", "queue0", null, true);
- createQueue(2, "queues.testaddress", "queue0", null, true);
+ addConsumer(0, 0, "queue10", null);
- addConsumer(1, 1, "queue0", null);
+ waitForBindings(0, "queues.testaddress", 1, 1, true);
+ waitForBindings(1, "queues.testaddress", 1, 0, true);
+ waitForBindings(0, "queues.testaddress", 1, 0, false);
+ waitForBindings(1, "queues.testaddress", 1, 1, false);
+
+ printBindings(2);
+
+ sendInRange(1, "queues.testaddress", 0, 10, false, null);
+
+ System.out.println("stopping******************************************************");
+ stopServers(0);
+ System.out.println("stopped******************************************************");
+ startServers(0);
+
waitForBindings(0, "queues.testaddress", 1, 0, true);
- waitForBindings(1, "queues.testaddress", 1, 1, true);
- waitForBindings(2, "queues.testaddress", 1, 0, true);
- waitForBindings(0, "queues.testaddress", 2, 1, false);
- waitForBindings(1, "queues.testaddress", 2, 0, false);
- waitForBindings(2, "queues.testaddress", 2, 1, false);
+ addConsumer(1, 0, "queue10", null);
- printBindings();
+ waitForBindings(0, "queues.testaddress", 1, 0, false);
+ waitForBindings(1, "queues.testaddress", 1, 1, false);
+ printBindings(2);
+
+ sendInRange(1, "queues.testaddress", 10, 20, false, null);
- sendInRange(1, "queues.testaddress", 0, 10, false, null);
+ verifyReceiveAllInRange(10, 20, 1);
+ System.out.println("*****************************************************************************");
+ }
+ finally
+ {
+ //closeAllConsumers();
- sendInRange(2, "queues.testaddress", 10, 20, false, null);
+ closeAllSessionFactories();
+ stopServers(0, 1);
+ }
+ }
- sendInRange(0, "queues.testaddress", 20, 30, false, null);
+ public void testRestartWithQueuesCreateInDiffOrder2() throws Exception
+ {
+ setupServer(0, isFileStorage(), isNetty());
+ setupServer(1, isFileStorage(), isNetty());
+ setupClusterConnection("cluster0", "queues", false, 1, isNetty(), 0, 1);
+
+ setupClusterConnection("cluster1", "queues", false, 1, isNetty(), 1, 0);
+
+
+ startServers(0, 1);
+
+
+ System.out.println("server 0 = " + getServer(0).getNodeID());
+ System.out.println("server 1 = " + getServer(1).getNodeID());
+
+ try
+ {
+
+ setupSessionFactory(0, isNetty());
+ setupSessionFactory(1, isNetty());
+
+
+ //create some dummy queues to ensure that the test queue has a high numbered binding
+ createQueue(0, "queues.testaddress2", "queue0", null, false);
+ createQueue(0, "queues.testaddress2", "queue1", null, false);
+ createQueue(0, "queues.testaddress2", "queue2", null, false);
+ createQueue(0, "queues.testaddress2", "queue3", null, false);
+ createQueue(0, "queues.testaddress2", "queue4", null, false);
+ createQueue(0, "queues.testaddress2", "queue5", null, false);
+ createQueue(0, "queues.testaddress2", "queue6", null, false);
+ createQueue(0, "queues.testaddress2", "queue7", null, false);
+ createQueue(0, "queues.testaddress2", "queue8", null, false);
+ createQueue(0, "queues.testaddress2", "queue9", null, false);
+ //now create the 2 queues and make sure they are durable
+ createQueue(0, "queues.testaddress", "queue10", null, true);
+ createQueue(1, "queues.testaddress", "queue10", null, true);
+
+ waitForBindings(0, "queues.testaddress", 1, 0, true);
+ waitForBindings(1, "queues.testaddress", 1, 0, true);
+ waitForBindings(0, "queues.testaddress", 1, 0, false);
+ waitForBindings(1, "queues.testaddress", 1, 0, false);
+
+ printBindings(2);
+
+ sendInRange(1, "queues.testaddress", 0, 10, true, null);
+
System.out.println("stopping******************************************************");
- stopServers(1);
+ stopServers(0);
+
+ sendInRange(1, "queues.testaddress", 10, 20, true, null);
System.out.println("stopped******************************************************");
- startServers(1);
+ startServers(0);
waitForBindings(0, "queues.testaddress", 1, 0, true);
- waitForBindings(1, "queues.testaddress", 1, 0, true);
- waitForBindings(2, "queues.testaddress", 1, 0, true);
- addConsumer(4, 1, "queue0", null);
- waitForBindings(0, "queues.testaddress", 2, 1, false);
- waitForBindings(1, "queues.testaddress", 2, 0, false);
- waitForBindings(2, "queues.testaddress", 2, 1, false);
- printBindings();
- sendInRange(2, "queues.testaddress", 30, 40, false, null);
- sendInRange(0, "queues.testaddress", 40, 50, false, null);
+ waitForBindings(0, "queues.testaddress", 1, 0, false);
+ waitForBindings(1, "queues.testaddress", 1, 0, false);
+ printBindings(2);
+ addConsumer(0, 1, "queue10", null);
+ addConsumer(1, 0, "queue10", null);
- verifyReceiveAllInRange(0, 50, 1);
+ verifyReceiveRoundRobin(0, 20, 0, 1);
System.out.println("*****************************************************************************");
}
finally
@@ -99,30 +176,22 @@
closeAllSessionFactories();
- stopServers(0, 1, 2);
- }*/
+ stopServers(0, 1);
+ }
}
- private void printBindings()
+
+ private void printBindings(int num)
throws Exception
{
- Collection<Binding> bindings0 = getServer(0).getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress")).getBindings();
- Collection<Binding> bindings1 = getServer(1).getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress")).getBindings();
- Collection<Binding> bindings2 = getServer(2).getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress")).getBindings();
- for (Binding binding : bindings0)
+ for(int i = 0; i < num; i++)
{
- System.out.println(binding + " on node 0 at " + binding.getID());
+ Collection<Binding> bindings0 = getServer(i).getPostOffice().getBindingsForAddress(new SimpleString("queues.testaddress")).getBindings();
+ for (Binding binding : bindings0)
+ {
+ System.out.println(binding + " on node " + i + " at " + binding.getID());
+ }
}
-
- for (Binding binding : bindings1)
- {
- System.out.println(binding + " on node 1 at " + binding.getID());
- }
-
- for (Binding binding : bindings2)
- {
- System.out.println(binding + " on node 2 at " + binding.getID());
- }
}
public boolean isNetty()
Modified: trunk/tests/src/org/hornetq/tests/integration/management/QueueControlUsingCoreTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/integration/management/QueueControlUsingCoreTest.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/tests/src/org/hornetq/tests/integration/management/QueueControlUsingCoreTest.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -130,9 +130,9 @@
return (String)proxy.retrieveAttributeValue("name");
}
- public long getPersistenceID()
+ public long getID()
{
- return (Long)proxy.retrieveAttributeValue("persistenceID");
+ return (Long)proxy.retrieveAttributeValue("ID");
}
public long getScheduledCount()
Modified: trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/BindingsImplTest.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -957,7 +957,7 @@
/* (non-Javadoc)
* @see org.hornetq.core.postoffice.Binding#getID()
*/
- public int getID()
+ public long getID()
{
return 0;
@@ -1008,14 +1008,6 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.postoffice.Binding#setID(int)
- */
- public void setID(final int id)
- {
-
- }
-
- /* (non-Javadoc)
* @see org.hornetq.core.postoffice.Binding#willRoute(org.hornetq.core.server.ServerMessage)
*/
public void willRoute(final ServerMessage message)
Modified: trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/tests/src/org/hornetq/tests/unit/core/postoffice/impl/FakeQueue.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -19,7 +19,6 @@
import java.util.concurrent.Executor;
import org.hornetq.core.filter.Filter;
-import org.hornetq.core.remoting.Channel;
import org.hornetq.core.server.Consumer;
import org.hornetq.core.server.Distributor;
import org.hornetq.core.server.MessageReference;
@@ -311,9 +310,9 @@
}
/* (non-Javadoc)
- * @see org.hornetq.core.server.Queue#getPersistenceID()
+ * @see org.hornetq.core.server.Queue#getID()
*/
- public long getPersistenceID()
+ public long getID()
{
return 0;
@@ -482,14 +481,7 @@
}
- /* (non-Javadoc)
- * @see org.hornetq.core.server.Queue#setPersistenceID(long)
- */
- public void setPersistenceID(long id)
- {
- }
-
/* (non-Javadoc)
* @see org.hornetq.core.server.Bindable#preroute(org.hornetq.core.server.ServerMessage, org.hornetq.core.transaction.Transaction)
*/
Modified: trunk/tests/src/org/hornetq/tests/unit/core/server/impl/QueueImplTest.java
===================================================================
--- trunk/tests/src/org/hornetq/tests/unit/core/server/impl/QueueImplTest.java 2009-10-06 09:35:13 UTC (rev 8052)
+++ trunk/tests/src/org/hornetq/tests/unit/core/server/impl/QueueImplTest.java 2009-10-06 09:53:21 UTC (rev 8053)
@@ -51,21 +51,6 @@
private static final SimpleString address1 = new SimpleString("address1");
- public void testID()
- {
- final long id = 123;
-
- Queue queue = new QueueImpl(id, address1, queue1, null, false, true, scheduledExecutor, null, null, null);
-
- assertEquals(id, queue.getPersistenceID());
-
- final long id2 = 456;
-
- queue.setPersistenceID(id2);
-
- assertEquals(id2, queue.getPersistenceID());
- }
-
public void testName()
{
final SimpleString name = new SimpleString("oobblle");
16 years, 3 months