| | |
| | | * |
| | | * |
| | | * Copyright 2006-2010 Sun Microsystems, Inc. |
| | | * Portions copyright 2011-2012 ForgeRock AS |
| | | * Portions copyright 2011-2013 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.server; |
| | | |
| | |
| | | */ |
| | | public class DataServerHandler extends ServerHandler |
| | | { |
| | | // Temporay generationId received in handshake/phase1, |
| | | // Temporary generationId received in handshake/phase1, |
| | | // and used after handshake/phase2 |
| | | long tmpGenerationId; |
| | | |
| | |
| | | |
| | | if (newStatus == ServerStatus.INVALID_STATUS) |
| | | { |
| | | Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId().toString(), |
| | | Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId(), |
| | | Integer.toString(serverId), status.toString(), event.toString()); |
| | | logError(msg); |
| | | return; |
| | |
| | | ServerStatus newStatus = StatusMachine.computeNewStatus(status, event); |
| | | if (newStatus == ServerStatus.INVALID_STATUS) |
| | | { |
| | | Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId().toString(), |
| | | Message msg = ERR_RS_CANNOT_CHANGE_STATUS.get(getServiceId(), |
| | | Integer.toString(serverId), status.toString(), event.toString()); |
| | | logError(msg); |
| | | return ServerStatus.INVALID_STATUS; |
| | |
| | | * let the reader thread see the closure and cleanup any reference |
| | | * to old connection. This must be done before taking the domain lock so |
| | | * that the reader thread has a chance to stop the handler. |
| | | * |
| | | * TODO: This hack should be removed and disconnection/reconnection |
| | | * properly dealt with. |
| | | */ |
| | | replicationServerDomain.waitDisconnection(inServerStartMsg.getServerId()); |
| | | if (replicationServerDomain.getConnectedDSs() |
| | | .containsKey(inServerStartMsg.getServerId())) |
| | | { |
| | | try { |
| | | Thread.sleep(100); |
| | | } |
| | | catch(Exception e){ |
| | | abortStart(null); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | // lock with no timeout |
| | | lockDomain(false); |
| | |
| | | */ |
| | | public DSInfo toDSInfo() |
| | | { |
| | | DSInfo dsInfo = new DSInfo(serverId, replicationServerId, generationId, |
| | | |
| | | return new DSInfo(serverId, replicationServerId, generationId, |
| | | status, assuredFlag, assuredMode, safeDataLevel, groupId, refUrls, |
| | | eclIncludes, eclIncludesForDeletes, protocolVersion); |
| | | |
| | | return dsInfo; |
| | | } |
| | | |
| | | /** |