Fixed coveirty defects for concurrency, variable comparison etc

Signed-off-by: Santhosh Edukulla <santhosh.edukulla@gmail.com>
This commit is contained in:
Santhosh Edukulla 2014-08-14 18:31:11 +05:30
parent c90bf1231f
commit 4825017cc7
3 changed files with 8 additions and 7 deletions

View File

@ -294,6 +294,11 @@ public class Agent implements HandlerFactory, IAgentControl {
_watchList.clear();
}
}
public synchronized void lockStartupTask(Link link)
{
_startup = new StartupTask(link);
_timer.schedule(_startup, _startupWait);
}
public void sendStartup(Link link) {
final StartupCommand[] startup = _resource.initialize();
@ -309,10 +314,7 @@ public class Agent implements HandlerFactory, IAgentControl {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Sending Startup: " + request.toString());
}
synchronized (this) {
_startup = new StartupTask(link);
_timer.schedule(_startup, _startupWait);
}
lockStartupTask(link);
try {
link.send(request.toBytes());
} catch (final ClosedChannelException e) {
@ -411,7 +413,6 @@ public class Agent implements HandlerFactory, IAgentControl {
cancelled = true;
}
}
final StartupAnswer startup = (StartupAnswer)answer;
if (!startup.getResult()) {
s_logger.error("Not allowed to connect to the server: " + answer.getDetails());

View File

@ -165,7 +165,7 @@ public class RegisterIsoCmd extends BaseCmd {
}
public Boolean isDynamicallyScalable() {
return isDynamicallyScalable == null ? false : isDynamicallyScalable;
return isDynamicallyScalable == null ? Boolean.FALSE : isDynamicallyScalable;
}
/////////////////////////////////////////////////////

View File

@ -127,7 +127,7 @@ public class MHostVO implements Serializable {
if (!(other instanceof MHostVO))
return false;
return hostKey == ((MHostVO)other).getHostKey();
return hostKey.equals(((MHostVO)other).getHostKey());
}
@Override