Class FlushStrategyHolder
- java.lang.Object
-
- io.servicetalk.transport.netty.internal.FlushStrategyHolder
-
public final class FlushStrategyHolder extends java.lang.Object
A utility class to hold aFlushStrategy
and allow it to be updated atomically usingupdateFlushStrategy(NettyConnectionContext.FlushStrategyProvider)
.
-
-
Constructor Summary
Constructors Constructor Description FlushStrategyHolder(FlushStrategy flushStrategy)
Creates new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FlushStrategy
currentStrategy()
Returns the current value of the enclosedFlushStrategy
.Cancellable
updateFlushStrategy(NettyConnectionContext.FlushStrategyProvider strategyProvider)
UpdatesFlushStrategy
enclosed in thisFlushStrategyHolder
.
-
-
-
Constructor Detail
-
FlushStrategyHolder
public FlushStrategyHolder(FlushStrategy flushStrategy)
Creates new instance.- Parameters:
flushStrategy
- InitialFlushStrategy
to use.
-
-
Method Detail
-
currentStrategy
public FlushStrategy currentStrategy()
Returns the current value of the enclosedFlushStrategy
.- Returns:
- Current value of the enclosed
FlushStrategy
.
-
updateFlushStrategy
public Cancellable updateFlushStrategy(NettyConnectionContext.FlushStrategyProvider strategyProvider)
UpdatesFlushStrategy
enclosed in thisFlushStrategyHolder
.- Parameters:
strategyProvider
-NettyConnectionContext.FlushStrategyProvider
to provide a newFlushStrategy
.NettyConnectionContext.FlushStrategyProvider.computeFlushStrategy(FlushStrategy, boolean)
MAY be invoked multiple times for a single call to this method and is expected to be idempotent.- Returns:
- A
Cancellable
that will cancel this update.
-
-