refactor
This commit is contained in:
coderfengyun 2014-07-19 09:55:48 +08:00
parent e682f608b5
commit 20094a2a30
3 changed files with 3 additions and 21 deletions

View File

@ -17,10 +17,6 @@ public interface HighAvailablePool {
public void remove(Agent agent); public void remove(Agent agent);
public void addABlotter(RunningAgentInterface runningAgent);
public void removeABlotter(UUID agentRunId);
public int blotterSize(); public int blotterSize();
public Long getMaxAvailableLoad(); public Long getMaxAvailableLoad();

View File

@ -145,10 +145,8 @@ public class HighAvailablePoolImpl extends CurrentLoadSubject implements
@Scheduled(cron = "0,30 */2 * * * *") @Scheduled(cron = "0,30 */2 * * * *")
public synchronized void checkAllHeartBeat() { public synchronized void checkAllHeartBeat() {
long time = System.nanoTime();
heartBeatsAndUpdateHAPool(); heartBeatsAndUpdateHAPool();
doSubstituteIfRequired(); doSubstituteIfRequired();
System.out.println("finish heart beat:" + (System.nanoTime() - time));
} }
private void heartBeatsAndUpdateHAPool() { private void heartBeatsAndUpdateHAPool() {
@ -161,7 +159,7 @@ public class HighAvailablePoolImpl extends CurrentLoadSubject implements
this.updateAgentPoolByHeart(map); this.updateAgentPoolByHeart(map);
} }
private void updateAgentPoolByHeart( private void updateAgentPoolByHeart(
Map<Agent, Future<ServerStatusModel>> map) { Map<Agent, Future<ServerStatusModel>> map) {
this.setCurrentAvailableLoad(0); this.setCurrentAvailableLoad(0);
this.setMaxAvailableLoad((long) 0); this.setMaxAvailableLoad((long) 0);
@ -212,12 +210,12 @@ public class HighAvailablePoolImpl extends CurrentLoadSubject implements
this.setCurrentAvailableLoad(availableLoad); this.setCurrentAvailableLoad(availableLoad);
} }
public void addABlotter(RunningAgentInterface runningAgent) { private void addABlotter(RunningAgentInterface runningAgent) {
this.getAgentRunBlotters().put(runningAgent.getAgentRunId(), this.getAgentRunBlotters().put(runningAgent.getAgentRunId(),
runningAgent); runningAgent);
} }
public void removeABlotter(UUID agentRunId) { private void removeABlotter(UUID agentRunId) {
this.getAgentRunBlotters().remove(agentRunId); this.getAgentRunBlotters().remove(agentRunId);
} }

View File

@ -85,24 +85,12 @@ public class HighAvailableImpl implements HighAvailablePool {
return null; return null;
} }
@Override
public void removeABlotter(UUID agentRunId) {
// TODO Auto-generated method stub
}
@Override @Override
public int blotterSize() { public int blotterSize() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return 0; return 0;
} }
@Override
public void addABlotter(RunningAgentInterface runningAgent) {
// TODO Auto-generated method stub
}
@Override @Override
public void remove(Agent agent) { public void remove(Agent agent) {
// TODO Auto-generated method stub // TODO Auto-generated method stub