+ ExecutorService es = Executors.newSingleThreadExecutor();
+ Future<?> app = es.submit(this);
+ final AbsServiceStarter<?,?> absSS = this;
+ Runtime.getRuntime().addShutdownHook(new Thread() {
+ @Override
+ public void run() {
+ absSS.access().printf(Level.INIT, "Shutting down %s:%s\n",absSS.service.app_name, absSS.service.app_version);
+ absSS.shutdown();
+ app.cancel(true);
+ }
+ });
+ if(System.getProperty("ECLIPSE", null)!=null) {
+ Thread.sleep(2000);
+ System.out.println("Service Started in Eclipse: ");
+ System.out.print(" Hit <enter> to end:");
+ try {
+ System.in.read();
+ System.exit(0);
+ } catch (IOException e) {
+ }
+ }
+