[jboss-cvs] JBoss Messaging SVN: r5700 - in trunk: src/main/org/jboss/messaging/core/paging/impl and 2 other directories.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 22 23:50:09 EST 2009
Author: clebert.suconic at jboss.com
Date: 2009-01-22 23:50:09 -0500 (Thu, 22 Jan 2009)
New Revision: 5700
Modified:
trunk/src/main/org/jboss/messaging/core/paging/PagingManager.java
trunk/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java
trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java
trunk/src/main/org/jboss/messaging/core/server/ServerConsumer.java
trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java
Log:
Fixing PageStressTest and concurrent shutdown
Modified: trunk/src/main/org/jboss/messaging/core/paging/PagingManager.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/PagingManager.java 2009-01-23 03:03:17 UTC (rev 5699)
+++ trunk/src/main/org/jboss/messaging/core/paging/PagingManager.java 2009-01-23 04:50:09 UTC (rev 5700)
@@ -26,7 +26,6 @@
import org.jboss.messaging.core.journal.SequentialFile;
import org.jboss.messaging.core.postoffice.PostOffice;
-import org.jboss.messaging.core.server.MessageReference;
import org.jboss.messaging.core.server.MessagingComponent;
import org.jboss.messaging.core.server.ServerMessage;
import org.jboss.messaging.util.SimpleString;
@@ -59,9 +58,9 @@
public interface PagingManager extends MessagingComponent
{
void activate();
-
+
boolean isBackup();
-
+
/** The system is paging because of global-page-mode */
boolean isGlobalPageMode();
@@ -95,10 +94,9 @@
* @param sync - Sync should be called right after the write
* @return false if destination is not on page mode
*/
-
-
- //FIXME - why are these methods still on PagingManager???
- //The current code is doing a lookup every time through this class just to call page store!!
+
+ // FIXME - why are these methods still on PagingManager???
+ // The current code is doing a lookup every time through this class just to call page store!!
boolean page(ServerMessage message, boolean duplicateDetection) throws Exception;
/**
@@ -106,10 +104,9 @@
* @param message
* @return false if destination is not on page mode
*/
-
- //FIXME - why are these methods still on PagingManager???
- //The current code is doing a lookup every time through this class just to call page store!!
+ // FIXME - why are these methods still on PagingManager???
+ // The current code is doing a lookup every time through this class just to call page store!!
boolean page(ServerMessage message, long transactionId, boolean duplicateDetection) throws Exception;
/**
Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java 2009-01-23 03:03:17 UTC (rev 5699)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PagingManagerImpl.java 2009-01-23 04:50:09 UTC (rev 5700)
@@ -276,8 +276,6 @@
store.stop();
}
- stores.clear();
-
pagingStoreFactory.stop();
globalSize.set(0);
@@ -285,14 +283,25 @@
globalMode.set(false);
}
- public synchronized void startGlobalDepage()
+ public void startGlobalDepage()
{
- if (!isBackup())
+ if (!started)
{
- setGlobalPageMode(true);
- for (PagingStore store : stores.values())
+ // If stop the server while depaging, the server may call a rollback,
+ // the rollback may addSizes back and that would fire a globalDepage.
+ // Because of that we must ignore any startGlobalDepage calls,
+ // and this check needs to be done outside of the lock
+ return;
+ }
+ synchronized (this)
+ {
+ if (!isBackup())
{
- store.startDepaging(pagingStoreFactory.getGlobalDepagerExecutor());
+ setGlobalPageMode(true);
+ for (PagingStore store : stores.values())
+ {
+ store.startDepaging(pagingStoreFactory.getGlobalDepagerExecutor());
+ }
}
}
}
Modified: trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java 2009-01-23 03:03:17 UTC (rev 5699)
+++ trunk/src/main/org/jboss/messaging/core/paging/impl/PagingStoreImpl.java 2009-01-23 04:50:09 UTC (rev 5700)
@@ -451,6 +451,11 @@
public boolean startDepaging(final Executor executor)
{
+ if (!running)
+ {
+ return false;
+ }
+
if (pagingManager.isBackup())
{
return false;
@@ -511,7 +516,7 @@
if (!ok)
{
- log.warn("Timed out waiting for depage executor to stop");
+ log.warn("Timed out waiting for depage executor on destination " + this.storeName + " to stop");
}
if (currentPage != null)
@@ -1045,16 +1050,12 @@
}
// Note: clearDepage is an atomic operation, it needs to be done even if readPage was not executed
- // because the page was full
+ // however clearDepage shouldn't be executed if the page-store is being stopped, as stop will be holding the lock and this would dead lock
if (running && !clearDepage())
{
followingExecutor.execute(this);
}
}
- else
- {
- System.out.println("Not running, giving up");
- }
}
catch (Exception e)
{
Modified: trunk/src/main/org/jboss/messaging/core/server/ServerConsumer.java
===================================================================
--- trunk/src/main/org/jboss/messaging/core/server/ServerConsumer.java 2009-01-23 03:03:17 UTC (rev 5699)
+++ trunk/src/main/org/jboss/messaging/core/server/ServerConsumer.java 2009-01-23 04:50:09 UTC (rev 5700)
@@ -26,7 +26,6 @@
import org.jboss.messaging.core.remoting.Packet;
import org.jboss.messaging.core.transaction.Transaction;
-import org.jboss.messaging.util.SimpleString;
/**
*
Modified: trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java 2009-01-23 03:03:17 UTC (rev 5699)
+++ trunk/tests/src/org/jboss/messaging/tests/stress/paging/PageStressTest.java 2009-01-23 04:50:09 UTC (rev 5700)
@@ -313,11 +313,21 @@
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
+ protected Configuration createDefaultConfig()
+ {
+ Configuration config = super.createDefaultConfig();
+ config.setJournalFileSize(10 * 1024 * 1024);
+ config.setJournalMinFiles(5);
+
+ return config;
+ }
+
@Override
protected void setUp() throws Exception
{
clearData();
+ super.setUp();
}
@Override
More information about the jboss-cvs-commits
mailing list