 <p>I recommend using a <a href="https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html" rel="nofollow">ScheduledThreadPoolExecutor</a> with a core pool size of <code>1</code> and optionally with a thread priority of <code>Thread.NORM_PRIORITY + 1</code> (use a <a href="https://guava-libraries.googlecode.com/svn/tags/release05/javadoc/com/google/common/util/concurrent/ThreadFactoryBuilder.html" rel="nofollow">ThreadFactoryBuilder</a> to create a <code>ThreadFactory</code> with higher than standard priority) for the UI thread - this will let you schedule tasks such as the counter increment using <code>ScheduledThreadPoolExecutor#scheduleAtFixedRate</code>. Don't execute anything other than UI tasks on this executor - execute your CPU tasks on a separate <code>ThreadPoolExecutor</code> with standard priority; if you have e.g. 16 logical cores then create a <code>ThreadPoolExecutor</code> with 16 core threads to make full use of your computer when the UI thread is idle, and let the virtual machine take care of ensuring that the UI thread executes its jobs when it's supposed to.</p>