You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2020/06/14 11:57:41 UTC

[GitHub] [rocketmq] lebron374 opened a new issue #2094: MappedFile shutdown problem

lebron374 opened a new issue #2094:
URL: https://github.com/apache/rocketmq/issues/2094


   ```
   public abstract class ReferenceResource {
   
       protected final AtomicLong refCount = new AtomicLong(1);
       protected volatile boolean available = true;
       protected volatile boolean cleanupOver = false;
       private volatile long firstShutdownTimestamp = 0;
   
       public synchronized boolean hold() {
           if (this.isAvailable()) {
               if (this.refCount.getAndIncrement() > 0) {
                   return true;
               } else {
                   this.refCount.getAndDecrement();
               }
           }
   
           return false;
       }
   
       public boolean isAvailable() {
           return this.available;
       }
   
       public void shutdown(final long intervalForcibly) {
           if (this.available) {
               this.available = false;
               this.firstShutdownTimestamp = System.currentTimeMillis();
               this.release();
           } else if (this.getRefCount() > 0) {
               if ((System.currentTimeMillis() - this.firstShutdownTimestamp) >= intervalForcibly) {
                   // some confusion here
                   this.refCount.set(-1000 - this.getRefCount());
                   this.release();
               }
           }
       }
   ```
   
    this.refCount.set(-1000 - this.getRefCount())
   
   should replace by 
   
    this.refCount.set(-1000 + this.getRefCount());
   
   i think the purpose is every time decreate by 1000 until 0


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] RongtongJin closed issue #2094: MappedFile shutdown problem

Posted by GitBox <gi...@apache.org>.
RongtongJin closed issue #2094:
URL: https://github.com/apache/rocketmq/issues/2094


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] imaffe edited a comment on issue #2094: MappedFile shutdown problem

Posted by GitBox <gi...@apache.org>.
imaffe edited a comment on issue #2094:
URL: https://github.com/apache/rocketmq/issues/2094#issuecomment-645394763


   Will close this issue as this is not a bug recorder. We recommend use dev maillist for questions and use  github issues only for bug recording purposes.
   @RongtongJin 


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] imaffe commented on issue #2094: MappedFile shutdown problem

Posted by GitBox <gi...@apache.org>.
imaffe commented on issue #2094:
URL: https://github.com/apache/rocketmq/issues/2094#issuecomment-645105895


   I think here( -1000 - this.getRefCount()) probably means : it just want to set the refCount to a negative value indicating a  shutdown. (-1000) is just a "negative enough" number that guarantees the result (-1000 - this.getRefCount()) will always be negative. How do you think ?


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [rocketmq] imaffe commented on issue #2094: MappedFile shutdown problem

Posted by GitBox <gi...@apache.org>.
imaffe commented on issue #2094:
URL: https://github.com/apache/rocketmq/issues/2094#issuecomment-645394763


   Will close this issue as this is not a bug recorder. We recommend use dev maillist for questions and use  github issues only for bug recording purposes.
   


----------------------------------------------------------------
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:
users@infra.apache.org