T
- The type of state represented by this state handle.public class SerializedStateHandle<T extends Serializable> extends AbstractCloseableHandle implements StateHandle<T>
Constructor and Description |
---|
SerializedStateHandle(byte[] serializedData)
Creates a new serialized state handle, based in the given already serialized data.
|
SerializedStateHandle(T value)
Creates a new serialized state handle, eagerly serializing the given state object.
|
Modifier and Type | Method and Description |
---|---|
void |
discardState()
Discarding heap-memory backed state is a no-op, so this method does nothing.
|
byte[] |
getSerializedData() |
int |
getSizeOfSerializedState()
Gets the size of the serialized state.
|
T |
getState(ClassLoader classLoader)
This retrieves and return the state represented by the handle.
|
long |
getStateSize()
Returns the size of the state in bytes.
|
close, ensureNotClosed, isClosed, registerCloseable
public SerializedStateHandle(T value) throws IOException
value
- The state object.IOException
- Thrown, if the serialization fails.public SerializedStateHandle(byte[] serializedData)
serializedData
- The serialized data.public T getState(ClassLoader classLoader) throws Exception
StateHandle
getState
in interface StateHandle<T extends Serializable>
classLoader
- Class loader for deserializing user code specific classesException
- Thrown, if the state cannot be fetched.public int getSizeOfSerializedState()
public void discardState()
discardState
in interface StateObject
public long getStateSize()
StateObject
If the the size is not known, return 0
.
getStateSize
in interface StateObject
public byte[] getSerializedData()
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.