public boolean submit(PriorityLeaderTask task) {
        long signature = task.getSignature();
        synchronized (runningTasks) {
            if (runningTasks.containsKey(signature)) {
                return false;
            }

            try {
                PriorityFutureTask<?> future = executor.submit(task);
                runningTasks.put(signature, future);
                return true;
            } catch (RejectedExecutionException e) {
                LOG.warn("submit task {} failed.", task.getSignature(), e);
                return false;
            }
        }
    }
@Test
    public void testSubmit() {
        // submit task
        PriorityLeaderTask task1 = new TestLeaderTask(1L);
        Assert.assertTrue(executor.submit(task1));
        Assert.assertEquals(1, executor.getTaskNum());
        // submit same running task error
        Assert.assertFalse(executor.submit(task1));
        Assert.assertEquals(1, executor.getTaskNum());

        // submit another task
        PriorityLeaderTask task2 = new TestLeaderTask(2L);
        Assert.assertTrue(executor.submit(task2));
        Assert.assertEquals(2, executor.getTaskNum());

        // submit priority task
        PriorityLeaderTask task3 = new TestLeaderTask(3L, 1);
        Assert.assertTrue(executor.submit(task3));
        Assert.assertEquals(3, executor.getTaskNum());

        // submit priority task
        PriorityLeaderTask task4 = new TestLeaderTask(4L);
        Assert.assertTrue(executor.submit(task4));
        Assert.assertEquals(4, executor.getTaskNum());

        Assert.assertTrue(executor.updatePriority(4L, 5));

        // wait for tasks run to end
        try {
            Thread.sleep(2000);
            Assert.assertEquals(0, executor.getTaskNum());
        } catch (InterruptedException e) {
            LOG.error("error", e);
        }

        Assert.assertEquals(4, SEQ.size());
        Assert.assertEquals(1L, SEQ.get(0).longValue());
        Assert.assertEquals(4L, SEQ.get(1).longValue());
        Assert.assertEquals(3L, SEQ.get(2).longValue());
        Assert.assertEquals(2L, SEQ.get(3).longValue());
    }