Whether the state already exists
Get the state if it exists, otherwise it will throw java.util.NoSuchElementException
.
Get the state if it exists, otherwise it will throw java.util.NoSuchElementException
.
Check with exists()
whether the state exists or not before calling get()
.
If the state does not exist.
Whether the state is timing out and going to be removed by the system after the current batch.
Whether the state is timing out and going to be removed by the system after the current batch. This timeout can occur if timeout duration has been specified in the StatSpec and the key has not received any new data for that timeout duration.
Remove the state if it exists.
Remove the state if it exists.
State cannot be updated if it has been already removed (that is, remove()
has already been
called) or it is going to be removed due to timeout (that is, isTimingOut()
is true
).
Update the state with a new value.
Update the state with a new value.
State cannot be updated if it has been already removed (that is, remove()
has already been
called) or it is going to be removed due to timeout (that is, isTimingOut()
is true
).
If the state has already been removed, or is going to be removed
Get the state as an scala.Option.
Get the state as an scala.Option. It will be Some(state)
if it exists, otherwise None
.
:: Experimental :: Abstract class for getting and updating the state in mapping function used in the
mapWithState
operation of a pair DStream (Scala) or a JavaPairDStream (Java).Scala example of using
State
:Java example of using
State
:Class of the state