Class SoftRecyclerWindow
SoftRecycler end, from the update cycles reported to it, so that
no recycler reads a clock.
An update graph may report the start of each cycle through reportCycleStart(String, long); a graph that does
not report has no say in the window. A window is long enough to span a whole cycle of each reporting graph: the
largest of the graphs' latest intervals between cycle starts, times "SoftRecycler.windowMargin" (1.5 by default)
for jitter, but no shorter than "SoftRecycler.windowMillis"<T> milliseconds (1000 by default) and no
longer than "SoftRecycler.maximumWindowMillis" milliseconds (60000 by default). Each graph contributes only its
latest interval, so a graph that slowed for a cycle stops lengthening the window at its next cycle, and a graph that
has not started a cycle within the longest window, because it is idle or gone, is ignored. An interval longer than
the longest window, as an event-driven graph's idle time might be, counts as the longest window.
Each report also ends the current window if it has lasted long enough, so a window ends at the first cycle start, of any reporting graph, after it has elapsed. A process in which no graph reports never ends a window, so its recyclers never shrink, and the garbage collector reclaims their items under memory pressure as it always may.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidforgetGraph(@NotNull String graphName) Stop counting a graph's cycles toward the window, as when the graph is removed.static <T> SoftRecycler<T> register(@NotNull SoftRecycler<T> recycler) Registerrecycler, so that its window ends with every other registered recycler's, from the update graphs' cycles.static voidreportCycleStart(@NotNull String graphName, long startNanos) Report that an update graph started a cycle, and end every recycler's window if it has lasted long enough.
-
Field Details
-
MAXIMUM_WINDOW_MILLIS_PROPERTY
The property for the longest window, in milliseconds, between possibly shrinking the recyclers. Even if one of the reporting graphs has a longer interval between cycles, the next reporting graph to start a cycle ends the window, possibly shrinking the recyclers, once the window exceeds this value.- See Also:
-
WINDOW_MARGIN_PROPERTY
The property for the multiple of the longest interval between cycle starts that a window lasts.- See Also:
-
-
Method Details
-
register
Registerrecycler, so that its window ends with every other registered recycler's, from the update graphs' cycles. Registered recyclers are held strongly and never unregistered, so register only a recycler that lives for the life of the process, as the column sources' static ones do. A recycler that is not registered never shrinks.- Parameters:
recycler- The recycler to register- Returns:
recycler, for the convenience of the caller
-
reportCycleStart
Report that an update graph started a cycle, and end every recycler's window if it has lasted long enough. Called by the graph's update thread, with a time the graph has already read.- Parameters:
graphName- the name of the graphstartNanos- when the cycle started, fromSystem.nanoTime()
-
forgetGraph
Stop counting a graph's cycles toward the window, as when the graph is removed.- Parameters:
graphName- the name of the graph
-