Class ObserveNotificationOrderer
java.lang.Object
org.eclipse.californium.core.observe.ObserveNotificationOrderer
The ObservingNotificationOrderer holds the state of an observe relation such
as the timeout of the last notification and the current number.
-
Constructor Summary
ConstructorDescriptionCreates a new notification orderer.ObserveNotificationOrderer
(Integer observe) Creates a new notification orderer for a given notification. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the current notification number.int
Return a new observe option number.boolean
Check, if the provided notification is newer than the current one.void
reset()
Reset state.
-
Constructor Details
-
ObserveNotificationOrderer
public ObserveNotificationOrderer()Creates a new notification orderer. -
ObserveNotificationOrderer
Creates a new notification orderer for a given notification.- Parameters:
observe
- value of observe option- Throws:
NullPointerException
- if observe isnull
-
-
Method Details
-
getNextObserveNumber
public int getNextObserveNumber()Return a new observe option number. This method is thread-safe as it increases the option number atomically.- Returns:
- a new observe option number
-
getCurrent
public int getCurrent()Returns the current notification number.- Returns:
- the current notification number
-
isNew
Check, if the provided notification is newer than the current one.- Parameters:
response
- the notification- Returns:
true
, if the notification is new, or the response is no notify
-
reset
public void reset()Reset state.- Since:
- 3.8
-