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-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor Resource.java StreamResource.java
Date Sun, 08 Sep 2002 00:29:43 GMT
donaldp     2002/09/07 17:29:43

  Modified:    monitor/src/java/org/apache/avalon/excalibur/monitor
                        Resource.java StreamResource.java
  Log:
  Extract a method to reduce code duplication
  
  Revision  Changes    Path
  1.14      +15 -5     jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/Resource.java
  
  Index: Resource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/Resource.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Resource.java	8 Sep 2002 00:25:12 -0000	1.13
  +++ Resource.java	8 Sep 2002 00:29:43 -0000	1.14
  @@ -90,11 +90,21 @@
           final long lastModified = lastModified();
           if( lastModified > getPreviousModified() || lastModified > time )
           {
  -            getEventSupport().firePropertyChange( Resource.MODIFIED,
  -                                                  new Long( getPreviousModified() ),
  -                                                  new Long( lastModified ) );
  -            setPreviousModified( lastModified );
  +            fireAndSetModifiedTime( lastModified );
           }
  +    }
  +
  +    /**
  +     * Fire a modify event and set the lastModified time as appropraite.
  +     *
  +     * @param lastModified the time modified at
  +     */
  +    protected void fireAndSetModifiedTime( final long lastModified )
  +    {
  +        getEventSupport().firePropertyChange( Resource.MODIFIED,
  +                                              new Long( getPreviousModified() ),
  +                                              new Long( lastModified ) );
  +        setPreviousModified( lastModified );
       }
   
       /**
  
  
  
  1.7       +2 -8      jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/StreamResource.java
  
  Index: StreamResource.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/monitor/src/java/org/apache/avalon/excalibur/monitor/StreamResource.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- StreamResource.java	7 Sep 2002 12:28:36 -0000	1.6
  +++ StreamResource.java	8 Sep 2002 00:29:43 -0000	1.7
  @@ -66,12 +66,6 @@
        */
       protected void streamClosedEvent()
       {
  -        long lastModified = System.currentTimeMillis();
  -
  -        getEventSupport().firePropertyChange( Resource.MODIFIED,
  -                                           new Long( getPreviousModified() ),
  -                                           new Long( lastModified ) );
  -
  -        setPreviousModified( lastModified );
  +        fireAndSetModifiedTime( System.currentTimeMillis() );
       }
   }
  
  
  

--
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