public class MonitorableRegistry extends Object
Monitorable
is associated with a particular
MonitorableRegistry, and informs the registry of its own details via a
callback to register(Monitorable)
when the Monitorable is created.
the MonitorableRegistryListener interface can be used for clients interested in state changes
to be made aware of when new Monitorables are added, such as objects that wish
to serialize state to external stores. (ie... A PCPmmvWriter.. say..)Modifier and Type | Field and Description |
---|---|
static MonitorableRegistry |
DEFAULT_REGISTRY
A single central registry which can be used by non-Registry-aware
Monitorables.
|
Constructor and Description |
---|
MonitorableRegistry() |
Modifier and Type | Method and Description |
---|---|
void |
addRegistryListener(MonitorableRegistryListener monitorableRegistryListener) |
static void |
clearDefaultRegistry() |
Collection<Monitorable<?>> |
getMonitorables() |
static MonitorableRegistry |
getNamedInstance(String name)
Retrieves or creates a centrally-accessible named instance, identified
uniquely by the provided String.
|
<T> void |
register(Monitorable<T> monitorable)
Informs this MonitorableRegistry of a new
Monitorable ; that
Monitorable will be added to the registry, assuming no Monitorable with
the same name has previously been registered. |
<T> T |
registerOrReuse(Monitorable<T> monitorable)
Registers the monitorable if it does not already exist, but otherwise returns an already registered
Monitorable with the same name, Semantics and UNnit definition.
|
void |
removeRegistryListener(MonitorableRegistryListener listener) |
public static MonitorableRegistry DEFAULT_REGISTRY
MonitorableRegistry
should be used instead.public <T> void register(Monitorable<T> monitorable)
Monitorable
; that
Monitorable will be added to the registry, assuming no Monitorable with
the same name has previously been registered.UnsupportedOperationException
- if the name of the provided monitorable has already been
registeredpublic <T> T registerOrReuse(Monitorable<T> monitorable)
public Collection<Monitorable<?>> getMonitorables()
public static void clearDefaultRegistry()
public static MonitorableRegistry getNamedInstance(String name)
DEFAULT_REGISTRY
) and having to pass a MonitorableRegistry down
to the very depths of your class hierarchy. This is especially useful
when instrumenting third-party code which cannot easily get access to a
given MonitorableRegistry from a non-static context.name
- public void addRegistryListener(MonitorableRegistryListener monitorableRegistryListener)
public void removeRegistryListener(MonitorableRegistryListener listener)
Copyright © 2009-2021 Performance Co-Pilot. All Rights Reserved.