Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong getAllScheduledCount on Scheduled Executor Service #9694

tkountis opened this issue Jan 19, 2017 · 1 comment


None yet
1 participant
Copy link

commented Jan 19, 2017

@Danny-Hazelcast reported the following, which I managed to reproduce.

When scheduling on random partitions and trying to get all scheduled tasks from the service, the number of tasks is wrong. The returned figure seems to match num_of_tasks * backup_count.


    public void scheduleRandomPartitions_getAllScheduled()
            throws ExecutionException, InterruptedException {

        HazelcastInstance[] instances = createClusterWithCount(2);
        IScheduledExecutorService s = getScheduledExecutor(instances, "s");

        int expectedTotal = 11;
        for (int i=0; i < expectedTotal; i++) {
            s.schedule(new PlainCallableTask(), 0, SECONDS);

        Map<Member, List<IScheduledFuture<Double>>> allScheduled = s.getAllScheduledFutures();

        int actualTotal = 0;
        for (Member member : allScheduled.keySet()) {
            actualTotal += allScheduled.get(member).size();

        assertEquals(expectedTotal, actualTotal, 0);

The above fails with:

Expected :11.0
Actual   :22.0
 <Click to see difference>

	at org.junit.Assert.failNotEquals(
	at org.junit.Assert.assertEquals(
	at org.junit.Assert.assertEquals(
	at com.hazelcast.scheduledexecutor.ScheduledExecutorServiceBasicTest.scheduleRandomPartitions_getAllScheduled(
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(
	at java.lang.reflect.Method.invoke(
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(

@tkountis tkountis added this to the 3.8 milestone Jan 19, 2017

@tkountis tkountis self-assigned this Jan 19, 2017


This comment has been minimized.

Copy link
Contributor Author

commented Jan 19, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.