| | |
| | | import org.opends.server.replication.protocol.UpdateMsg; |
| | | import org.opends.server.replication.protocol.WindowMsg; |
| | | import org.opends.server.replication.protocol.WindowProbeMsg; |
| | | import org.opends.server.types.DebugLogLevel; |
| | | import org.opends.server.util.ServerConstants; |
| | | import org.opends.server.replication.server.ReplicationServer; |
| | | |
| | |
| | | this.weight = rsInfo.getWeight(); |
| | | this.connectedDSs = connectedDSs; |
| | | this.connectedDSNumber = connectedDSs.size(); |
| | | this.serverState = new ServerState(); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | if (connected == false) |
| | | { |
| | | if (session != null) |
| | | ProtocolSession localSession = session; |
| | | if (localSession != null) |
| | | { |
| | | try |
| | | { |
| | | session.close(); |
| | | } catch (IOException e) |
| | | { |
| | | // The session was already closed, just ignore. |
| | | } |
| | | localSession.close(); |
| | | session = null; |
| | | } |
| | | } |
| | |
| | | { |
| | | if (localSession != null) |
| | | { |
| | | if (debugEnabled()) |
| | | if (debugEnabled()) { |
| | | debugInfo("In RB, closing session after phase 1"); |
| | | } |
| | | |
| | | if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4) |
| | | { |
| | | // V4 protocol introduces a StopMsg to properly end communications |
| | | if (!error) |
| | | { |
| | | try |
| | | { |
| | | localSession.publish(new StopMsg()); |
| | | } catch (IOException ioe) |
| | | { |
| | | // Anyway, going to close session, so nothing to do |
| | | } |
| | | } |
| | | } |
| | | try |
| | | { |
| | | localSession.close(); |
| | | } catch (IOException e) |
| | | { |
| | | // The session was already closed, just ignore. |
| | | } |
| | | localSession.close(); |
| | | localSession = null; |
| | | } |
| | | if (error) |
| | |
| | | { |
| | | if (localSession != null) |
| | | { |
| | | if (debugEnabled()) |
| | | if (debugEnabled()) { |
| | | debugInfo("In RB, closing session after phase 1"); |
| | | |
| | | // V4 protocol introduces a StopMsg to properly end communications |
| | | if (!error) |
| | | { |
| | | try |
| | | { |
| | | localSession.publish(new StopMsg()); |
| | | } catch (IOException ioe) |
| | | { |
| | | // Anyway, going to close session, so nothing to do |
| | | } |
| | | } |
| | | try |
| | | { |
| | | localSession.close(); |
| | | } catch (IOException e) |
| | | { |
| | | // The session was already closed, just ignore. |
| | | } |
| | | localSession.close(); |
| | | localSession = null; |
| | | } |
| | | if (error) |
| | |
| | | |
| | | if (session != null) |
| | | { |
| | | try |
| | | { |
| | | session.close(); |
| | | } catch (IOException ex) |
| | | { |
| | | // The session was already closed, just ignore. |
| | | } |
| | | session.close(); |
| | | session = null; |
| | | } |
| | | // Be sure to return null. |
| | |
| | | |
| | | if (session != null) |
| | | { |
| | | try |
| | | { |
| | | session.close(); |
| | | } catch (IOException ex) |
| | | { |
| | | // The session was already closed, just ignore. |
| | | } |
| | | session.close(); |
| | | session = null; |
| | | } |
| | | // Be sure to return null. |
| | |
| | | heartbeatMonitor = new HeartbeatMonitor( |
| | | threadName, |
| | | session, |
| | | heartbeatInterval, |
| | | (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4)); |
| | | heartbeatInterval); |
| | | heartbeatMonitor.start(); |
| | | } |
| | | } |
| | |
| | | |
| | | if (failingSession != null) |
| | | { |
| | | if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4) |
| | | { |
| | | // V4 protocol introduces a StopMsg to properly end communications |
| | | try |
| | | { |
| | | failingSession.publish(new StopMsg()); |
| | | } catch (IOException ioe) |
| | | { |
| | | // Anyway, going to close session, so nothing to do |
| | | } |
| | | } |
| | | try |
| | | { |
| | | failingSession.close(); |
| | | } catch (IOException e1) |
| | | { |
| | | // ignore |
| | | } |
| | | failingSession.close(); |
| | | numLostConnections++; |
| | | } |
| | | |
| | |
| | | throw e; |
| | | } catch (Exception e) |
| | | { |
| | | if (debugEnabled()) |
| | | { |
| | | TRACER.debugCaught(DebugLogLevel.ERROR, e); |
| | | } |
| | | |
| | | if (shutdown == false) |
| | | { |
| | | if ((session == null) || (!session.closeInitiated())) |
| | |
| | | rsGroupId = (byte) -1; |
| | | rsServerId = -1; |
| | | rsServerUrl = null; |
| | | |
| | | try |
| | | if (session != null) |
| | | { |
| | | if (protocolVersion >= ProtocolVersion.REPLICATION_PROTOCOL_V4) |
| | | { |
| | | // V4 protocol introduces a StopMsg to properly end communications |
| | | session.publish(new StopMsg()); |
| | | } |
| | | session.close(); |
| | | } catch (Exception e) |
| | | { |
| | | // Anyway, going to close session, so nothing to do |
| | | } |
| | | } |
| | | |