fr.dyade.aaa.jndi2.distributed
Class ReplicationManager

java.lang.Object
  extended by fr.dyade.aaa.jndi2.server.RequestManager
      extended by fr.dyade.aaa.jndi2.distributed.ReplicationManager
All Implemented Interfaces:
UpdateListener, LifeCycleListener, java.io.Serializable

public class ReplicationManager
extends RequestManager
implements UpdateListener

See Also:
Serialized Form

Nested Class Summary
(package private) static class ReplicationManager.RequestContextList
           
 
Field Summary
static java.lang.String INIT_REQUEST_TABLE
           
private  java.util.Hashtable initRequestContextLists
          Table that contains the requests (read or write) waiting for the initialization of the context.
private  boolean looseCoupling
           
private  AgentId rootOwnerId
          Identifier of the server that owns the root naming context.
private static long serialVersionUID
          define serialVersionUID for interoperability
static java.lang.String SERVER_LIST
           
private  short[] serverIds
          List of the initially known servers.
private  java.util.Vector servers
          List of the JNDI servers discovered by this server.
static java.lang.String SYNC_REQUEST_TABLE
           
private  java.util.Hashtable syncRequestContextLists
          Table that contains the requests (read or write) waiting for the synchronization of the context.
static java.lang.String WRITE_REQUEST_TABLE
           
private  java.util.Hashtable writeRequestContextLists
          Table that contains the write requests forwarded to the owner.
 
Constructor Summary
ReplicationManager(short[] serverIds)
           
 
Method Summary
 void agentInitialize(boolean firstTime)
           
protected  void changeOwner(ChangeOwnerRequest request)
           
private  void createRemoteSubcontext(CreateRemoteSubcontextRequest request)
           
protected  void createSubcontext(CreateSubcontextRequest request)
           
(package private)  void doReact(AgentId from, InitJndiServerNot not)
           
(package private)  void doReact(AgentId from, JndiReplyNot not)
           
(package private)  void doReact(AgentId from, JndiScriptReplyNot not)
           
(package private)  void doReact(AgentId from, JndiUpdateNot not)
          Reacts to an update notification from an other JNDI server.
(package private)  void doReact(AgentId from, SyncReplyNot not)
           
(package private)  void doReact(AgentId from, SyncRequestNot not)
           
protected  AgentId getRootOwnerId()
          Overrides the JndiServer behavior.
protected  JndiReply invokeOwner(AgentId owner, RequestContext reqCtx)
          Overrides the JndiServer behavior.
protected  JndiReply onMissingContext(MissingContextException mce, RequestContext reqCtx)
          In a centralized JNDI server a missing context shows that the naming data are unconsistent.
protected  JndiReply onMissingRecord(MissingRecordException mre, RequestContext reqCtx)
          In a centralized JNDI server a missing record shows that the name asked by the JNDI request doesn't exist.
private  void onReply(AgentId from, JndiReply reply)
          Reacts to the reply of a JNDI server that has been called as it is the owner of a naming context.
 void onUpdate(UpdateEvent event)
           
private  void onUpdateEvent(AgentId from, BindEvent evt)
           
private  void onUpdateEvent(AgentId from, ChangeOwnerEvent evt)
           
private  void onUpdateEvent(AgentId from, CreateSubcontextEvent evt)
           
private  void onUpdateEvent(AgentId from, DestroySubcontextEvent evt)
           
private  void onUpdateEvent(AgentId from, RebindEvent evt)
           
private  void onUpdateEvent(AgentId from, UnbindEvent evt)
           
private  void saveInitRequestTable()
           
private  void saveServers()
           
private  void saveSyncRequestTable()
           
private  void saveWriteRequestTable()
           
private  void synchronizeRequest(AgentId owner, RequestContext reqCtx)
           
 
Methods inherited from class fr.dyade.aaa.jndi2.server.RequestManager
agentFinalize, getId, getServerImpl, invoke, invokeAdminRequest, invokeReadRequest, invokeWriteRequest, readBag, sendTo, setContainer, writeBag
 
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

INIT_REQUEST_TABLE

public static final java.lang.String INIT_REQUEST_TABLE
See Also:
Constant Field Values

SYNC_REQUEST_TABLE

public static final java.lang.String SYNC_REQUEST_TABLE
See Also:
Constant Field Values

WRITE_REQUEST_TABLE

public static final java.lang.String WRITE_REQUEST_TABLE
See Also:
Constant Field Values

SERVER_LIST

public static final java.lang.String SERVER_LIST
See Also:
Constant Field Values

rootOwnerId

private AgentId rootOwnerId
Identifier of the server that owns the root naming context.


serverIds

private short[] serverIds
List of the initially known servers.


servers

private transient java.util.Vector servers
List of the JNDI servers discovered by this server. These servers first receive an initialization notification that contain the naming data owned by this server. Then they receive the update notifications about the contexts owned by this server.


writeRequestContextLists

private transient java.util.Hashtable writeRequestContextLists
Table that contains the write requests forwarded to the owner. key = owner identifier (AgentId) value = requests list (RequestContextList)


initRequestContextLists

private transient java.util.Hashtable initRequestContextLists
Table that contains the requests (read or write) waiting for the initialization of the context. key = id of the missing context value = requests list (RequestContextList)


syncRequestContextLists

private transient java.util.Hashtable syncRequestContextLists
Table that contains the requests (read or write) waiting for the synchronization of the context. key = owner identifier (AgentId) value = requests list (RequestContextList)


looseCoupling

private boolean looseCoupling
Constructor Detail

ReplicationManager

public ReplicationManager(short[] serverIds)
Method Detail

getRootOwnerId

protected AgentId getRootOwnerId()
Overrides the JndiServer behavior.

Overrides:
getRootOwnerId in class RequestManager

agentInitialize

public void agentInitialize(boolean firstTime)
                     throws java.lang.Exception
Specified by:
agentInitialize in interface LifeCycleListener
Overrides:
agentInitialize in class RequestManager
Throws:
java.lang.Exception

doReact

void doReact(AgentId from,
             JndiUpdateNot not)
       throws java.lang.Exception
Reacts to an update notification from an other JNDI server.

Throws:
java.lang.Exception

onUpdateEvent

private void onUpdateEvent(AgentId from,
                           BindEvent evt)
                    throws javax.naming.NamingException
Throws:
javax.naming.NamingException

onUpdateEvent

private void onUpdateEvent(AgentId from,
                           RebindEvent evt)
                    throws javax.naming.NamingException
Throws:
javax.naming.NamingException

onUpdateEvent

private void onUpdateEvent(AgentId from,
                           UnbindEvent evt)
                    throws javax.naming.NamingException
Throws:
javax.naming.NamingException

onUpdateEvent

private void onUpdateEvent(AgentId from,
                           CreateSubcontextEvent evt)
                    throws javax.naming.NamingException
Throws:
javax.naming.NamingException

onUpdateEvent

private void onUpdateEvent(AgentId from,
                           DestroySubcontextEvent evt)
                    throws javax.naming.NamingException
Throws:
javax.naming.NamingException

onUpdateEvent

private void onUpdateEvent(AgentId from,
                           ChangeOwnerEvent evt)
                    throws javax.naming.NamingException
Throws:
javax.naming.NamingException

invokeOwner

protected JndiReply invokeOwner(AgentId owner,
                                RequestContext reqCtx)
Overrides the JndiServer behavior. Send a JNDI request to the owner (JNDI server). Waits for the asynchronous reply.

Overrides:
invokeOwner in class RequestManager
Parameters:
owner - the identifier of the naming server that owns the naming context on which the JNDI operation is called.
reqCtx - the JNDI request context that raised the exception.
Returns:
the JNDI reply. May be null if the owner invocation is asynchronous.

doReact

void doReact(AgentId from,
             JndiScriptReplyNot not)
       throws java.lang.Exception
Throws:
java.lang.Exception

doReact

void doReact(AgentId from,
             JndiReplyNot not)
       throws java.lang.Exception
Throws:
java.lang.Exception

onReply

private void onReply(AgentId from,
                     JndiReply reply)
              throws java.lang.Exception
Reacts to the reply of a JNDI server that has been called as it is the owner of a naming context.

Throws:
java.lang.Exception

doReact

void doReact(AgentId from,
             InitJndiServerNot not)
       throws java.lang.Exception
Throws:
java.lang.Exception

onMissingContext

protected JndiReply onMissingContext(MissingContextException mce,
                                     RequestContext reqCtx)
Description copied from class: RequestManager
In a centralized JNDI server a missing context shows that the naming data are unconsistent. So it throws an error. A subclass may override this behavior in order to try to resolve the missing context.

Overrides:
onMissingContext in class RequestManager
Parameters:
mce - the missing context exception
reqCtx - the JNDI request context that raised the exception.
Returns:
the JNDI reply. May be null if the resolution is asynchronous.

onMissingRecord

protected JndiReply onMissingRecord(MissingRecordException mre,
                                    RequestContext reqCtx)
Description copied from class: RequestManager
In a centralized JNDI server a missing record shows that the name asked by the JNDI request doesn't exist. So the NameNotFoundException is directly forwarded to the client. A subclass may override this behavior in order to try to resolve the missing record.

Overrides:
onMissingRecord in class RequestManager
Parameters:
mre - the missing context exception
reqCtx - the JNDI request context that raised the exception.
Returns:
the JNDI reply. May be null if the resolution is asynchronous.

synchronizeRequest

private void synchronizeRequest(AgentId owner,
                                RequestContext reqCtx)

doReact

void doReact(AgentId from,
             SyncRequestNot not)

doReact

void doReact(AgentId from,
             SyncReplyNot not)

onUpdate

public void onUpdate(UpdateEvent event)
Specified by:
onUpdate in interface UpdateListener

createSubcontext

protected void createSubcontext(CreateSubcontextRequest request)
                         throws javax.naming.NamingException
Overrides:
createSubcontext in class RequestManager
Throws:
javax.naming.NamingException

createRemoteSubcontext

private void createRemoteSubcontext(CreateRemoteSubcontextRequest request)
                             throws javax.naming.NamingException
Throws:
javax.naming.NamingException

changeOwner

protected void changeOwner(ChangeOwnerRequest request)
                    throws javax.naming.NamingException
Overrides:
changeOwner in class RequestManager
Throws:
javax.naming.NamingException

saveInitRequestTable

private void saveInitRequestTable()

saveWriteRequestTable

private void saveWriteRequestTable()

saveSyncRequestTable

private void saveSyncRequestTable()

saveServers

private void saveServers()


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