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

gbellato
05.41.2009 70bf547ea6402ec999fc7b8aff12b77d1a7336eb
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
opendj-sdk/opends/src/server/org/opends/server/replication/service/ReplicationDomain.java 16 ●●●●● patch | view | raw | blame | history
opendj-sdk/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
    {