clebertsuconic commented on code in PR #5498: URL: https://github.com/apache/activemq-artemis/pull/5498#discussion_r1960360170
########## artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java: ########## @@ -1262,8 +1324,16 @@ private boolean writePage(Message message, Transaction tx, RouteContextList listCtx, Function<Message, Message> pageDecorator) throws Exception { - lock.writeLock().lock(); - + if (timedWriter == null) { + // in case timedWriter is not being used, we need to guarantee a writeLock. + // because there's no way to upgrade from reading to writeLock + writeLock(); + } else { + // if we are using a timedWritter, we can just use a readLock to guarantee paging is not changed + // this will issue the writer on a different thread, and we can just use a readLock + readLock(); Review Comment: thing is... when the pagedTimeWriter is in use, things are pretty much single threaded.. and updated from the PageExecutor. The only difference is to schedule a task it needs to use a readLock to make sure it was paging, and it should stay paging until the task is scheduled. -- 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. To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: gitbox-unsubscr...@activemq.apache.org For additional commands, e-mail: gitbox-h...@activemq.apache.org For further information, visit: https://activemq.apache.org/contact