Skip to content
Snippets Groups Projects
Commit 6194941b authored by Kim Kern's avatar Kim Kern
Browse files

make AggregationContext nonnull

parent d8ea09da
Branches
No related tags found
No related merge requests found
...@@ -32,10 +32,14 @@ public class ActionAggregationCancel extends ActionAggregation { ...@@ -32,10 +32,14 @@ public class ActionAggregationCancel extends ActionAggregation {
if (isDone()) { if (isDone()) {
wallet.addExcludedNeighbor(sender); wallet.addExcludedNeighbor(sender);
} }
if (!wallet.areAllNeighborsExcluded()) { AggregationContext aggregationContext = wallet.getAggregationContext();
if (!wallet.areAllNeighborsExcluded() && !aggregationContext
.isDone()) {
continueAggregation(wallet); continueAggregation(wallet);
} else if (aggregationContext.isDone() && !wallet.areAllNeighborsExcluded()) {
sendEndMessage(wallet);
} else if (wallet.hasAggregationContext()) { } else if (wallet.hasAggregationContext()) {
sendAggregatedResult(wallet, wallet.getAggregationContext()); sendAggregatedResult(wallet, aggregationContext);
sendEndMessage(wallet); sendEndMessage(wallet);
} }
} }
......
...@@ -11,6 +11,7 @@ import akka.actor.ActorRef; ...@@ -11,6 +11,7 @@ import akka.actor.ActorRef;
import akka.actor.Props; import akka.actor.Props;
import fucoin.actions.ClientAction; import fucoin.actions.ClientAction;
import fucoin.actions.aggregation.AggregationContext; import fucoin.actions.aggregation.AggregationContext;
import fucoin.actions.aggregation.AggregationContext.AggregationContextBuilder;
import fucoin.actions.join.ActionJoin; import fucoin.actions.join.ActionJoin;
import fucoin.actions.join.ActionJoinAnswer; import fucoin.actions.join.ActionJoinAnswer;
import fucoin.actions.join.ActionTellSupervisor; import fucoin.actions.join.ActionTellSupervisor;
...@@ -29,7 +30,7 @@ public class WalletImpl extends AbstractWallet { ...@@ -29,7 +30,7 @@ public class WalletImpl extends AbstractWallet {
private transient WalletGuiControl gui; private transient WalletGuiControl gui;
private String preKnownNeighbourName; private String preKnownNeighbourName;
private boolean isActive; private boolean isActive;
private AggregationContext aggregationContext; private AggregationContext aggregationContext = new AggregationContextBuilder(null, null, amount).build();
private boolean hasPendingAggregationRequest = false; private boolean hasPendingAggregationRequest = false;
private ConcurrentLinkedQueue<ActorRef> deferedSupervisorReceivers = new ConcurrentLinkedQueue<>(); private ConcurrentLinkedQueue<ActorRef> deferedSupervisorReceivers = new ConcurrentLinkedQueue<>();
private transient final EvictingQueue<UUID> handledAggregationRequests = EvictingQueue.create(10); private transient final EvictingQueue<UUID> handledAggregationRequests = EvictingQueue.create(10);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment