Updated Branches: refs/heads/trunk 33cbb4133 -> e068284b8
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/e068284b Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/e068284b Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/e068284b Branch: refs/heads/trunk Commit: e068284b83858165b4d8a11cce0271c52dbbaa1f Parents: 33cbb41 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:15 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/e068284b/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();
