Package io.netty.util.concurrent
Class AutoScalingEventExecutorChooserFactory.AutoScalingEventExecutorChooser
- java.lang.Object
-
- io.netty.util.concurrent.AutoScalingEventExecutorChooserFactory.AutoScalingEventExecutorChooser
-
- All Implemented Interfaces:
EventExecutorChooserFactory.EventExecutorChooser,EventExecutorChooserFactory.ObservableEventExecutorChooser
- Enclosing class:
- AutoScalingEventExecutorChooserFactory
private final class AutoScalingEventExecutorChooserFactory.AutoScalingEventExecutorChooser extends java.lang.Object implements EventExecutorChooserFactory.ObservableEventExecutorChooser
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private classAutoScalingEventExecutorChooserFactory.AutoScalingEventExecutorChooser.UtilizationMonitor
-
Field Summary
Fields Modifier and Type Field Description private EventExecutorChooserFactory.EventExecutorChooserallExecutorsChooserprivate EventExecutor[]executorsprivate java.util.concurrent.atomic.AtomicReference<AutoScalingEventExecutorChooserFactory.AutoScalingState>stateprivate java.util.List<AutoScalingEventExecutorChooserFactory.AutoScalingUtilizationMetric>utilizationMetrics
-
Constructor Summary
Constructors Constructor Description AutoScalingEventExecutorChooser(EventExecutor[] executors)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intactiveExecutorCount()Returns the current number of activeEventExecutors.java.util.List<AutoScalingEventExecutorChooserFactory.AutoScalingUtilizationMetric>executorUtilizations()Returns a list containing the last calculated utilization for eachEventExecutorin the group.EventExecutornext()This method is only responsible for picking from the active executors list.private voidtryScaleUpBy(int amount)Tries to increase the active thread count by waking up suspended executors.
-
-
-
Field Detail
-
executors
private final EventExecutor[] executors
-
allExecutorsChooser
private final EventExecutorChooserFactory.EventExecutorChooser allExecutorsChooser
-
state
private final java.util.concurrent.atomic.AtomicReference<AutoScalingEventExecutorChooserFactory.AutoScalingState> state
-
utilizationMetrics
private final java.util.List<AutoScalingEventExecutorChooserFactory.AutoScalingUtilizationMetric> utilizationMetrics
-
-
Constructor Detail
-
AutoScalingEventExecutorChooser
AutoScalingEventExecutorChooser(EventExecutor[] executors)
-
-
Method Detail
-
next
public EventExecutor next()
This method is only responsible for picking from the active executors list. The monitor handles all scaling decisions.- Specified by:
nextin interfaceEventExecutorChooserFactory.EventExecutorChooser
-
tryScaleUpBy
private void tryScaleUpBy(int amount)
Tries to increase the active thread count by waking up suspended executors. This method is thread-safe and updates the state atomically.- Parameters:
amount- The desired number of threads to add to the active count.
-
activeExecutorCount
public int activeExecutorCount()
Description copied from interface:EventExecutorChooserFactory.ObservableEventExecutorChooserReturns the current number of activeEventExecutors.- Specified by:
activeExecutorCountin interfaceEventExecutorChooserFactory.ObservableEventExecutorChooser- Returns:
- the number of active executors.
-
executorUtilizations
public java.util.List<AutoScalingEventExecutorChooserFactory.AutoScalingUtilizationMetric> executorUtilizations()
Description copied from interface:EventExecutorChooserFactory.ObservableEventExecutorChooserReturns a list containing the last calculated utilization for eachEventExecutorin the group.- Specified by:
executorUtilizationsin interfaceEventExecutorChooserFactory.ObservableEventExecutorChooser- Returns:
- an umodifiable view of the executor utilizations.
-
-