add a fault tolerance skeleton to be filled
This commit is contained in:
parent
19b789d00e
commit
0bc53295b5
|
@ -0,0 +1,7 @@
|
|||
package org.bench4q.master.testPlan.highavailable;
|
||||
|
||||
public class BriefAgentFault implements FaultTolerance {
|
||||
public void doTolerance() {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
package org.bench4q.master.testPlan.highavailable;
|
||||
|
||||
public interface FaultTolerance {
|
||||
public void doFaultTolerance();
|
||||
public void doTolerance();
|
||||
}
|
||||
|
|
|
@ -139,6 +139,10 @@ public class HighAvailablePool {
|
|||
substituteOnBoard(agentRunBlotter, agentRunId);
|
||||
agentRunBlotter.getRunningAgentModel().getAgent()
|
||||
.setCurrentStatus(AgentService.AGENT_STATUS_BreakDown);
|
||||
// TODO: update the status in Context, but first i want to know if
|
||||
// context and runBlotter are using the same runningAgentModel
|
||||
// TestPlanContext testPlanContext = this.getTestPlanContainer()
|
||||
// .getRunningTestPlans().get(agentRunBlotter.getTestPlanId());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +177,6 @@ public class HighAvailablePool {
|
|||
|
||||
private void _doForHealth(ServerStatusModel newModel, Agent agent) {
|
||||
_arrageUnfinishedTest(newModel, agent);
|
||||
// _arrangeFinishedTest(newModel, agent.getHostName());
|
||||
if (agent.getCurrentStatus() == AgentService.AGENT_STATUS_Idel) {
|
||||
this.setMaxLoadOfHAPool(this.getMaxLoadOfHAPool()
|
||||
+ (long) agent.getRemainLoad());
|
||||
|
@ -195,25 +198,6 @@ public class HighAvailablePool {
|
|||
agent.getHostName());
|
||||
}
|
||||
|
||||
// private void _arrangeFinishedTest(ServerStatusModel newModel,
|
||||
// String hostName) {
|
||||
// for (UUID agentRunId : _queryAgentNewFinishTest(newModel, hostName))
|
||||
// {
|
||||
// AgentRunBlotter agentRunBlotter = this.getAgentRunBlotters().get(
|
||||
// agentRunId);
|
||||
// if (agentRunBlotter == null) {
|
||||
// return;
|
||||
// }
|
||||
// RunningAgentModel runningAgentModel = agentRunBlotter
|
||||
// .getRunningAgentModel();
|
||||
// if (runningAgentModel == null) {
|
||||
// return;
|
||||
// }
|
||||
// this.agentService.backLoadToAgent(runningAgentModel.getAgent()
|
||||
// .getHostName(), runningAgentModel.getLoadInUse());
|
||||
// }
|
||||
// }
|
||||
|
||||
private List<UUID> queryUnfinishedTest(ServerStatusModel newModel,
|
||||
String hostName) {
|
||||
if (newModel == null) {
|
||||
|
@ -224,27 +208,4 @@ public class HighAvailablePool {
|
|||
return newModel.getRunningTests();
|
||||
}
|
||||
|
||||
// private List<UUID> _queryAgentNewFinishTest(ServerStatusModel newModel,
|
||||
// String hostName) {
|
||||
// ServerStatusModel previousModel = this.agentStatusOfPreviousBeatMap
|
||||
// .get(hostName);
|
||||
// List<UUID> previousFinishTestList = new ArrayList<UUID>();
|
||||
// List<UUID> currentFinishTestList = new ArrayList<UUID>();
|
||||
// List<UUID> result = new ArrayList<UUID>();
|
||||
//
|
||||
// if (previousModel == null) {
|
||||
// return newModel.getFinishedTests();
|
||||
// }
|
||||
//
|
||||
// previousFinishTestList = previousModel.getFinishedTests();
|
||||
// currentFinishTestList = newModel.getFinishedTests();
|
||||
// for (int i = 0; i < currentFinishTestList.size(); i++) {
|
||||
// if (previousFinishTestList.contains(currentFinishTestList.get(i))) {
|
||||
// continue;
|
||||
// }
|
||||
// result.add(currentFinishTestList.get(i));
|
||||
// }
|
||||
// return result;
|
||||
// }
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
package org.bench4q.master.testPlan.highavailable;
|
||||
|
||||
public class RunAgentFault implements FaultTolerance {
|
||||
public void doTolerance() {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
package org.bench4q.master.testPlan.highavailable;
|
||||
|
||||
import org.bench4q.master.testPlan.AgentRunBlotter;
|
||||
|
||||
public class StopAgentFault implements FaultTolerance {
|
||||
private AgentRunBlotter agentBlotter;
|
||||
|
||||
public AgentRunBlotter getAgentBlotter() {
|
||||
return agentBlotter;
|
||||
}
|
||||
|
||||
public void setAgentBlotter(AgentRunBlotter agentBlotter) {
|
||||
this.agentBlotter = agentBlotter;
|
||||
}
|
||||
|
||||
public StopAgentFault(AgentRunBlotter agentRunBlotter) {
|
||||
this.setAgentBlotter(agentRunBlotter);
|
||||
}
|
||||
|
||||
public void doTolerance() {
|
||||
// TODO: fulfill this function
|
||||
}
|
||||
|
||||
}
|
|
@ -113,5 +113,6 @@ public class ExecutionOverTask extends TimerTask {
|
|||
this.getTestPlanContainer().getRunningTestPlans().remove(testPlanId);
|
||||
this.getTestPlanService().handleTestPlanComplete(testPlanId);
|
||||
// TODO: remove the testPlan's other info in HA
|
||||
// eg. agentRunBlotters
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
package org.bench4q.master.test;
|
||||
|
||||
public class PolymorphismTest {
|
||||
public void shout() {
|
||||
shoutTwice();
|
||||
}
|
||||
|
||||
public void shoutTwice() {
|
||||
System.out.println("aaaaaa");
|
||||
System.out.println("aaaaaa");
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
PolymorphismTest poly = new ChildTest();
|
||||
System.out.println("poly shout is ");
|
||||
poly.shout();
|
||||
|
||||
ChildTest childTest = new ChildTest();
|
||||
System.out.println("child shout is ");
|
||||
childTest.shout();
|
||||
}
|
||||
}
|
||||
|
||||
class ChildTest extends PolymorphismTest {
|
||||
public void shoutTwice() {
|
||||
System.out.println("bbbbbbb");
|
||||
System.out.println("bbbbbbb");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue