Class GlobalWatermarkThroughputLimiter
- java.lang.Object
-
- cz.o2.proxima.core.storage.watermark.GlobalWatermarkThroughputLimiter
-
- All Implemented Interfaces:
ThroughputLimiter
,java.io.Closeable
,java.io.Serializable
,java.lang.AutoCloseable
public class GlobalWatermarkThroughputLimiter extends java.lang.Object implements ThroughputLimiter
AThroughputLimiter
that synchronizes progress of global watermark among distributed consumers.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface cz.o2.proxima.core.storage.ThroughputLimiter
ThroughputLimiter.Context, ThroughputLimiter.NoOpThroughputLimiter
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_SLEEP_TIME_CFG
Configuration key for the amount of time to sleep when reader is too far ahead global watermark in milliseconds.static java.lang.String
GLOBAL_WATERMARK_UPDATE_MS_CFG
Configuration key for number of milliseconds to pass between two updates of global watermark.static java.lang.String
MAX_AHEAD_TIME_MS_CFG
Configuration key for maximum amount of time that a reader can be ahead of a global watermark in milliseconds.
-
Constructor Summary
Constructors Constructor Description GlobalWatermarkThroughputLimiter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
java.time.Duration
getPauseTime(ThroughputLimiter.Context context)
Retrieve the amount of time the source should pause processing for.protected java.lang.Object
readResolve()
void
setup(java.util.Map<java.lang.String,java.lang.Object> cfg)
Setup the limiter with given configuration.java.lang.String
toString()
-
-
-
Field Detail
-
MAX_AHEAD_TIME_MS_CFG
public static final java.lang.String MAX_AHEAD_TIME_MS_CFG
Configuration key for maximum amount of time that a reader can be ahead of a global watermark in milliseconds.- See Also:
- Constant Field Values
-
GLOBAL_WATERMARK_UPDATE_MS_CFG
public static final java.lang.String GLOBAL_WATERMARK_UPDATE_MS_CFG
Configuration key for number of milliseconds to pass between two updates of global watermark.- See Also:
- Constant Field Values
-
DEFAULT_SLEEP_TIME_CFG
public static final java.lang.String DEFAULT_SLEEP_TIME_CFG
Configuration key for the amount of time to sleep when reader is too far ahead global watermark in milliseconds.- See Also:
- Constant Field Values
-
-
Method Detail
-
setup
public void setup(java.util.Map<java.lang.String,java.lang.Object> cfg)
Description copied from interface:ThroughputLimiter
Setup the limiter with given configuration.- Specified by:
setup
in interfaceThroughputLimiter
- Parameters:
cfg
- configuration (scoped to a (operator) defined prefix)
-
getPauseTime
public java.time.Duration getPauseTime(ThroughputLimiter.Context context)
Description copied from interface:ThroughputLimiter
Retrieve the amount of time the source should pause processing for. If the reader should proceed without pausing returnDuration.ZERO
. Note that this method is called for each input element andmust
be therefore cheap.- Specified by:
getPauseTime
in interfaceThroughputLimiter
- Parameters:
context
- context for the limiter- Returns:
- the amount of time to pause the source for.
-
close
public void close()
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceThroughputLimiter
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
readResolve
protected java.lang.Object readResolve()
-
-