Updated Branches:
  refs/heads/flume-1.3.0 9abd3d53d -> 56ba7ba27

FLUME-1611: LogUtils regex can be precompiled

(Hari Shreedharan via Brock Noland)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/56ba7ba2
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/56ba7ba2
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/56ba7ba2

Branch: refs/heads/flume-1.3.0
Commit: 56ba7ba2701daeeb2879ce37ced7e6fa79e679cc
Parents: 9abd3d5
Author: Brock Noland <[email protected]>
Authored: Tue Sep 25 20:26:15 2012 -0500
Committer: Brock Noland <[email protected]>
Committed: Tue Sep 25 20:26:28 2012 -0500

----------------------------------------------------------------------
 .../org/apache/flume/channel/file/LogUtils.java    |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/56ba7ba2/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogUtils.java
----------------------------------------------------------------------
diff --git 
a/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogUtils.java
 
b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogUtils.java
index c2b9564..13f7298 100644
--- 
a/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogUtils.java
+++ 
b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/LogUtils.java
@@ -28,6 +28,9 @@ import com.google.common.collect.Lists;
 
 public class LogUtils {
 
+  private static final Pattern pattern =
+          Pattern.compile("^" + Log.PREFIX + "\\d+$");
+
   /**
    * Sort a list of files by the number after Log.PREFIX.
    */
@@ -59,7 +62,6 @@ public class LogUtils {
    * @return List of data files within logDir
    */
   static List<File> getLogs(File logDir) {
-    Pattern pattern = Pattern.compile("^" + Log.PREFIX + "\\d+$");
     List<File> result = Lists.newArrayList();
     for (File file : logDir.listFiles()) {
       String name = file.getName();

Reply via email to