fr.dyade.aaa.agent
Class AgentIdStamp

java.lang.Object
  extended by fr.dyade.aaa.agent.AgentIdStamp
All Implemented Interfaces:
java.io.Serializable

final class AgentIdStamp
extends java.lang.Object
implements java.io.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.


Some initial stamps are reserved for statically identifying system and well known services as factory. They are defined in AgentId class.


Field Summary
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 Summary
AgentIdStamp()
           
 
Method Summary
(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(java.io.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(java.io.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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Define serialVersionUID for interoperability.

See Also:
Constant Field Values

stamp

static AgentIdStamp stamp
Static reference to local AgentIdStamp object.


local

private int local
Stamp counter for local agent server.


remote

private int remote
Stamp counter for remote agent server.

Constructor Detail

AgentIdStamp

AgentIdStamp()
Method Detail

init

static void init()
          throws java.io.IOException,
                 java.lang.ClassNotFoundException
Initializes AgentIdStamp class.

Throws:
java.io.IOException - IO problem during loading.
java.lang.ClassNotFoundException - should never happened

save

void save()
    throws java.io.IOException
Saves the object state on persistent storage.

Throws:
java.io.IOException

load

static AgentIdStamp load()
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Restores the object state from the persistent storage.

Throws:
java.io.IOException
java.lang.ClassNotFoundException

writeObject

private void writeObject(java.io.ObjectOutputStream out)
                  throws java.io.IOException
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.

Parameters:
out - the underlying output stream.
Throws:
java.io.IOException

readObject

private void readObject(java.io.ObjectInputStream in)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
The readObject is responsible for reading from the stream and restoring the classes fields.

Parameters:
in - the underlying input stream.
Throws:
java.lang.ClassNotFoundException
java.io.IOException

newStamp

int newStamp(short to)
       throws java.io.IOException
Allocates a new stamp for the target agent server.

Parameters:
to - The target agent server
Throws:
java.io.IOException


Copyright © 2010 ScalAgent D.T.. All Rights Reserved.