public class LeakyBucketStreamThrottler extends Object implements StreamThrottler
| Modifier and Type | Class and Description |
|---|---|
private class |
LeakyBucketStreamThrottler.Drain
This class is responsible for draining water from the leaky bucket.
|
private static class |
LeakyBucketStreamThrottler.Request |
private static class |
LeakyBucketStreamThrottler.Response |
| Modifier and Type | Field and Description |
|---|---|
private ScheduledExecutorService |
executorService |
private int |
maxBytesPerSecond |
private BlockingQueue<LeakyBucketStreamThrottler.Request> |
requestQueue |
private AtomicBoolean |
shutdown |
| Constructor and Description |
|---|
LeakyBucketStreamThrottler(int maxBytesPerSecond) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
long |
copy(InputStream in,
OutputStream out) |
long |
copy(InputStream in,
OutputStream out,
long maxBytes) |
InputStream |
newThrottledInputStream(InputStream toWrap) |
OutputStream |
newThrottledOutputStream(OutputStream toWrap) |
private final int maxBytesPerSecond
private final BlockingQueue<LeakyBucketStreamThrottler.Request> requestQueue
private final ScheduledExecutorService executorService
private final AtomicBoolean shutdown
public LeakyBucketStreamThrottler(int maxBytesPerSecond)
public void close()
close in interface Closeableclose in interface AutoCloseablepublic OutputStream newThrottledOutputStream(OutputStream toWrap)
newThrottledOutputStream in interface StreamThrottlerpublic InputStream newThrottledInputStream(InputStream toWrap)
newThrottledInputStream in interface StreamThrottlerpublic long copy(InputStream in, OutputStream out) throws IOException
copy in interface StreamThrottlerIOExceptionpublic long copy(InputStream in, OutputStream out, long maxBytes) throws IOException
copy in interface StreamThrottlerIOExceptionCopyright © 2019 Apache NiFi Project. All rights reserved.