| | |
| | | import org.opends.server.replication.common.ChangeNumber; |
| | | import org.opends.server.replication.common.RSInfo; |
| | | import org.opends.server.replication.common.ServerStatus; |
| | | import org.opends.server.replication.protocol.ReplicationMsg; |
| | | import org.opends.server.replication.protocol.AckMsg; |
| | | import org.opends.server.replication.protocol.ChangeTimeHeartbeatMsg; |
| | | import org.opends.server.replication.protocol.ErrorMsg; |
| | | import org.opends.server.replication.protocol.HeartbeatThread; |
| | | import org.opends.server.replication.protocol.MonitorMsg; |
| | | import org.opends.server.replication.protocol.ProtocolSession; |
| | | import org.opends.server.replication.protocol.ProtocolVersion; |
| | | import org.opends.server.replication.protocol.ReplicationMsg; |
| | | import org.opends.server.replication.protocol.ResetGenerationIdMsg; |
| | | import org.opends.server.replication.protocol.RoutableMsg; |
| | | import org.opends.server.replication.protocol.StartECLSessionMsg; |
| | | import org.opends.server.replication.protocol.StartMsg; |
| | |
| | | // replication server domain |
| | | if (oldGenerationId != -100) |
| | | { |
| | | replicationServerDomain.changeGenerationId(oldGenerationId, false); |
| | | if (replicationServerDomain!=null) |
| | | replicationServerDomain.changeGenerationId(oldGenerationId, false); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | writer = new ServerWriter(session, serverId, |
| | | this, replicationServerDomain); |
| | | reader = new ServerReader(session, serverId, |
| | | this, replicationServerDomain); |
| | | reader = new ServerReader(session, serverId, this); |
| | | |
| | | reader.start(); |
| | | writer.start(); |
| | |
| | | } |
| | | |
| | | /** |
| | | * Processes a change time heartbeat msg. |
| | | * |
| | | * @param msg The message to be processed. |
| | | */ |
| | | public void process(ChangeTimeHeartbeatMsg msg) |
| | | { |
| | | if (debugEnabled()) |
| | | TRACER.debugInfo("In " + replicationServerDomain.getReplicationServer(). |
| | | getMonitorInstanceName() + this + |
| | | " processes received msg:\n" + msg); |
| | | replicationServerDomain.processChangeTimeHeartbeatMsg(this, msg); |
| | | } |
| | | |
| | | /** |
| | | * Process the reception of a WindowProbeMsg message. |
| | | * |
| | | * @param windowProbeMsg The message to process. |
| | |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo("In " + |
| | | replicationServerDomain.getReplicationServer(). |
| | | getMonitorInstanceName() + ", " + |
| | | this.replicationServer.getMonitorInstanceName() + ", " + |
| | | this.getClass().getSimpleName() + " " + this + ":" + |
| | | "\nSH START HANDSHAKE RECEIVED:\n" + inStartMsg.toString()+ |
| | | "\nAND REPLIED:\n" + outStartMsg.toString()); |
| | |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo("In " + |
| | | replicationServerDomain.getReplicationServer(). |
| | | getMonitorInstanceName() + ", " + |
| | | this.replicationServer.getMonitorInstanceName() + ", " + |
| | | this.getClass().getSimpleName() + " " + this + ":" + |
| | | "\nSH START HANDSHAKE SENT("+ this + |
| | | "):\n" + outStartMsg.toString()+ |
| | |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo("In " + |
| | | replicationServerDomain.getReplicationServer(). |
| | | getMonitorInstanceName() + ", " + |
| | | this.replicationServer.getMonitorInstanceName() + ", " + |
| | | this.getClass().getSimpleName() + " " + this + ":" + |
| | | "\nSH TOPO HANDSHAKE RECEIVED:\n" + inTopoMsg.toString() + |
| | | "\nAND REPLIED:\n" + outTopoMsg.toString()); |
| | |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo("In " + |
| | | replicationServerDomain.getReplicationServer(). |
| | | getMonitorInstanceName() + ", " + |
| | | this.replicationServer.getMonitorInstanceName() + ", " + |
| | | this.getClass().getSimpleName() + " " + this + ":" + |
| | | "\nSH TOPO HANDSHAKE SENT:\n" + outTopoMsg.toString() + |
| | | "\nAND RECEIVED:\n" + inTopoMsg.toString()); |
| | |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo("In " + |
| | | replicationServerDomain.getReplicationServer(). |
| | | getMonitorInstanceName() + ", " + |
| | | this.replicationServer.getMonitorInstanceName() + ", " + |
| | | this.getClass().getSimpleName() + " " + this + " :" + |
| | | "\nSH SESSION HANDSHAKE RECEIVED:\n" + inStartSessionMsg.toString() + |
| | | "\nAND REPLIED:\n" + outTopoMsg.toString()); |
| | |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo("In " + |
| | | replicationServerDomain.getReplicationServer(). |
| | | getMonitorInstanceName() + ", " + |
| | | this.replicationServer.getMonitorInstanceName() + ", " + |
| | | this.getClass().getSimpleName() + " " + this + " :" + |
| | | "\nSH SESSION HANDSHAKE RECEIVED A STOP MESSAGE"); |
| | | } |
| | |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugInfo("In " + |
| | | replicationServerDomain.getReplicationServer(). |
| | | getMonitorInstanceName() + ", " + |
| | | this.replicationServer.getMonitorInstanceName() + ", " + |
| | | this.getClass().getSimpleName() + " " + this + " :" + |
| | | "\nSH SESSION HANDSHAKE RECEIVED:\n" + |
| | | inStartECLSessionMsg.toString()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * Process a Ack message received. |
| | | * @param ack the message received. |
| | | */ |
| | | public void processAck(AckMsg ack) |
| | | { |
| | | if (replicationServerDomain!=null) |
| | | replicationServerDomain.processAck(ack, this); |
| | | } |
| | | |
| | | /** |
| | | * Get the reference generation id (associated with the changes in the db). |
| | | * @return the reference generation id. |
| | | */ |
| | | public long getReferenceGenId() |
| | | { |
| | | long refgenid = -1; |
| | | if (replicationServerDomain!=null) |
| | | refgenid = replicationServerDomain.getGenerationId(); |
| | | return refgenid; |
| | | } |
| | | |
| | | /** |
| | | * Process a ResetGenerationIdMsg message received. |
| | | * @param msg the message received. |
| | | */ |
| | | public void processResetGenId(ResetGenerationIdMsg msg) |
| | | { |
| | | if (replicationServerDomain!=null) |
| | | replicationServerDomain.resetGenerationId(this, msg); |
| | | } |
| | | |
| | | /** |
| | | * Put a new update message received. |
| | | * @param update the update message received. |
| | | * @throws IOException when it occurs. |
| | | */ |
| | | public void put(UpdateMsg update) |
| | | throws IOException |
| | | { |
| | | if (replicationServerDomain!=null) |
| | | replicationServerDomain.put(update, this); |
| | | } |
| | | |
| | | /** |
| | | * Stop this handler. |
| | | */ |
| | | public void doStop() |
| | | { |
| | | if (replicationServerDomain!=null) |
| | | replicationServerDomain.stopServer(this); |
| | | } |
| | | } |