From e4eed9d775a79fd7d3ab8246ac4e42564e4edb6a Mon Sep 17 00:00:00 2001 From: mdb Date: Tue, 8 Apr 2008 01:20:55 +0000 Subject: [PATCH] If we encounter an error posting ourselves to a run-queue when we expire, log something useful. git-svn-id: https://samskivert.googlecode.com/svn/trunk@2292 6335cc39-0255-0410-8fd6-9bcaacd3b74c --- src/java/com/samskivert/util/Interval.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/java/com/samskivert/util/Interval.java b/src/java/com/samskivert/util/Interval.java index 10c2b758..adc81673 100644 --- a/src/java/com/samskivert/util/Interval.java +++ b/src/java/com/samskivert/util/Interval.java @@ -22,8 +22,9 @@ package com.samskivert.util; import java.util.Timer; import java.util.TimerTask; +import java.util.logging.Level; -import com.samskivert.Log; +import static com.samskivert.Log.log; /** * An interface for doing operations after some delay. Allows expiration to occur on a specific @@ -154,8 +155,7 @@ public abstract class Interval try { expired(); } catch (Throwable t) { - Log.warning("Interval broken in expired(): " + t); - Log.logStackTrace(t); + log.log(Level.WARNING, "Interval broken in expired() " + this, t); } } else { @@ -203,7 +203,12 @@ public abstract class Interval } }; } - _runQueue.postRunnable(_runner); + try { + _runQueue.postRunnable(_runner); + } catch (Exception e) { + log.log(Level.WARNING, "Failed to execute interval on run-queue " + + "[queue=" + _runQueue + ", interval=" + Interval.this + "].", e); + } } }