Fixed overflow notification could eventually get into infinate recusion.


git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk/activeio@412759 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/activeio-core/src/main/java/org/apache/activeio/journal/active/JournalImpl.java b/activeio-core/src/main/java/org/apache/activeio/journal/active/JournalImpl.java
index 29522b1..32d17cc 100644
--- a/activeio-core/src/main/java/org/apache/activeio/journal/active/JournalImpl.java
+++ b/activeio-core/src/main/java/org/apache/activeio/journal/active/JournalImpl.java
@@ -86,7 +86,8 @@
     private ByteBufferPacketPool packetPool;
     private long overflowNotificationTime = System.currentTimeMillis();
     private Packet markPacket = new ByteArrayPacket(new byte[Location.SERIALIZED_SIZE]);
-
+    private boolean doingNotification=false;
+    
     public JournalImpl(File logDirectory) throws IOException {
         this(new LogFileManager(logDirectory));
     }
@@ -267,13 +268,17 @@
 
         // See if we need to issue an overflow notification.
         if (eventListener != null && file.isPastHalfActive()
-                && overflowNotificationTime + OVERFLOW_RENOTIFICATION_DELAY < System.currentTimeMillis()) {
-
-            // We need to send an overflow notification to free up
-            // some logFiles.
-            Location safeSpot = file.getFirstRecordLocationOfSecondActiveLogFile();
-            eventListener.overflowNotification(safeSpot);
-            overflowNotificationTime = System.currentTimeMillis();
+                && overflowNotificationTime + OVERFLOW_RENOTIFICATION_DELAY < System.currentTimeMillis() && !doingNotification ) {
+            doingNotification = true;
+            try {
+                // We need to send an overflow notification to free up
+                // some logFiles.
+                Location safeSpot = file.getFirstRecordLocationOfSecondActiveLogFile();
+                eventListener.overflowNotification(safeSpot);
+                overflowNotificationTime = System.currentTimeMillis();
+            } finally {
+                doingNotification = false;
+            }
         }
 
         // Is it time to roll over?
diff --git a/activeio-core/src/test/java/org/apache/activeio/journal/JournalPerfToolSupport.java b/activeio-core/src/test/java/org/apache/activeio/journal/JournalPerfToolSupport.java
index 4313f85..32f870c 100644
--- a/activeio-core/src/test/java/org/apache/activeio/journal/JournalPerfToolSupport.java
+++ b/activeio-core/src/test/java/org/apache/activeio/journal/JournalPerfToolSupport.java
@@ -153,7 +153,7 @@
     
 	public void overflowNotification(RecordLocation safeLocation) {
 		try {
-			System.out.println("Mark set: "+safeLocation);
+			// System.out.println("Mark set: "+safeLocation);
 			journal.setMark(safeLocation, false);
 		} catch (InvalidRecordLocationException e) {
 			e.printStackTrace();
diff --git a/activeio-core/src/test/java/org/apache/activeio/journal/active/JournalPerfTool.java b/activeio-core/src/test/java/org/apache/activeio/journal/active/JournalPerfTool.java
index 5b3bb0b..f26729b 100644
--- a/activeio-core/src/test/java/org/apache/activeio/journal/active/JournalPerfTool.java
+++ b/activeio-core/src/test/java/org/apache/activeio/journal/active/JournalPerfTool.java
@@ -30,11 +30,16 @@
  */
 public class JournalPerfTool extends JournalPerfToolSupport {
 	
-	private int logFileSize = 1024*1000*5;
+	private int logFileSize = 1024*1024*50;
     private int logFileCount = 4;
 	
 	public static void main(String[] args) throws Exception {
 		JournalPerfTool tool = new JournalPerfTool();
+        tool.syncFrequency=15;
+        tool.workerIncrement=50;
+        tool.workerThinkTime=0;
+        tool.verbose=false;
+
 		if( args.length > 0 ) {
 			tool.journalDirectory = new File(args[0]);
 		}