jinmeiliao commented on code in PR #7556:
URL: https://github.com/apache/geode/pull/7556#discussion_r845292857
##########
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/MessageDispatcher.java:
##########
@@ -548,6 +529,48 @@ protected void runDispatcher() {
}
}
+ private boolean
handleAuthenticationExpiredException(AuthenticationExpiredException expired)
+ throws InterruptedException {
+ long reAuthenticateWaitTime =
+ getSystemProperty(RE_AUTHENTICATE_WAIT_TIME,
DEFAULT_RE_AUTHENTICATE_WAIT_TIME);
+ synchronized (reAuthenticationLock) {
+ // turn on the "isWaitingForReAuthentication" flag before we send the
re-auth message
+ // if we do it the other way around, the re-auth might be finished
before we turn on the
+ // flag for the notification to happen.
+ waitForReAuthenticationStartTime = System.currentTimeMillis();
+ subjectUpdated = false;
+ // only send the message to clients who can handle the message
+ if
(getProxy().getVersion().isNewerThanOrEqualTo(RE_AUTHENTICATION_START_VERSION))
{
+ EventID eventId = createEventId();
+ sendMessageDirectly(new ClientReAuthenticateMessage(eventId));
+ }
+
+ // We wait for all versions of clients to re-authenticate. For older
clients we still
+ // wait, just in case client will perform some operations to
+ // trigger credential refresh on its own.
+ long waitFinishTime = waitForReAuthenticationStartTime +
reAuthenticateWaitTime;
+ long remainingWaitTime = waitFinishTime - System.currentTimeMillis();
+ while (!subjectUpdated && remainingWaitTime > 0) {
+ reAuthenticationLock.wait(remainingWaitTime);
+ remainingWaitTime = waitFinishTime - System.currentTimeMillis();
+ }
+ }
+ // the above wait timed out
+ if (!subjectUpdated) {
+ long elapsedTime = System.currentTimeMillis() -
waitForReAuthenticationStartTime;
+ // reset the timer here since we are no longer waiting for re-auth to
happen anymore
+ waitForReAuthenticationStartTime = -1;
Review Comment:
Yes, there is, `isWaitingForReAuthentication()` is using it to determine if
the dispatcher is waiting.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]