public class LogCopier
extends com.google.common.util.concurrent.AbstractScheduledService
FileSystems.
This class extends the AbstractScheduledService so it can be used with a
ServiceManager that manages the lifecycle of
a LogCopier.
This class is intended to be used in the following pattern:
LogCopier.Builder logCopierBuilder = LogCopier.newBuilder();
LogCopier logCopier = logCopierBuilder
.useSrcFileSystem(FileSystem.getLocal(new Configuration()))
.useDestFileSystem(FileSystem.get(URI.create(destFsUri), new Configuration()))
.readFrom(new Path(srcLogDir))
.writeTo(new Path(destLogDir))
.useSourceLogFileMonitorInterval(60)
.useTimeUnit(TimeUnit.SECONDS)
.build();
ServiceManager serviceManager = new ServiceManager(Lists.newArrayList(logCopier));
serviceManager.startAsync();
// ...
serviceManager.stopAsync().awaitStopped(60, TimeUnit.SECONDS);
Checkout the Javadoc of LogCopier.Builder to see the available options for customization.
| Modifier and Type | Class and Description |
|---|---|
static class |
LogCopier.Builder
A builder class for
LogCopier. |
| Modifier and Type | Method and Description |
|---|---|
static LogCopier.Builder |
newBuilder()
Get a new
LogCopier.Builder instance for building a LogCopier. |
protected void |
runOneIteration() |
protected com.google.common.util.concurrent.AbstractScheduledService.Scheduler |
scheduler() |
protected void |
shutDown() |
protected void shutDown()
throws Exception
shutDown in class com.google.common.util.concurrent.AbstractScheduledServiceExceptionprotected void runOneIteration()
throws IOException
runOneIteration in class com.google.common.util.concurrent.AbstractScheduledServiceIOExceptionprotected com.google.common.util.concurrent.AbstractScheduledService.Scheduler scheduler()
scheduler in class com.google.common.util.concurrent.AbstractScheduledServicepublic static LogCopier.Builder newBuilder()
LogCopier.Builder instance for building a LogCopier.LogCopier.Builder instance