| 457 | |
| 458 | protected: |
| 459 | void initialize() override |
| 460 | { |
| 461 | // Stop when no one cares. |
| 462 | promise.future().onDiscard(lambda::bind( |
| 463 | static_cast<void(*)(const UPID&, bool)>(terminate), self(), true)); |
| 464 | |
| 465 | // Wait until there are enough (i.e., quorum of) replicas in the |
| 466 | // network. This is because if there are less than quorum number |
| 467 | // of replicas in the network, the operation will not finish. |
| 468 | network->watch(quorum, Network::GREATER_THAN_OR_EQUAL_TO) |
| 469 | .onAny(defer(self(), &Self::watched, lambda::_1)); |
| 470 | } |
| 471 | |
| 472 | void finalize() override |
| 473 | { |