Executerservice submits task invokes code after time out
<p>I have below code, the doTransaction method is getting invoked after 20 seconds, could any one tell me why its taking that long to invoke doTransaction method.
Its not happening always its happening very rarely. Any help on this is appreciated.
Thanks,</p>

<pre><code>        ExecutorService service =  Executors.newSingleThreadExecutor();          

    TransactionTask task = new TransactionTask(object);
    Future&lt;Result&gt; future = service.submit(task);
    Result r = future.get(20000, TimeUnit.MILLISECONDS);


    class TransactionTask implements Callable&lt;Result&gt; {
        private Request req = null;
            public TransactionTask(Request trx){
            this.req = trx;
        }
    @Override
    public Result call() throws Exception  {
        Result o = doTransaction(req);  

        return o;

    }
    }
</code></pre>