void putBeforeFlush(final Region region) {
    alreadyComeHere = false;
    CacheObserverHolder.setInstance(new CacheObserverAdapter() {

      @Override
      public void goingToFlush() {
        if (!alreadyComeHere) {
          // this should do an in place update of the re we just took of the queue
          region.put("Key", "Value2");
        }
        alreadyComeHere = true;
      }
    });
    ((LocalRegion) region).getDiskRegion().pauseFlusherForTesting();
    region.put("Key", "Value1");
    ((LocalRegion) region).getDiskRegion().flushForTesting();
    try {
      assertEquals("Value2", region.get("Key"));
      assertEquals("Value2", getValueOnDisk(region));
    } catch (EntryNotFoundException e) {
      logWriter.error("Exception occurred", e);
      fail("Entry not found although was supposed to be there");
    }
  }
A put is done on the same entry before flushing that entry

The test ensures that put is not done twice by using a alreadyComeHere boolean.
geode-core/src/integrationTest/java/org/apache/geode/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java