mgao0 commented on a change in pull request #1000:
URL: https://github.com/apache/helix/pull/1000#discussion_r433555042
##########
File path:
helix-core/src/main/java/org/apache/helix/manager/zk/CallbackHandler.java
##########
@@ -818,4 +884,15 @@ public String getContent() {
+ ", _listener=" + _listener + ", _changeType=" + _changeType + ",
_manager=" + _manager
+ ", _zkClient=" + _zkClient + '}';
}
+
+ private void initRefreshTask() {
+ _lastEventTime = System.currentTimeMillis();
+ _periodicRefreshExecutor = new ScheduledThreadPoolExecutor(1);
+ // When cancelling the task future, it removes the task from the queue
+ // so we won't have a memory leakage when we cancel scheduled task
+ _periodicRefreshExecutor.setRemoveOnCancelPolicy(true);
+ _scheduledRefreshFuture = _periodicRefreshExecutor
+ .scheduleWithFixedDelay(new RefreshTask(), _periodicRefreshInterval,
Review comment:
@jiajunwang The previous PR contains the first condition you mentioned.
I added the second condition in the updated PR. And both checks are still being
done in the callback handler instead of ZK event queue.
As per our discussion on Friday, I tried to do this in the ZKEvent queue,
and found it hard to do, when an event coming in at the ZKEvent level, we don't
know the change type of the event, thus not able to reset the timer
accordingly. Currently at the ZKEvent level, no Helix logics are involved so I
think it's better we keep it that way.
For your concern on parallel invoke, we synchronize on Helix manager in the
invoke method, so it should be fine.
Let's discuss more if you still have concern 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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]