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 Object

An event is sent to a ResourceListener when resource usage violates one of their thresholds.

ResourceEvent objects are delivered synchronously to all matching ResourceListener services. A typed code is used to identify the event.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Type of ResourceEvent indicating a threshold goes to the ERROR state.
    static final int
    Type of ResourceEvent indicating a threshold goes to the NORMAL state.
    static final int
    Type of ResourceEvent indicating a threshold goes to the WARNING state.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ResourceEvent(int pType, ResourceContext pContext, boolean pIsUpperThreshold, Comparable<T> pValue)
    Creates a new ResourceEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    equals(Object var0)
     
    Returns the resource context that caused the event.
    int
    Returns the event type.
    Returns the resource consumption value.
    int
     
    boolean
    Returns true if the threshold triggering this event is an upper threshold.
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • NORMAL

      public static final int NORMAL
      Type of ResourceEvent indicating a threshold goes to the NORMAL state.
      See Also:
    • WARNING

      public static final int WARNING
      Type of ResourceEvent indicating a threshold goes to the WARNING state.
      See Also:
    • ERROR

      public static final int ERROR
      Type of ResourceEvent indicating a threshold goes to the ERROR state.
      See Also:
  • Constructor Details

    • ResourceEvent

      public ResourceEvent(int pType, ResourceContext pContext, boolean pIsUpperThreshold, Comparable<T> pValue)
      Creates a new ResourceEvent.
      Parameters:
      pType - the event type
      pContext - the resource context
      pIsUpperThreshold - whether it is an upper threshold
      pValue - the value
  • Method Details

    • getType

      public int getType()
      Returns the event type. The type values are:
      Returns:
      The event type
    • getValue

      public Comparable<T> getValue()
      Returns the resource consumption value. Relevant only for event types NORMAL, WARNING and ERROR.
      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 when getType() returns NORMAL, WARNING or ERROR.
      Returns:
      true if it is an upper threshold.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object var0)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object