avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/scheduler DefaultTimeScheduler.java
Date Sat, 18 May 2002 03:55:41 GMT
donaldp     02/05/17 20:55:41

  Modified:    src/java/org/apache/avalon/cornerstone/blocks/scheduler
                        DefaultTimeScheduler.java
  Log:
  Add some javadocs
  
  Revision  Changes    Path
  1.14      +35 -11    jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/scheduler/DefaultTimeScheduler.java
  
  Index: DefaultTimeScheduler.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/src/java/org/apache/avalon/cornerstone/blocks/scheduler/DefaultTimeScheduler.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- DefaultTimeScheduler.java	12 May 2002 08:06:41 -0000	1.13
  +++ DefaultTimeScheduler.java	18 May 2002 03:55:41 -0000	1.14
  @@ -23,7 +23,6 @@
   import org.apache.avalon.framework.component.ComponentManager;
   import org.apache.avalon.framework.component.Composable;
   import org.apache.avalon.framework.logger.AbstractLogEnabled;
  -import org.apache.avalon.framework.logger.Logger;
   import org.apache.avalon.phoenix.Block;
   
   /**
  @@ -203,21 +202,18 @@
           }
       }
   
  +    /**
  +     * Rune entry in a separate thread.
  +     *
  +     * @param entry the entry to run
  +     */
       private void runEntry( final TimeScheduledEntry entry )
       {
  -        final Logger logger = getLogger();
           final Runnable runnable = new Runnable()
           {
               public void run()
               {
  -                try
  -                {
  -                    entry.getTarget().targetTriggered( entry.getName() );
  -                }
  -                catch( final Throwable t )
  -                {
  -                    logger.warn( "Error occured executing trigger " + entry.getName(),
t );
  -                }
  +                doRunEntry( entry );
               }
           };
   
  @@ -232,6 +228,24 @@
           }
       }
   
  +    /**
  +     * Helper method delegated to to run in a separate thread.
  +     *
  +     * @param entry the entry to run
  +     */
  +    private void doRunEntry( final TimeScheduledEntry entry )
  +    {
  +        try
  +        {
  +            entry.getTarget().targetTriggered( entry.getName() );
  +        }
  +        catch( final Throwable t )
  +        {
  +            final String message = "Error occured executing trigger " + entry.getName();
  +            getLogger().warn( message, t );
  +        }
  +    }
  +
       public void start()
           throws Exception
       {
  @@ -248,6 +262,10 @@
           }
       }
   
  +    /**
  +     * Entry point for thread that monitors entrys and triggers
  +     * entrys when necessary.
  +     */
       public void run()
       {
           m_running = true;
  @@ -283,7 +301,6 @@
                   if( duration < 0 )
                   {
                       runEntry( entry );
  -
                       rescheduleEntry( entry, false );
                       continue;
                   }
  @@ -313,6 +330,13 @@
           }
       }
   
  +    /**
  +     * Retrieve next valid entry. It will pop off any
  +     * invalid entrys until the heap is empty or a valid entry
  +     * is found.
  +     *
  +     * @return the next valid entry or null if none
  +     */
       private synchronized TimeScheduledEntry getNextEntry()
       {
           TimeScheduledEntry entry =
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message