Package org.apache.nifi.stream.io
Class LeakyBucketStreamThrottler
java.lang.Object
org.apache.nifi.stream.io.LeakyBucketStreamThrottler
- All Implemented Interfaces:
Closeable
,AutoCloseable
,StreamThrottler
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate class
This class is responsible for draining water from the leaky bucket.private static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ScheduledExecutorService
private final int
private final BlockingQueue
<LeakyBucketStreamThrottler.Request> private final AtomicBoolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
long
copy
(InputStream in, OutputStream out) long
copy
(InputStream in, OutputStream out, long maxBytes) newThrottledInputStream
(InputStream toWrap) newThrottledOutputStream
(OutputStream toWrap)
-
Field Details
-
maxBytesPerSecond
private final int maxBytesPerSecond -
requestQueue
-
executorService
-
shutdown
-
-
Constructor Details
-
LeakyBucketStreamThrottler
public LeakyBucketStreamThrottler(int maxBytesPerSecond)
-
-
Method Details
-
close
public void close()- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
newThrottledOutputStream
- Specified by:
newThrottledOutputStream
in interfaceStreamThrottler
-
newThrottledInputStream
- Specified by:
newThrottledInputStream
in interfaceStreamThrottler
-
copy
- Specified by:
copy
in interfaceStreamThrottler
- Throws:
IOException
-
copy
- Specified by:
copy
in interfaceStreamThrottler
- Throws:
IOException
-