commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nico...@apache.org
Subject svn commit: r741577 - /commons/sandbox/monitoring/branches/modules/reporting/src/main/java/org/apache/commons/monitoring/reporting/AbstractPeriodicLogger.java
Date Fri, 06 Feb 2009 14:43:46 GMT
Author: nicolas
Date: Fri Feb  6 14:43:45 2009
New Revision: 741577

URL: http://svn.apache.org/viewvc?rev=741577&view=rev
Log:
Support for TimeUnit for period/delay

Modified:
    commons/sandbox/monitoring/branches/modules/reporting/src/main/java/org/apache/commons/monitoring/reporting/AbstractPeriodicLogger.java

Modified: commons/sandbox/monitoring/branches/modules/reporting/src/main/java/org/apache/commons/monitoring/reporting/AbstractPeriodicLogger.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/branches/modules/reporting/src/main/java/org/apache/commons/monitoring/reporting/AbstractPeriodicLogger.java?rev=741577&r1=741576&r2=741577&view=diff
==============================================================================
--- commons/sandbox/monitoring/branches/modules/reporting/src/main/java/org/apache/commons/monitoring/reporting/AbstractPeriodicLogger.java
(original)
+++ commons/sandbox/monitoring/branches/modules/reporting/src/main/java/org/apache/commons/monitoring/reporting/AbstractPeriodicLogger.java
Fri Feb  6 14:43:45 2009
@@ -41,10 +41,10 @@
     private ObserverRepository secondary;
 
     /** The interval for periodic logging of monitored state */
-    private int period;
+    private long period;
 
     /** The initial delay */
-    private int delay;
+    private long delay;
 
     /**
      * @param period the period (in ms) to log the monitoring state
@@ -120,13 +120,40 @@
         this.repository = repository;
     }
 
-    public void setPeriod( int period )
+    /**
+     * @param period in MILLISECONDS
+     * @see #setPeriod(long, TimeUnit)
+     */
+    public void setPeriod( long period )
     {
         this.period = period;
     }
 
-    public void setDelay( int delay )
+    /**
+     * @param period The period to wait between logging processes
+     * @param unit time unit
+     */
+    public void setPeriod( long period, TimeUnit unit )
+    {
+        this.period = TimeUnit.MILLISECONDS.convert( period, unit );
+    }
+
+    /**
+     * @param delay in MILLISECONDS
+     * @see #setDelay(long, TimeUnit)
+     */
+    public void setDelay( long delay )
     {
         this.delay = delay;
     }
+
+    /**
+     * @param delay The delay to wait before first logging process
+     * @param unit time unit
+     */
+    public void setDelay( long delay, TimeUnit unit )
+    {
+        this.delay = TimeUnit.MILLISECONDS.convert( delay, unit );
+    }
+
 }



Mime
View raw message