| 292 | |
| 293 | protected: |
| 294 | void initialize() override |
| 295 | { |
| 296 | // Stop when no one cares. |
| 297 | promise.future().onDiscard(lambda::bind( |
| 298 | static_cast<void(*)(const UPID&, bool)>(terminate), self(), true)); |
| 299 | |
| 300 | // Wait until there are enough (i.e., quorum of) replicas in the |
| 301 | // network. This is because if there are less than quorum number |
| 302 | // of replicas in the network, the operation will not finish. |
| 303 | network->watch(quorum, Network::GREATER_THAN_OR_EQUAL_TO) |
| 304 | .onAny(defer(self(), &Self::watched, lambda::_1)); |
| 305 | } |
| 306 | |
| 307 | void finalize() override |
| 308 | { |