Skip to content

Commit

Permalink
MODCLUSTER-581 Session draining with negative timeout may wait indefi…
Browse files Browse the repository at this point in the history
…nitely
  • Loading branch information
rhusar committed Apr 26, 2017
1 parent 3b74402 commit c6452df
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ private boolean drainSessions(Context context, long start, long end) {

long current = System.currentTimeMillis();
long timeout = end - current;
long pollInterval = TimeUnit.SECONDS.toMillis(1);

remainingSessions = context.getActiveSessionCount();

Expand All @@ -703,7 +704,7 @@ private boolean drainSessions(Context context, long start, long end) {

// Poll active sessions every second since since right after the notify, the session manager implementation
// will still account for that last session.
listener.wait(noTimeout ? 0 : Math.min(timeout, 1000));
listener.wait(noTimeout ? pollInterval : Math.min(timeout, pollInterval));

current = System.currentTimeMillis();
timeout = end - current;
Expand Down

0 comments on commit c6452df

Please sign in to comment.