| | |
| | | * The following map contains one balanced tree for each replica ID to which |
| | | * we are currently publishing the first update in the balanced tree is the |
| | | * next change that we must push to this particular server. |
| | | * <p> |
| | | * We add new TreeSet in the HashMap when a new server register to this |
| | | * replication server. |
| | | */ |
| | | private final Map<Integer, DataServerHandler> directoryServers = |
| | | new ConcurrentHashMap<Integer, DataServerHandler>(); |
| | |
| | | * we are connected (so normally all the replication servers) the first update |
| | | * in the balanced tree is the next change that we must push to this |
| | | * particular server. |
| | | * <p> |
| | | * We add new TreeSet in the HashMap when a new replication server register to |
| | | * this replication server. |
| | | */ |
| | | private final Map<Integer, ReplicationServerHandler> replicationServers = |
| | | new ConcurrentHashMap<Integer, ReplicationServerHandler>(); |
| | |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo( |
| | | "In RS " + getReplicationServer().getServerId() + |
| | | "In RS " + getLocalRSServerId() + |
| | | " Receiving ChangeStatusMsg from " + senderHandler.getServerId() + |
| | | " for baseDn " + baseDn + ":\n" + csMsg); |
| | | } |
| | |
| | | { |
| | | try |
| | | { |
| | | // Acquire lock on domain (see more details in comment of start() method |
| | | // of ServerHandler) |
| | | // Acquire lock on domain (see ServerHandler#start() for more details) |
| | | lock(); |
| | | } |
| | | catch (InterruptedException ex) |
| | |
| | | ServerStatus oldStatus = serverHandler.getStatus(); |
| | | try |
| | | { |
| | | newStatus = serverHandler |
| | | .changeStatusFromStatusAnalyzer(event); |
| | | newStatus = serverHandler.changeStatusFromStatusAnalyzer(event); |
| | | } |
| | | catch (IOException e) |
| | | { |
| | |
| | | } |
| | | |
| | | /** |
| | | * Return the associated replication server. |
| | | * @return The replication server. |
| | | */ |
| | | public ReplicationServer getReplicationServer() |
| | | { |
| | | return localReplicationServer; |
| | | } |
| | | |
| | | /** |
| | | * Process topology information received from a peer RS. |
| | | * @param topoMsg The just received topo message from remote RS |
| | | * @param handler The handler that received the message. |
| | |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo( |
| | | "In RS " + getReplicationServer().getServerId() + |
| | | " Receiving TopologyMsg from " + handler.getServerId() + |
| | | " for baseDn " + baseDn + ":\n" + topoMsg); |
| | | TRACER.debugInfo("In RS " + getLocalRSServerId() |
| | | + " Receiving TopologyMsg from " + handler.getServerId() |
| | | + " for baseDn " + baseDn + ":\n" + topoMsg); |
| | | } |
| | | |
| | | try |
| | |
| | | |
| | | try |
| | | { |
| | | /* |
| | | * Store DS connected to remote RS & update information about the peer RS |
| | | */ |
| | | // Store DS connected to remote RS & update information about the peer RS |
| | | handler.processTopoInfoFromRS(topoMsg); |
| | | |
| | | /* |
| | | * Handle generation id |
| | | */ |
| | | // Handle generation id |
| | | if (allowResetGenId) |
| | | { |
| | | // Check if generation id has to be reseted |
| | |
| | | |
| | | if (isDifferentGenerationId(handler.getGenerationId())) |
| | | { |
| | | Message message = WARN_BAD_GENERATION_ID_FROM_RS.get(handler |
| | | .getServerId(), handler.session |
| | | .getReadableRemoteAddress(), handler.getGenerationId(), |
| | | baseDn, getReplicationServer().getServerId(), |
| | | generationId); |
| | | Message message = WARN_BAD_GENERATION_ID_FROM_RS.get( |
| | | handler.getServerId(), handler.session.getReadableRemoteAddress(), |
| | | handler.getGenerationId(), |
| | | baseDn, getLocalRSServerId(), generationId); |
| | | logError(message); |
| | | |
| | | ErrorMsg errorMsg = new ErrorMsg( |
| | | getReplicationServer().getServerId(), |
| | | handler.getServerId(), |
| | | message); |
| | | ErrorMsg errorMsg = |
| | | new ErrorMsg(getLocalRSServerId(), handler.getServerId(), message); |
| | | handler.send(errorMsg); |
| | | } |
| | | |
| | |
| | | } |
| | | return latest; |
| | | } |
| | | |
| | | /** |
| | | * Return the monitor instance name of the ReplicationServer that created the |
| | | * current instance. |
| | | * |
| | | * @return the monitor instance name of the ReplicationServer that created the |
| | | * current instance. |
| | | */ |
| | | String getLocalRSMonitorInstanceName() |
| | | { |
| | | return this.localReplicationServer.getMonitorInstanceName(); |
| | | } |
| | | |
| | | /** |
| | | * Return the serverId of the ReplicationServer that created the current |
| | | * instance. |
| | | * |
| | | * @return the serverId of the ReplicationServer that created the current |
| | | * instance. |
| | | */ |
| | | int getLocalRSServerId() |
| | | { |
| | | return this.localReplicationServer.getServerId(); |
| | | } |
| | | } |