Author: borges
Date: 2011-11-24 07:26:38 -0500 (Thu, 24 Nov 2011)
New Revision: 11758
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
Log:
Clean up's: add final to fields, delete trailing whitespace etc.
Modified:
trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java
===================================================================
---
trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2011-11-24
12:26:17 UTC (rev 11757)
+++
trunk/hornetq-jms/src/main/java/org/hornetq/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java 2011-11-24
12:26:38 UTC (rev 11758)
@@ -55,27 +55,27 @@
private final byte CF_RECORD = 1;
private final byte DESTINATION_RECORD = 2;
-
+
private final byte JNDI_RECORD = 3;
-
+
// Attributes ----------------------------------------------------
private final IDGenerator idGenerator;
-
+
private final String journalDir;
-
+
private final boolean createDir;
-
+
private final Journal jmsJournal;
private volatile boolean started;
-
- private Map<String, PersistedConnectionFactory> mapFactories = new
ConcurrentHashMap<String, PersistedConnectionFactory>();
- private Map<Pair<PersistedType, String>, PersistedDestination>
destinations = new ConcurrentHashMap<Pair<PersistedType, String>,
PersistedDestination>();
-
- private Map<Pair<PersistedType, String>, PersistedJNDI> mapJNDI = new
ConcurrentHashMap<Pair<PersistedType, String>, PersistedJNDI>();
+ private final Map<String, PersistedConnectionFactory> mapFactories = new
ConcurrentHashMap<String, PersistedConnectionFactory>();
+ private final Map<Pair<PersistedType, String>, PersistedDestination>
destinations = new ConcurrentHashMap<Pair<PersistedType, String>,
PersistedDestination>();
+
+ private final Map<Pair<PersistedType, String>, PersistedJNDI> mapJNDI =
new ConcurrentHashMap<Pair<PersistedType, String>, PersistedJNDI>();
+
// Static --------------------------------------------------------
// Constructors --------------------------------------------------
@@ -117,7 +117,7 @@
{
jmsJournal = localJMS;
}
-
+
this.idGenerator = idGenerator;
}
@@ -144,7 +144,7 @@
jmsJournal.appendAddRecord(id, CF_RECORD, connectionFactory, true);
mapFactories.put(connectionFactory.getName(), connectionFactory);
}
-
+
public void deleteConnectionFactory(final String cfName) throws Exception
{
PersistedConnectionFactory oldCF = mapFactories.remove(cfName);
@@ -152,7 +152,7 @@
{
jmsJournal.appendDeleteRecord(oldCF.getId(), false);
}
-
+
this.deleteJNDI(PersistedType.ConnectionFactory, cfName);
}
@@ -177,22 +177,22 @@
jmsJournal.appendAddRecord(id, DESTINATION_RECORD, destination, true);
destinations.put(new Pair<PersistedType, String>(destination.getType(),
destination.getName()), destination);
}
-
+
public List<PersistedJNDI> recoverPersistedJNDI() throws Exception
{
ArrayList<PersistedJNDI> list = new ArrayList<PersistedJNDI>();
-
+
list.addAll(mapJNDI.values());
-
+
return list;
}
-
+
public void addJNDI(PersistedType type, String name, String ... address) throws
Exception
{
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type,
name);
long tx = idGenerator.generateID();
-
+
PersistedJNDI currentJNDI = mapJNDI.get(key);
if (currentJNDI != null)
{
@@ -202,30 +202,30 @@
{
currentJNDI = new PersistedJNDI(type, name);
}
-
+
mapJNDI.put(key, currentJNDI);
-
+
for (String adItem : address)
{
currentJNDI.addJNDI(adItem);
}
-
+
long newId = idGenerator.generateID();
-
+
currentJNDI.setId(newId);
-
+
jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI);
-
+
jmsJournal.appendCommitRecord(tx, true);
}
-
+
public void deleteJNDI(PersistedType type, String name, String address) throws
Exception
{
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type,
name);
long tx = idGenerator.generateID();
-
+
PersistedJNDI currentJNDI = mapJNDI.get(key);
if (currentJNDI == null)
{
@@ -235,9 +235,9 @@
{
jmsJournal.appendDeleteRecordTransactional(tx, currentJNDI.getId());
}
-
+
currentJNDI.deleteJNDI(address);
-
+
if (currentJNDI.getJndi().size() == 0)
{
mapJNDI.remove(key);
@@ -248,15 +248,15 @@
currentJNDI.setId(newId);
jmsJournal.appendAddRecordTransactional(tx, newId, JNDI_RECORD, currentJNDI);
}
-
+
jmsJournal.appendCommitRecord(tx, true);
}
-
+
public void deleteJNDI(PersistedType type, String name) throws Exception
{
Pair<PersistedType, String> key = new Pair<PersistedType, String>(type,
name);
-
+
PersistedJNDI currentJNDI = mapJNDI.remove(key);
if (currentJNDI != null)
@@ -293,25 +293,21 @@
checkAndCreateDir(journalDir, createDir);
jmsJournal.start();
-
+
started = true;
}
- /* (non-Javadoc)
- * @see
org.hornetq.jms.persistence.JMSStorageManager#installReplication(org.hornetq.core.replication.ReplicationEndpoint)
- */
+ @Override
public void installReplication(ReplicationEndpoint replicationEndpoint) throws
Exception
{
jmsJournal.loadInternalOnly();
replicationEndpoint.registerJournal((byte)2, this.jmsJournal);
}
-
- /* (non-Javadoc)
- * @see org.hornetq.core.server.HornetQComponent#stop()
- */
+
+ @Override
public void stop() throws Exception
{
this.started = false;
@@ -321,13 +317,13 @@
public void load() throws Exception
{
mapFactories.clear();
-
+
List<RecordInfo> data = new ArrayList<RecordInfo>();
-
+
ArrayList<PreparedTransactionInfo> list = new
ArrayList<PreparedTransactionInfo>();
-
+
jmsJournal.load(data, list, null);
-
+
for (RecordInfo record : data)
{
long id = record.id;
@@ -335,7 +331,7 @@
HornetQBuffer buffer = HornetQBuffers.wrappedBuffer(record.data);
byte rec = record.getUserRecordType();
-
+
if (rec == CF_RECORD)
{
PersistedConnectionFactory cf = new PersistedConnectionFactory();
@@ -362,9 +358,9 @@
{
throw new IllegalStateException("Invalid record type " + rec);
}
-
+
}
-
+
}
// Package protected ---------------------------------------------
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java 2011-11-24
12:26:17 UTC (rev 11757)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/BackupSyncJournalTest.java 2011-11-24
12:26:38 UTC (rev 11758)
@@ -43,6 +43,7 @@
syncDelay = new BackupSyncDelay(backupServer, liveServer);
}
+
public void testNodeID() throws Exception
{
startBackupFinishSyncing();
Modified:
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java
===================================================================
---
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-11-24
12:26:17 UTC (rev 11757)
+++
trunk/tests/integration-tests/src/test/java/org/hornetq/tests/integration/cluster/failover/FailoverTest.java 2011-11-24
12:26:38 UTC (rev 11758)
@@ -41,7 +41,6 @@
import org.hornetq.api.core.client.ServerLocator;
import org.hornetq.api.core.client.SessionFailureListener;
import org.hornetq.core.client.impl.ClientSessionFactoryInternal;
-import org.hornetq.core.logging.Logger;
import org.hornetq.core.transaction.impl.XidImpl;
import org.hornetq.jms.client.HornetQTextMessage;
import org.hornetq.tests.integration.cluster.util.TestableServer;
@@ -58,7 +57,6 @@
*/
public class FailoverTest extends FailoverTestBase
{
- private static final Logger log = Logger.getLogger(FailoverTest.class);
private static final int NUM_MESSAGES = 100;
private ServerLocator locator;