org.opends.server.replication.protocol
Class AckMsg

java.lang.Object
  extended by org.opends.server.replication.protocol.ReplicationMsg
      extended by org.opends.server.replication.protocol.AckMsg

public class AckMsg
extends ReplicationMsg

AckMsg messages are used for acknowledging an update that has been sent requesting an ack: update sent in Assured Mode, either safe data or safe read sub mode. The change number refers to the update change number that was requested to be acknowledged. If some errors occurred during attempt to acknowledge the update in the path to final servers, errors are marked with the following fields: - hasTimeout: Some servers went in timeout when the matching update was sent. - hasWrongStatus: Some servers were in a status where we cannot ask for an ack when the matching update was sent. - hasReplayError: Some servers made an error replaying the sent matching update. - failedServers: The list of server ids that had errors for the sent matching update. Each server id of the list had one of the 3 possible errors (timeout/wrong status /replay error) AckMsg messages are sent all along the reverse path of the path followed an update message.


Constructor Summary
AckMsg(byte[] in)
          Creates a new AckMsg by decoding the provided byte array.
AckMsg(ChangeNumber changeNumber)
          Creates a new AckMsg from a ChangeNumber (no errors).
AckMsg(ChangeNumber changeNumber, boolean hasTimeout, boolean hasWrongStatus, boolean hasReplayError, java.util.List<java.lang.Integer> failedServers)
          Creates a new AckMsg from a ChangeNumber (with specified error info).
 
Method Summary
 java.lang.String errorsToString()
          Transforms the errors information of the ack into human readable string.
 byte[] getBytes()
          Return the byte[] representation of this message.
 ChangeNumber getChangeNumber()
          Get the ChangeNumber from the message.
 java.util.List<java.lang.Integer> getFailedServers()
          Get the list of failed servers.
 boolean hasReplayError()
          Tells if the matching update had replay error.
 boolean hasTimeout()
          Tells if the matching update had timeout.
 boolean hasWrongStatus()
          Tells if the matching update had wrong status error.
 void setFailedServers(java.util.List<java.lang.Integer> idList)
          Sets the list of failing servers for this message.
 void setHasReplayError(boolean hasReplayError)
          Sets the replay error marker for this message.
 void setHasTimeout(boolean hasTimeout)
          Sets the timeout marker for this message.
 void setHasWrongStatus(boolean hasWrongStatus)
          Sets the wrong status marker for this message.
 
Methods inherited from class org.opends.server.replication.protocol.ReplicationMsg
addByteArray, generateMsg, getBytes, getNextLength
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AckMsg

public AckMsg(ChangeNumber changeNumber)
Creates a new AckMsg from a ChangeNumber (no errors).

Parameters:
changeNumber - The ChangeNumber used to build the AckMsg.

AckMsg

public AckMsg(ChangeNumber changeNumber,
              boolean hasTimeout,
              boolean hasWrongStatus,
              boolean hasReplayError,
              java.util.List<java.lang.Integer> failedServers)
Creates a new AckMsg from a ChangeNumber (with specified error info).

Parameters:
changeNumber - The ChangeNumber used to build the AckMsg.
hasTimeout - The hasTimeout info
hasWrongStatus - The hasWrongStatus info
hasReplayError - The hasReplayError info
failedServers - The list of failed servers

AckMsg

public AckMsg(byte[] in)
       throws java.util.zip.DataFormatException
Creates a new AckMsg by decoding the provided byte array.

Parameters:
in - The byte array containing the encoded form of the AckMsg.
Throws:
java.util.zip.DataFormatException - If in does not contain a properly encoded AckMsg.
Method Detail

setHasTimeout

public void setHasTimeout(boolean hasTimeout)
Sets the timeout marker for this message.

Parameters:
hasTimeout - True if some timeout occurred

setHasWrongStatus

public void setHasWrongStatus(boolean hasWrongStatus)
Sets the wrong status marker for this message.

Parameters:
hasWrongStatus - True if some servers were in wrong status

setHasReplayError

public void setHasReplayError(boolean hasReplayError)
Sets the replay error marker for this message.

Parameters:
hasReplayError - True if some servers had errors replaying the change

setFailedServers

public void setFailedServers(java.util.List<java.lang.Integer> idList)
Sets the list of failing servers for this message.

Parameters:
idList - The list of failing servers for this message.

getChangeNumber

public ChangeNumber getChangeNumber()
Get the ChangeNumber from the message.

Returns:
the ChangeNumber

getBytes

public byte[] getBytes()
Return the byte[] representation of this message. Depending on the message type, the first byte of the byte[] must be one of the MSG_TYPE* definitions. The serialization is done using the current protocol version. For a serialization using a particular protocol version, call the getBytes(byte protocolVersion) method that should be available for the subclasses (PDUs) that allow such a translation.

Specified by:
getBytes in class ReplicationMsg
Returns:
the byte[] representation of this message.

hasTimeout

public boolean hasTimeout()
Tells if the matching update had timeout.

Returns:
true if the matching update had timeout

hasWrongStatus

public boolean hasWrongStatus()
Tells if the matching update had wrong status error.

Returns:
true if the matching update had wrong status error

hasReplayError

public boolean hasReplayError()
Tells if the matching update had replay error.

Returns:
true if the matching update had replay error

getFailedServers

public java.util.List<java.lang.Integer> getFailedServers()
Get the list of failed servers.

Returns:
the list of failed servers

errorsToString

public java.lang.String errorsToString()
Transforms the errors information of the ack into human readable string.

Returns:
A human readable string for errors embedded in the message.