FLUME-1434: Distinguish background worker with channel name (Denny Ye 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/677912bd Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/677912bd Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/677912bd Branch: refs/heads/cdh-1.2.0+24_intuit Commit: 677912bdbb64c406858982b58f57f7ae334ab07c Parents: 444b75a Author: Brock Noland <[email protected]> Authored: Tue Aug 7 09:19:33 2012 -0500 Committer: Hari Shreedharan <[email protected]> Committed: Fri Sep 7 13:09:58 2012 -0700 ---------------------------------------------------------------------- .../java/org/apache/flume/channel/file/Log.java | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flume/blob/677912bd/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java ---------------------------------------------------------------------- diff --git a/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java index 778db64..2b733b1 100644 --- a/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java +++ b/flume-ng-channels/flume-file-channel/src/main/java/org/apache/flume/channel/file/Log.java @@ -156,6 +156,9 @@ class Log { + checkpointDir + " could not be created"); Preconditions.checkNotNull(logDirs, "logDirs"); Preconditions.checkArgument(logDirs.length > 0, "logDirs empty"); + Preconditions.checkArgument(name != null && !name.trim().isEmpty(), + "channel name should be specified"); + this.channelName = name; this.channelNameDescriptor = "[channel=" + name + "]"; @@ -186,7 +189,7 @@ class Log { this.checkpointWriteTimeout = checkpointWriteTimeout; logFiles = new AtomicReferenceArray<LogFile.Writer>(this.logDirs.length); worker = new BackgroundWorker(this); - worker.setName("Log-BackgroundWorker"); + worker.setName("Log-BackgroundWorker-" + name); worker.setDaemon(true); worker.start(); }
