Author: borges
Date: 2011-09-09 11:07:29 -0400 (Fri, 09 Sep 2011)
New Revision: 11311
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicatedJournal.java
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/Journal.java
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/TestableJournal.java
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/FileWrapperJournal.java
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java
Log:
HORNETQ-720 Remove cast to JournalImpl and add necessary methods to Journal
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-09-09
12:43:32 UTC (rev 11310)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/persistence/impl/journal/JournalStorageManager.java 2011-09-09
15:07:29 UTC (rev 11311)
@@ -368,8 +368,8 @@
JournalFile[] messageFiles = null;
JournalFile[] bindingsFiles = null;
- final JournalImpl localMessageJournal = (JournalImpl)messageJournal;
- final JournalImpl localBindingsJournal = (JournalImpl)bindingsJournal;
+ final Journal localMessageJournal = messageJournal;
+ final Journal localBindingsJournal = bindingsJournal;
final boolean messageJournalAutoReclaim = localMessageJournal.getAutoReclaim();
final boolean bindingsJournalAutoReclaim = localBindingsJournal.getAutoReclaim();
@@ -462,9 +462,7 @@
for (SimpleString storeName : pagingManager.getStoreNames())
{
PagingStore store = pagingManager.getPageStore(storeName);
- List<Integer> ids = new ArrayList<Integer>();
info.put(storeName, store.getCurrentIds());
- // HORNETQ-720 XXX perhaps before? unnecessary?
store.forceAnotherPage();
}
return info;
@@ -521,7 +519,7 @@
}
}
- private JournalFile[] prepareJournalForCopy(JournalImpl journal, JournalContent
contentType) throws Exception
+ private JournalFile[] prepareJournalForCopy(Journal journal, JournalContent
contentType) throws Exception
{
journal.setAutoReclaim(false);
/*
Modified:
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicatedJournal.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicatedJournal.java 2011-09-09
12:43:32 UTC (rev 11310)
+++
branches/HORNETQ-720_Replication/hornetq-core/src/main/java/org/hornetq/core/replication/impl/ReplicatedJournal.java 2011-09-09
15:07:29 UTC (rev 11311)
@@ -584,6 +584,42 @@
throw new UnsupportedOperationException("This method should only be called at
a replicating backup");
}
+ @Override
+ public boolean getAutoReclaim()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void writeLock()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void writeUnlock()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setAutoReclaim(boolean autoReclaim)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void forceMoveNextFile()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public JournalFile[] getDataFiles()
+ {
+ throw new UnsupportedOperationException();
+ }
+
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
Modified:
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/Journal.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/Journal.java 2011-09-09
12:43:32 UTC (rev 11310)
+++
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/Journal.java 2011-09-09
15:07:29 UTC (rev 11311)
@@ -156,4 +156,38 @@
*/
JournalFile createFilesForBackupSync(long[] fileIds, Map<Long, JournalFile>
mapToFill) throws Exception;
+ /**
+ * @return whether automatic reclaiming of Journal files is enabled
+ */
+ boolean getAutoReclaim();
+
+ /**
+ * Write lock the Journal. Necessary only during replication for backup
synchronization.
+ */
+ void writeLock();
+
+ /**
+ * Write-unlock the Journal.
+ * @see Journal#writeLock()
+ */
+ void writeUnlock();
+
+ /**
+ * Sets whether the journal should auto-reclaim its internal files.
+ * @param autoReclaim
+ */
+ void setAutoReclaim(boolean autoReclaim);
+
+ /**
+ * Force the usage of a new {@link JournalFile}.
+ * @throws Exception
+ */
+ void forceMoveNextFile() throws Exception;
+
+ /**
+ * Returns the {@link JournalFile}s in use.
+ * @return
+ */
+ JournalFile[] getDataFiles();
+
}
Modified:
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/TestableJournal.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/TestableJournal.java 2011-09-09
12:43:32 UTC (rev 11310)
+++
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/TestableJournal.java 2011-09-09
15:07:29 UTC (rev 11311)
@@ -47,10 +47,6 @@
int getMaxAIO();
- void forceMoveNextFile() throws Exception;
-
- void setAutoReclaim(boolean autoReclaim);
-
void testCompact() throws Exception;
JournalFile getCurrentFile();
@@ -58,6 +54,4 @@
/** This method is called automatically when a new file is opened.
* @return true if it needs to re-check due to cleanup or other factors */
boolean checkReclaimStatus() throws Exception;
-
- JournalFile[] getDataFiles();
}
Modified:
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/FileWrapperJournal.java
===================================================================
---
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/FileWrapperJournal.java 2011-09-09
12:43:32 UTC (rev 11310)
+++
branches/HORNETQ-720_Replication/hornetq-journal/src/main/java/org/hornetq/core/journal/impl/FileWrapperJournal.java 2011-09-09
15:07:29 UTC (rev 11311)
@@ -264,4 +264,40 @@
{
throw new UnsupportedOperationException();
}
+
+ @Override
+ public boolean getAutoReclaim()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void writeLock()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void writeUnlock()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void setAutoReclaim(boolean autoReclaim)
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public void forceMoveNextFile()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public JournalFile[] getDataFiles()
+ {
+ throw new UnsupportedOperationException();
+ }
}
Modified:
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java
===================================================================
---
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java 2011-09-09
12:43:32 UTC (rev 11310)
+++
branches/HORNETQ-720_Replication/tests/integration-tests/src/test/java/org/hornetq/tests/integration/replication/ReplicationTest.java 2011-09-09
15:07:29 UTC (rev 11311)
@@ -838,29 +838,61 @@
void
appendCommitRecord(long txID, boolean sync, IOCompletion callback, boolean
lineUpContext) throws Exception
{
- // TODO Auto-generated method stub
}
public void lineUpContex(IOCompletion callback)
{
- // TODO Auto-generated method stub
}
@Override
public JournalLoadInformation loadSyncOnly() throws Exception
{
- // TODO Auto-generated method stub
return null;
}
@Override
public JournalFile createFilesForBackupSync(long[] fileIds, Map<Long,
JournalFile> mapToFill) throws Exception
{
- // TODO Auto-generated method stub
return null;
}
+ @Override
+ public boolean getAutoReclaim()
+ {
+ return false;
+ }
+
+ @Override
+ public void writeLock()
+ {
+
+ }
+
+ @Override
+ public void writeUnlock()
+ {
+
+ }
+
+ @Override
+ public void setAutoReclaim(boolean autoReclaim)
+ {
+
+ }
+
+ @Override
+ public void forceMoveNextFile() throws Exception
+ {
+
+ }
+
+ @Override
+ public JournalFile[] getDataFiles()
+ {
+ return null;
+ }
+
}
}
Show replies by date