public interface ManagedStats extends Closeable
Modifier and Type | Field and Description |
---|---|
static String |
STATS_NAME_REGEX
Regex for allowed return values of
getStatsName() . |
Modifier and Type | Method and Description |
---|---|
default void |
addJiraStatsListener(@NotNull JiraStatsListener listener)
Results with registering given listener to the
ManagedStats implementation. |
default void |
close()
Closes the stats: prints the last time and shuts down the executor thread, if present.
|
String |
getStatsName()
Returns the name of the stats.
|
default Optional<Long> |
getTotalMeasuredOperationsForStatsOverheadInMillis()
Returns the sum of the execution time of all the operations measured by these stats.
|
default void |
removeJiraStatsListener(@NotNull JiraStatsListener listener)
Deregisters given listener.
|
static final String STATS_NAME_REGEX
getStatsName()
.String getStatsName()
STATS_NAME_REGEX
.[JIRA-STATS] [<stats name>] snapshot stats
default Optional<Long> getTotalMeasuredOperationsForStatsOverheadInMillis()
Optional.empty()
, then no overhead will be calculated.
default void close() throws IOException
You can override this method if your stats need some extra work on closing. This is usually not needed.
close
in interface AutoCloseable
close
in interface Closeable
IOException
default void addJiraStatsListener(@NotNull @NotNull JiraStatsListener listener)
ManagedStats
implementation.
The listener will be notified whenever stats snapshot is created, and will be given both snapshot and total stats data.
Any implementations overriding default empty implementation method are effectively ignored.
Warning To prevent listeners from impacting the performance of functionality measured by the stats,
it is highly recommended to register listeners only to stats configured to print in other thread than calling thread
(instantiated by JiraStats.create(Class, Supplier, boolean)
with printOnSeparateThread set to true
)
listener
- JiraStatsListener
default void removeJiraStatsListener(@NotNull @NotNull JiraStatsListener listener)
listener
- Copyright © 2002-2022 Atlassian. All Rights Reserved.