Github user bjlovegithub commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2629#discussion_r86709933
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/StreamTask.java
 ---
    @@ -540,15 +540,12 @@ private boolean performCheckpoint(CheckpointMetaData 
checkpointMetaData) throws
     
                synchronized (lock) {
                        if (isRunning) {
    +                           checkpointState(checkpointMetaData);
     
    -                           // Since both state checkpointing and 
downstream barrier emission occurs in this
    -                           // lock scope, they are an atomic operation 
regardless of the order in which they occur.
    -                           // Given this, we immediately emit the 
checkpoint barriers, so the downstream operators
    -                           // can start their checkpoint work as soon as 
possible
    +                           // broadcast barriers after snapshot operators' 
states.
                                operatorChain.broadcastCheckpointBarrier(
    -                                           
checkpointMetaData.getCheckpointId(), checkpointMetaData.getTimestamp());
    -
    -                           checkpointState(checkpointMetaData);
    +                                           
checkpointMetaData.getCheckpointId(), checkpointMetaData.getTimestamp()
    +                           );
    --- End diff --
    
    Can you share the test program and test result? I write an sample program 
to test the performance to acquire and release lock with `Object` / 
`ReentrantLock` / `ReentrantReadWriteLock`, finding that for one thread to use 
the lock, they have similar results. But referring to multiple thread cases, 
`ReentrantLock` and ` ReentrantReadWriteLock` excels `Object` lock.
    Here is my benchmark program: 
[link](https://github.com/bjlovegithub/JavaLockTest/blob/master/src/LockTest.java)
    And this is the sampled results run on my laptop: 
[stat](https://github.com/bjlovegithub/JavaLockTest/blob/master/stat/LockTest_result.data)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to