Commits

Don Brown  committed a4db080

Better oom exception message

  • Participants
  • Parent commits 7a4e0fb

Comments (0)

Files changed (2)

File levee-runtime/src/main/java/com/atlassian/levee/runtime/MemoryUsageExceededException.java

 
 public class MemoryUsageExceededException extends RuntimeException
 {
+    public MemoryUsageExceededException(String message)
+    {
+        super(message);
+    }
 }

File levee-runtime/src/main/java/com/atlassian/levee/runtime/MemoryUsageMonitor.java

             return;
         }
         remainingBytes.set(remainingBytes.get() - bytesToAllocate);
-//      System.out.println("remaining bytes: " + remaining);
+        //System.out.println("remaining bytes: " + remainingBytes.get() + " thread: " + Thread.currentThread().getId());
         if (remainingBytes.get() <= 0)
         {
-            throw new MemoryUsageExceededException();
+            throw new MemoryUsageExceededException("Memory usage exceeded " + memoryUsagePolicy.getMaxBytes() + " bytes " +
+                "by " + remainingBytes.get() + " bytes with allocation of " + bytesToAllocate + " bytes");
         }
     }