| | |
| | | |
| | | import static org.opends.server.loggers.ErrorLogger.logError; |
| | | import static org.opends.server.loggers.debug.DebugLogger.*; |
| | | |
| | | import org.opends.server.loggers.debug.DebugTracer; |
| | | import static org.opends.server.messages.MessageHandler.getMessage; |
| | | import static org.opends.server.messages.ReplicationMessages.*; |
| | |
| | | */ |
| | | private static final DebugTracer TRACER = getTracer(); |
| | | |
| | | /** |
| | | * Time during which the server will wait for existing thread to stop |
| | | * during the shutdown. |
| | | */ |
| | | private static final int SHUTDOWN_JOIN_TIMEOUT = 30000; |
| | | |
| | | private short serverId; |
| | | private ProtocolSession session; |
| | | private final MsgQueue msgQueue = new MsgQueue(); |
| | |
| | | private UpdateMessage getnextMessage() |
| | | { |
| | | UpdateMessage msg; |
| | | do |
| | | while (active == true) |
| | | { |
| | | if (following == false) |
| | | { |
| | |
| | | * the first check at the beginning of this method |
| | | * and the second check just above. |
| | | */ |
| | | } while (active == true); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | |
| | | public void stopHandler() |
| | | { |
| | | active = false; |
| | | |
| | | try |
| | | { |
| | | session.close(); |
| | | } catch (IOException e) |
| | | { |
| | | // ignore. |
| | | } |
| | | |
| | | synchronized (msgQueue) |
| | | { |
| | | /* wake up the writer thread on an empty queue so that it disappear */ |
| | |
| | | { |
| | | // Service is closing. |
| | | } |
| | | |
| | | stopHandler(); |
| | | |
| | | try |
| | | { |
| | | writer.join(SHUTDOWN_JOIN_TIMEOUT); |
| | | reader.join(SHUTDOWN_JOIN_TIMEOUT); |
| | | } catch (InterruptedException e) |
| | | { |
| | | // don't try anymore to join and return. |
| | | } |
| | | } |
| | | |
| | | /** |