Refactor for async tasks ; add 'sleep' for testing

git-svn-id: https://svn.apache.org/repos/asf/jena/branches/jena-fuseki-new-ui@1567202 13f79535-47bb-0310-9956-ffa450edef68