Skip to content

Commit

Permalink
fix offline parameter reference
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed May 9, 2012
1 parent 51d00f9 commit 32a34eb
Showing 1 changed file with 6 additions and 13 deletions.
Expand Up @@ -70,8 +70,6 @@ public class NodeService extends AbstractService implements INodeService {

private NodeHost nodeHostForCurrentNode = null;

private long offlineNodeDetectionMinutes;

private List<IOfflineServerListener> offlineServerListeners;

public NodeService(IParameterService parameterService, ISymmetricDialect dialect) {
Expand Down Expand Up @@ -303,7 +301,7 @@ public boolean isNodeAuthorized(String nodeId, String password) {
&& ((nodeSecurity.getNodePassword() != null
&& !nodeSecurity.getNodePassword().equals("") && nodeSecurity
.getNodePassword().equals(password)) || nodeSecurity
.isRegistrationEnabled())) {
.isRegistrationEnabled())) {
return true;
}
return false;
Expand Down Expand Up @@ -497,10 +495,12 @@ private String filterPasswordOnRenderIfNeeded(String password) {
}

public void checkForOfflineNodes() {
long offlineNodeDetectionMinutes = parameterService
.getLong(ParameterConstants.OFFLINE_NODE_DETECTION_PERIOD_MINUTES);
// Only check for offline nodes if there is a listener and the
// offline detection period is a positive value. The default value
// of -1 disables the feature.
if (offlineServerListeners != null && getOfflineNodeDetectionMinutes() > 0) {
if (offlineServerListeners != null && offlineNodeDetectionMinutes > 0) {

List<Node> list = findOfflineNodes();
if (list.size() > 0) {
Expand All @@ -510,7 +510,8 @@ public void checkForOfflineNodes() {
}

public List<Node> findOfflineNodes() {
return findOfflineNodes(getOfflineNodeDetectionMinutes());
return findOfflineNodes(parameterService
.getLong(ParameterConstants.OFFLINE_NODE_DETECTION_PERIOD_MINUTES));
}

public List<Node> findOfflineNodes(long minutesOffline) {
Expand Down Expand Up @@ -546,14 +547,6 @@ public List<Node> findOfflineNodes(long minutesOffline) {
return offlineNodeList;
}

public long getOfflineNodeDetectionMinutes() {
return offlineNodeDetectionMinutes;
}

public void setOfflineNodeDetectionMinutes(long offlineNodeDetectionMinutes) {
this.offlineNodeDetectionMinutes = offlineNodeDetectionMinutes;
}

public void setOfflineServerListeners(List<IOfflineServerListener> listeners) {
this.offlineServerListeners = listeners;
}
Expand Down

0 comments on commit 32a34eb

Please sign in to comment.