Author: borges
Date: 2011-07-08 07:09:48 -0400 (Fri, 08 Jul 2011)
New Revision: 10961
Modified:
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java
Log:
Move journal state transitions to a method (as it allows easier logging)
Modified:
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java 2011-07-08
11:09:20 UTC (rev 10960)
+++
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/JournalImpl.java 2011-07-08
11:09:48 UTC (rev 10961)
@@ -1083,6 +1083,12 @@
}
}
+ private void setJournalState(JournalState newState)
+ {
+ // log.info(this + " state=" + newState);
+ state = newState;
+ }
+
public void appendUpdateRecordTransactional(final long txID,
final long id,
final byte recordType,
@@ -1863,7 +1869,7 @@
{
if (state != JournalState.STARTED)
{
- throw new IllegalStateException("Journal must be in started state");
+ throw new IllegalStateException("Journal " + this + " must be in
started state, was " + state);
}
checkControlFile();
@@ -2177,7 +2183,7 @@
filesRepository.pushOpenedFile();
- state = JournalState.LOADED;
+ setJournalState(JournalState.LOADED);
for (TransactionHolder transaction : loadTransactions.values())
{
@@ -2515,7 +2521,7 @@
{
if (state != JournalState.STOPPED)
{
- throw new IllegalStateException("Journal is not stopped");
+ throw new IllegalStateException("Journal " + this + " is not
stopped, state is " + state);
}
filesExecutor = Executors.newSingleThreadExecutor(new ThreadFactory()
@@ -2540,7 +2546,7 @@
fileFactory.start();
- state = JournalState.STARTED;
+ setJournalState(JournalState.STARTED);
}
public synchronized void stop() throws Exception
@@ -2557,7 +2563,7 @@
try
{
- state = JournalState.STOPPED;
+ setJournalState(JournalState.STOPPED);
compactorExecutor.shutdown();
Show replies by date