]> source.dussan.org Git - archiva.git/commitdiff
Cleaning up potential multi-threading issues with use of static SimpleDateFormat.
authorJoakim Erdfelt <joakime@apache.org>
Fri, 19 Oct 2007 14:21:13 +0000 (14:21 +0000)
committerJoakim Erdfelt <joakime@apache.org>
Fri, 19 Oct 2007 14:21:13 +0000 (14:21 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@586472 13f79535-47bb-0310-9956-ffa450edef68

archiva-base/archiva-consumers/archiva-core-consumers/src/main/java/org/apache/maven/archiva/consumers/core/repository/DaysOldRepositoryPurge.java
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java
archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/scanner/RepositoryScanStatistics.java

index 79e64f3eea74e66118e3cd539534e45ad3818601..e8d8e0d6d464957fa91cd11c2a8a5441981386a4 100644 (file)
@@ -43,20 +43,17 @@ import java.util.regex.Matcher;
 public class DaysOldRepositoryPurge
     extends AbstractRepositoryPurge
 {
-    private static final SimpleDateFormat timestampParser;
-    static
-    {
-        timestampParser = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
-        timestampParser.setTimeZone( DateUtils.UTC_TIME_ZONE );
-    }
+    private SimpleDateFormat timestampParser;
 
     private int daysOlder;
-
+    
     public DaysOldRepositoryPurge( ManagedRepositoryContent repository, ArtifactDAO artifactDao,
                                    int daysOlder )
     {
         super( repository, artifactDao );
         this.daysOlder = daysOlder;
+        timestampParser = new SimpleDateFormat( "yyyyMMdd.HHmmss" );
+        timestampParser.setTimeZone( DateUtils.UTC_TIME_ZONE );
     }
 
     public void process( String path )
index d6a0f91342f506b709fb7e3d935fae7699744fc2..960f3d7983fb1b3bd4cfffa682e19ce20992e1ef 100644 (file)
@@ -101,9 +101,9 @@ public class MetadataTools
 
     private static final char NUMS[] = new char[] { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' };
 
-    private static final SimpleDateFormat lastUpdatedFormat;
+    private SimpleDateFormat lastUpdatedFormat;
 
-    static
+    public MetadataTools()
     {
         lastUpdatedFormat = new SimpleDateFormat( "yyyyMMddHHmmss" );
         lastUpdatedFormat.setTimeZone( DateUtils.UTC_TIME_ZONE );
index ba664af596fadd7a6c1f60700d23c8b96b6196cd..d7023b4446ecbbcec586a959bde8792699a8f07f 100644 (file)
@@ -23,6 +23,7 @@ import org.apache.commons.collections.CollectionUtils;
 import org.apache.maven.archiva.configuration.ManagedRepositoryConfiguration;
 import org.apache.maven.archiva.model.RepositoryContentStatistics;
 
+import java.text.SimpleDateFormat;
 import java.util.List;
 
 /**
@@ -39,6 +40,8 @@ public class RepositoryScanStatistics
     private transient List<String> invalidConsumers;
 
     private transient long startTimestamp;
+    
+    private SimpleDateFormat df = new SimpleDateFormat();
 
     public void triggerStart()
     {
@@ -76,7 +79,6 @@ public class RepositoryScanStatistics
 
     public String toDump( ManagedRepositoryConfiguration repo )
     {
-        java.text.SimpleDateFormat df = new java.text.SimpleDateFormat();
         StringBuffer buf = new StringBuffer();
 
         buf.append( "\n.\\ Scan of " ).append( this.getRepositoryId() );