Ok guys, I get it.
Publication in the case, others may have the same issue.
Team:
@Override
public void execute() {
p.setCommand(this); <-- add this line
p.publishLastFive();
}
On the server of the manufacturer
public void publishLastFive() {
if (c != null) { <--- add null check
System.out.println("publishing last 5");
}
}
Command c = null;
public void setCommand(Command c) {
this.c = c;
}
public void execute() {
c.execute();
c = null; <-- once done executing, set command to null
}
Ad Result:
work:
publish5.execute();
work:
p.setCommand(publish5);
p.execute();
not working, optional
p.publishLastFive();
source
share