mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

gbellato
05.41.2009 2285a5db2a9f643686b6d4f27fcf557055771437
Fix for 3844 : ReplicationDomain.publish can loose changes when called by several thread.

Some locking must be done between the Generation of the ChangeNumber
and the call to broker.publish() because the broker does not do any
re-ordering and the ReplicationServer expect to receive the Changes
in the order defined by the ChangeNumber
1 files modified
16 ■■■■■ changed files
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java 16 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/replication/service/ReplicationDomain.java
@@ -2618,14 +2618,18 @@
   */
  public void publish(byte[] msg)
  {
    UpdateMsg update = new UpdateMsg(generator.newChangeNumber(), msg);
    UpdateMsg update;
    synchronized (this)
    {
      update = new UpdateMsg(generator.newChangeNumber(), msg);
    // If assured replication is configured, this will prepare blocking
    // mechanism. If assured replication is disabled, this returns
    // immediately
    prepareWaitForAckIfAssuredEnabled(update);
      // If assured replication is configured, this will prepare blocking
      // mechanism. If assured replication is disabled, this returns
      // immediately
      prepareWaitForAckIfAssuredEnabled(update);
    publish(update);
      publish(update);
    }
    try
    {