@Test public void synchronizationOnDemandCollisionWithPosts() throws Throwable { setUp(this.nodeCount); this.host.joinNodesAndVerifyConvergence(this.host.getPeerCount()); this.host.setNodeGroupQuorum(this.nodeCount); this.host.waitForNodeGroupConvergence(this.nodeCount); URI factoryUri = UriUtils.buildUri(this.host.getPeerHost(), ExampleService.FACTORY_LINK); waitForReplicatedFactoryServiceAvailable(factoryUri, this.replicationNodeSelector); String taskPath = UriUtils.buildUriPath( SynchronizationTaskService.FACTORY_LINK, UriUtils.convertPathCharsFromLink(ExampleService.FACTORY_LINK)); VerificationHost owner = this.host.getOwnerPeer(ExampleService.FACTORY_LINK); this.host.log(Level.INFO, "Owner of synch-task is %s", owner.getId()); URI taskUri = UriUtils.buildUri(owner, taskPath); SynchronizationTaskService.State taskState = this.host.getServiceState( null, SynchronizationTaskService.State.class, taskUri); long membershipUpdateTimeMicros = taskState.membershipUpdateTimeMicros; ExampleServiceState state = new ExampleServiceState(); state.name = "testing"; TestContext ctx = this.host.testCreate(this.serviceCount * 10); for (int i = 0; i < this.serviceCount * 10; i++) { if (i == 5) { startSynchronizationTaskAndWait(owner, ExampleService.FACTORY_LINK, ExampleServiceState.class, membershipUpdateTimeMicros + 1); } Operation post = Operation .createPost(factoryUri) .setBody(state) .setReferer(this.host.getUri()) .setCompletion(ctx.getCompletion()); this.host.sendRequest(post); } ctx.await(); }
@Override public URI getUri() { if (this.uri == null) { this.uri = super.getUri(); } return this.uri; }
NodeGroupService extends StatefulService { @Override public URI getUri() { if (this.uri == null) { this.uri = super.getUri(); } return this.uri; } }
NodeGroupService extends StatefulService { @Override public URI getUri() { if (this.uri == null) { this.uri = super.getUri(); } return this.uri; } NodeGroupService(); }
NodeGroupService extends StatefulService { @Override public URI getUri() { if (this.uri == null) { this.uri = super.getUri(); } return this.uri; } NodeGroupService(); @Override URI getUri(); @Override void handleStart(Operation startPost); @Override void handleGet(Operation get); @Override void handlePatch(Operation patch); @Override void handlePost(Operation post); @Override void handleMaintenance(Operation maint); void handleGossipPatchCompletion(long sendTimeMicros, Operation maint, Operation patch,
            Throwable e,
            NodeGroupState localState, NodeGroupState patchBody, AtomicInteger remaining,
            NodeState remotePeer); }
NodeGroupService extends StatefulService { @Override public URI getUri() { if (this.uri == null) { this.uri = super.getUri(); } return this.uri; } NodeGroupService(); @Override URI getUri(); @Override void handleStart(Operation startPost); @Override void handleGet(Operation get); @Override void handlePatch(Operation patch); @Override void handlePost(Operation post); @Override void handleMaintenance(Operation maint); void handleGossipPatchCompletion(long sendTimeMicros, Operation maint, Operation patch,
            Throwable e,
            NodeGroupState localState, NodeGroupState patchBody, AtomicInteger remaining,
            NodeState remotePeer); static final String STAT_NAME_JOIN_RETRY_COUNT; static final String STAT_NAME_REMOTE_FALSE_UNAVAILABLE_COUNT; static final String PROPERTY_NAME_PEER_REQUEST_TIMEOUT_MICROS; static final long PEER_REQUEST_TIMEOUT_MICROS; static final int MIN_PEER_GOSSIP_COUNT; static final String STAT_NAME_RESTARTING_SERVICES_COUNT; static final String STAT_NAME_RESTARTING_SERVICES_FAILURE_COUNT; static final String STAT_NAME_PREFIX_GOSSIP_PATCH_DURATION; }