INT-3634 Fix race condition in the DHCRegistry
JIRA: https://jira.spring.io/browse/INT-3634
This commit is contained in:
committed by
Artem Bilan
parent
ec4453a3ee
commit
a9ff56174e
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -236,17 +236,15 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport
|
||||
* Cancel the scheduled reap task and run immediately; then reschedule.
|
||||
*/
|
||||
@Override
|
||||
public void runReaper() {
|
||||
synchronized(this) {
|
||||
this.reaperScheduledFuture.cancel(false);
|
||||
this.reaperScheduledFuture = null;
|
||||
public synchronized void runReaper() {
|
||||
if (this.reaperScheduledFuture != null) {
|
||||
this.reaperScheduledFuture.cancel(true);
|
||||
}
|
||||
this.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
this.reaperScheduledFuture = null;
|
||||
public synchronized void run() {
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Reaper started; channels size=" + this.channels.size());
|
||||
}
|
||||
@@ -261,12 +259,8 @@ public class DefaultHeaderChannelRegistry extends IntegrationObjectSupport
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
synchronized (this) {
|
||||
if (this.reaperScheduledFuture == null) {
|
||||
this.reaperScheduledFuture = this.getTaskScheduler().schedule(this,
|
||||
new Date(System.currentTimeMillis() + this.reaperDelay));
|
||||
}
|
||||
}
|
||||
this.reaperScheduledFuture = this.getTaskScheduler().schedule(this,
|
||||
new Date(System.currentTimeMillis() + this.reaperDelay));
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace("Reaper completed; channels size=" + this.channels.size());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user