final class AgentIdStamp extends Object implements Serializable
AgentIdStamp
class defines static members, variable and
functions, to manage the allocation of new identifiers. It locally
maintains a pair of counters, one for local agent server, one for remote
agent server, keeping track of the last allocated stamp for the given
target domain. Stamps are allocated in growing order and are never reused
once allocated, even after agents are deleted.AgentId
class.Modifier and Type | Field and Description |
---|---|
private int |
local
Stamp counter for local agent server.
|
private int |
remote
Stamp counter for remote agent server.
|
private static long |
serialVersionUID
Define serialVersionUID for interoperability.
|
(package private) static AgentIdStamp |
stamp
Static reference to local
AgentIdStamp object. |
Constructor and Description |
---|
AgentIdStamp() |
Modifier and Type | Method and Description |
---|---|
(package private) static void |
init()
Initializes
AgentIdStamp class. |
(package private) static AgentIdStamp |
load()
Restores the object state from the persistent storage.
|
(package private) int |
newStamp(short to)
Allocates a new stamp for the target agent server.
|
private void |
readObject(ObjectInputStream in)
The
readObject is responsible for reading from the stream
and restoring the classes fields. |
(package private) void |
save()
Saves the object state on persistent storage.
|
private void |
writeObject(ObjectOutputStream out)
The
writeObject method is responsible for writing the
state of the object for its particular class so that the corresponding
readObject method can restore it. |
private static final long serialVersionUID
static AgentIdStamp stamp
AgentIdStamp
object.private int local
private int remote
static void init() throws IOException, ClassNotFoundException
AgentIdStamp
class.IOException
- IO problem during loading.ClassNotFoundException
- should never happenedvoid save() throws IOException
IOException
- an error occurs.static AgentIdStamp load() throws IOException, ClassNotFoundException
IOException
- an error occurs.ClassNotFoundException
- an error occurs.private void writeObject(ObjectOutputStream out) throws IOException
writeObject
method is responsible for writing the
state of the object for its particular class so that the corresponding
readObject
method can restore it.out
- the underlying output stream.IOException
- an error occurs.private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException
readObject
is responsible for reading from the stream
and restoring the classes fields.in
- the underlying input stream.IOException
- an error occurs.ClassNotFoundException
- an error occurs.int newStamp(short to) throws IOException
to
- The target agent serverIOException
- an error occurs.Copyright © 2023 ScalAgent D.T.. All rights reserved.