franz1981 edited a comment on pull request #3572:
URL: https://github.com/apache/activemq-artemis/pull/3572#issuecomment-841618355


   @TomasHofman I see that you've worked on 
https://issues.apache.org/jira/browse/ARTEMIS-3037.
   My changes for https://issues.apache.org/jira/browse/ARTEMIS-3290  are 
merging the append attempt with `checkKnowRecordID` on the appender thread.
   
   I'm not sure I can see the issue re 
https://issues.apache.org/jira/browse/ARTEMIS-3037 so I don't know if/how I 
should fix it now.
   I see that there is no way to make read lock lock to throw any exception, 
see:
   ```java
      public static void main(String[] args) throws InterruptedException {
         ReentrantReadWriteLock lock = new ReentrantReadWriteLock();
         lock.writeLock().lock();
         CountDownLatch started = new CountDownLatch(1);
         final AtomicBoolean tryLock = new AtomicBoolean();
         Thread t = new Thread(() -> {
            started.countDown();
            while (!tryLock.get()) {
   
            }
            System.out.println("try lock");
            try {
               lock.readLock().lock();
            } catch (Throwable err) {
               err.printStackTrace();
            } finally {
               System.out.println("EXIT!");
            }
         });
         t.start();
         started.await();
         t.interrupt();
         tryLock.set(true);
         System.out.println("INTERRUPT!");
      }
   ```
   So, in short, if the read lock isn't using 
https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/locks/Lock.html#lockInterruptibly()
 it cannot detect a Thread interruption and cannot propagate it to anyone 
waiting for it.
   I'm going to send a separate commit that's going to fix it, by referencing 
your same issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to