Class ResourceEvent<T>
- java.lang.Object
-
- org.osgi.service.resourcemonitoring.ResourceEvent<T>
-
- Type Parameters:
T- The type for the Resource.
public class ResourceEvent<T> extends java.lang.ObjectAn event is sent to a
ResourceListenerwhen resource usage violates one of their thresholds.ResourceEventobjects are delivered synchronously to all matchingResourceListenerservices. A typed code is used to identify the event.- Version:
- 1.0
- Author:
- $Id: 2c1fe38b57105cc9d5c5f90eb7a7947736a97539 $
- See Also:
ResourceListener
-
-
Field Summary
Fields Modifier and Type Field Description static intERRORType of ResourceEvent indicating a threshold goes to the ERROR state.static intNORMALType of ResourceEvent indicating a threshold goes to the NORMAL state.static intWARNINGType of ResourceEvent indicating a threshold goes to the WARNING state.
-
Constructor Summary
Constructors Constructor Description ResourceEvent(int pType, ResourceContext pContext, boolean pIsUpperThreshold, java.lang.Comparable<T> pValue)Creates a new ResourceEvent.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object var0)ResourceContextgetContext()Returns the resource context that caused the event.intgetType()Returns the event type.java.lang.Comparable<T>getValue()Returns the resource consumption value.inthashCode()booleanisUpperThreshold()Returns true if the threshold triggering this event is an upper threshold.java.lang.StringtoString()
-
-
-
Field Detail
-
NORMAL
public static final int NORMAL
Type of ResourceEvent indicating a threshold goes to the NORMAL state.- See Also:
- Constant Field Values
-
WARNING
public static final int WARNING
Type of ResourceEvent indicating a threshold goes to the WARNING state.- See Also:
- Constant Field Values
-
ERROR
public static final int ERROR
Type of ResourceEvent indicating a threshold goes to the ERROR state.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ResourceEvent
public ResourceEvent(int pType, ResourceContext pContext, boolean pIsUpperThreshold, java.lang.Comparable<T> pValue)Creates a new ResourceEvent.- Parameters:
pType- the event typepContext- the resource contextpIsUpperThreshold- whether it is an upper thresholdpValue- the value
-
-
Method Detail
-
getType
public int getType()
- Returns:
- The event type
-
getValue
public java.lang.Comparable<T> getValue()
- Returns:
- the resource consumption value, or null if a resource monitor is not relevant.
-
getContext
public ResourceContext getContext()
Returns the resource context that caused the event.- Returns:
- The resource context that caused the event.
-
isUpperThreshold
public boolean isUpperThreshold()
Returns true if the threshold triggering this event is an upper threshold. This method is only used whengetType()returnsNORMAL,WARNINGorERROR.- Returns:
- true if it is an upper threshold.
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object var0)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-