NIFI-1085 WebClusterManager fair locking and HeartbeatMonitoringTimerTask scheduling

This commit is contained in:
Mike Moser 2015-11-04 12:14:46 -05:00
parent 201eac052b
commit 6add372bc1
1 changed files with 2 additions and 2 deletions

View File

@ -330,7 +330,7 @@ public class WebClusterManager implements HttpClusterManager, ProtocolHandler, C
private final OptimisticLockingManager optimisticLockingManager; private final OptimisticLockingManager optimisticLockingManager;
private final StringEncryptor encryptor; private final StringEncryptor encryptor;
private final Queue<Heartbeat> pendingHeartbeats = new ConcurrentLinkedQueue<>(); private final Queue<Heartbeat> pendingHeartbeats = new ConcurrentLinkedQueue<>();
private final ReentrantReadWriteLock resourceRWLock = new ReentrantReadWriteLock(); private final ReentrantReadWriteLock resourceRWLock = new ReentrantReadWriteLock(true);
private final ClusterManagerLock readLock = new ClusterManagerLock(resourceRWLock.readLock(), "Read"); private final ClusterManagerLock readLock = new ClusterManagerLock(resourceRWLock.readLock(), "Read");
private final ClusterManagerLock writeLock = new ClusterManagerLock(resourceRWLock.writeLock(), "Write"); private final ClusterManagerLock writeLock = new ClusterManagerLock(resourceRWLock.writeLock(), "Write");
@ -480,7 +480,7 @@ public class WebClusterManager implements HttpClusterManager, ProtocolHandler, C
try { try {
// setup heartbeat monitoring // setup heartbeat monitoring
heartbeatMonitor = new Timer("Heartbeat Monitor", /* is daemon */ true); heartbeatMonitor = new Timer("Heartbeat Monitor", /* is daemon */ true);
heartbeatMonitor.scheduleAtFixedRate(new HeartbeatMonitoringTimerTask(), 0, getHeartbeatMonitoringIntervalSeconds() * 1000); heartbeatMonitor.schedule(new HeartbeatMonitoringTimerTask(), 0, getHeartbeatMonitoringIntervalSeconds() * 1000);
heartbeatProcessor = new Timer("Process Pending Heartbeats", true); heartbeatProcessor = new Timer("Process Pending Heartbeats", true);
final int processPendingHeartbeatDelay = 1000 * Math.max(1, getClusterProtocolHeartbeatSeconds() / 2); final int processPendingHeartbeatDelay = 1000 * Math.max(1, getClusterProtocolHeartbeatSeconds() / 2);