jvarenina commented on PR #7378:
URL: https://github.com/apache/geode/pull/7378#issuecomment-1123927160

   
   This PR has been hanging for a long time now, and we should decide whether 
to close it or merge it.
   
   I think this PR adds value to Apache geode if we at least "synchronize" 
sending of CacheServerLoadMessage on all servers. Current 5 seconds possible 
difference is just too much. I think this could be done with the following 
simple not so smart algorithm: 
   
   ```
   
   @@ -159,17 +159,24 @@ public class LoadMonitor implements ConnectionListener 
{
          }
        }
    
   +    long getSynchronizedServerTimeWaitInterval() {
   +      long currentTimeMills = System.currentTimeMillis();
   +      long serversSynchronizedTime = (currentTimeMills - (currentTimeMills 
% pollInterval)) + pollInterval;
   +      return serversSynchronizedTime - currentTimeMills;
   +    }
   +
        @Override
        public void run() {
          while (alive) {
            try {
              synchronized (signal) {
   -            long end = System.currentTimeMillis() + pollInterval;
   -            long remaining = pollInterval;
   -            while (alive && remaining > 0) {
   -              signal.wait(remaining);
   -              remaining = end - System.currentTimeMillis();
   +            long toWaitInterval = 0;
   +            while(toWaitInterval <= 0) {
   +              toWaitInterval = getSynchronizedServerTimeWaitInterval();
                }
   +            signal.wait(toWaitInterval);
   +            System.out.println("execution time: " + 
System.currentTimeMillis());
              }
    
              if (!alive) {
   ```
   
   @boglesby what do you think about this?


-- 
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: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to