Package com.atlassian.confluence.event
Class TimingEventPublisher
- java.lang.Object
-
- com.atlassian.confluence.event.TimingEventPublisher
-
- All Implemented Interfaces:
com.atlassian.event.api.EventListenerRegistrar
,com.atlassian.event.api.EventPublisher
@ThreadSafe @Internal public class TimingEventPublisher extends Object implements com.atlassian.event.api.EventPublisher
AnEventPublisher
implementation that times how long it takes to publish an event, and logs a warning if the time is above a threshold. Warnings are not started until the object receives anApplicationStartedEvent
, to avoid warnings during the startup process which are known to produce slow events.- Since:
- 5.5.5
-
-
Field Summary
Fields Modifier and Type Field Description static org.joda.time.Duration
EVENT_PUBLISH_WARN_THRESHOLD_DEFAULT
Default for the maximum time for a publish attempt to complete before logging warnings.static String
EVENT_PUBLISH_WARN_THRESHOLD_SYSTEM_PROPERTY
System property to configure the maximum time for a publish attempt to complete before logging warnings.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TimingEventPublisher
create(com.atlassian.event.api.EventPublisher delegate)
void
publish(Object event)
void
register(Object listener)
void
unregister(Object listener)
void
unregisterAll()
-
-
-
Field Detail
-
EVENT_PUBLISH_WARN_THRESHOLD_SYSTEM_PROPERTY
public static final String EVENT_PUBLISH_WARN_THRESHOLD_SYSTEM_PROPERTY
System property to configure the maximum time for a publish attempt to complete before logging warnings.
-
EVENT_PUBLISH_WARN_THRESHOLD_DEFAULT
public static final org.joda.time.Duration EVENT_PUBLISH_WARN_THRESHOLD_DEFAULT
Default for the maximum time for a publish attempt to complete before logging warnings. 5 seconds.
-
-
Method Detail
-
create
public static TimingEventPublisher create(com.atlassian.event.api.EventPublisher delegate)
-
register
public void register(Object listener)
- Specified by:
register
in interfacecom.atlassian.event.api.EventListenerRegistrar
-
unregister
public void unregister(Object listener)
- Specified by:
unregister
in interfacecom.atlassian.event.api.EventListenerRegistrar
-
unregisterAll
public void unregisterAll()
- Specified by:
unregisterAll
in interfacecom.atlassian.event.api.EventListenerRegistrar
-
publish
public void publish(Object event)
- Specified by:
publish
in interfacecom.atlassian.event.api.EventPublisher
-
-