提交 01b666b6 编写于 作者: L liquidsnake@sapo.pt

- Fixed a bug scattered across demos related to state management

- Added println to indicate if SMaRt created view from configuration file or fetched it from disk
上级 b9e2baec
...@@ -43,13 +43,15 @@ import bftsmart.tom.server.defaultservices.DefaultSingleRecoverable; ...@@ -43,13 +43,15 @@ import bftsmart.tom.server.defaultservices.DefaultSingleRecoverable;
*/ */
public class BFTMapServer extends DefaultSingleRecoverable { public class BFTMapServer extends DefaultSingleRecoverable {
MapOfMaps tableMap = new MapOfMaps(); MapOfMaps tableMap = null;
ServiceReplica replica = null; //ServiceReplica replica = null;
private ReplicaContext replicaContext; //private ReplicaContext replicaContext;
//The constructor passes the id of the server to the super class //The constructor passes the id of the server to the super class
public BFTMapServer(int id) { public BFTMapServer(int id) {
replica = new ServiceReplica(id, this, this);
tableMap = new MapOfMaps();
new ServiceReplica(id, this, this);
} }
public static void main(String[] args){ public static void main(String[] args){
...@@ -276,9 +278,4 @@ public class BFTMapServer extends DefaultSingleRecoverable { ...@@ -276,9 +278,4 @@ public class BFTMapServer extends DefaultSingleRecoverable {
} }
@Override
public void setReplicaContext(ReplicaContext replicaContext) {
this.replicaContext = replicaContext;
}
} }
\ No newline at end of file
...@@ -45,18 +45,13 @@ import bftsmart.tom.server.defaultservices.DefaultRecoverable; ...@@ -45,18 +45,13 @@ import bftsmart.tom.server.defaultservices.DefaultRecoverable;
public class BFTListImpl extends DefaultRecoverable { public class BFTListImpl extends DefaultRecoverable {
BFTMapList tableList = new BFTMapList(); BFTMapList tableList = new BFTMapList();
ServiceReplica replica = null; ServiceReplica replica = null;
ReplicaContext replicaCtx;
//The constructor passes the id of the server to the super class //The constructor passes the id of the server to the super class
public BFTListImpl(int id) { public BFTListImpl(int id) {
super(); super();
replica = new ServiceReplica(id, this, this); replica = new ServiceReplica(id, this, this);
} }
public void setReplicaContext(ReplicaContext replicaCtx) {
this.replicaCtx = replicaCtx;
}
public static void main(String[] args){ public static void main(String[] args){
if(args.length < 1) { if(args.length < 1) {
......
...@@ -41,7 +41,6 @@ public final class RandomServer extends DefaultRecoverable { ...@@ -41,7 +41,6 @@ public final class RandomServer extends DefaultRecoverable {
private long currentTime = -1; private long currentTime = -1;
/***********************************************************************/ /***********************************************************************/
private ServiceReplica replica; private ServiceReplica replica;
private ReplicaContext replicaContext;
public ServiceReplica getReplica() { public ServiceReplica getReplica() {
return replica; return replica;
...@@ -51,9 +50,6 @@ public final class RandomServer extends DefaultRecoverable { ...@@ -51,9 +50,6 @@ public final class RandomServer extends DefaultRecoverable {
this.replica = replica; this.replica = replica;
} }
public void setReplicaContext(ReplicaContext replicaContext) {
this.replicaContext = replicaContext;
}
public RandomServer(int id) { public RandomServer(int id) {
replica = new ServiceReplica(id, this, this); replica = new ServiceReplica(id, this, this);
......
...@@ -60,9 +60,12 @@ public class ServerViewController extends ViewController { ...@@ -60,9 +60,12 @@ public class ServerViewController extends ViewController {
super(procId, configHome); super(procId, configHome);
View cv = getViewStore().readView(); View cv = getViewStore().readView();
if(cv == null){ if(cv == null){
System.out.println("#Creating current view from configuration file");
reconfigureTo(new View(0, getStaticConf().getInitialView(), reconfigureTo(new View(0, getStaticConf().getInitialView(),
getStaticConf().getF(), getInitAdddresses())); getStaticConf().getF(), getInitAdddresses()));
}else{ }else{
System.out.println("#Using view stored on disk");
reconfigureTo(cv); reconfigureTo(cv);
} }
......
...@@ -98,6 +98,10 @@ public abstract class DefaultSingleRecoverable implements Recoverable, SingleExe ...@@ -98,6 +98,10 @@ public abstract class DefaultSingleRecoverable implements Recoverable, SingleExe
} }
private StateLog getLog() { private StateLog getLog() {
if(log == null)
initLog();
return log; return log;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册