/*
 * jPOS Project [http://jpos.org]
 * Copyright (C) 2000-2017 jPOS Software SRL
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.jpos.util;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.ThreadFactory;

public class ConcurrentUtil {
    public static ScheduledThreadPoolExecutor newScheduledThreadPoolExecutor() {
        ScheduledThreadPoolExecutor stpe = new ScheduledThreadPoolExecutor(1,
            new ThreadFactory() {
                @Override public Thread newThread(Runnable r) {
                    Thread t = Executors.defaultThreadFactory().newThread(r);
                    t.setDaemon(true);
                    return t;
                }
            });
        stpe.setExecuteExistingDelayedTasksAfterShutdownPolicy(false);
        stpe.setContinueExistingPeriodicTasksAfterShutdownPolicy(false);
        return stpe;
    }
}

@@ -873,51 +873,8 @@
 tor;
-%0Aimport java.util.concurrent.ThreadFactory;
 %0A%0Apu
@@ -1074,102 +1074,15 @@
     
-  new ThreadFactory() %7B%0A                @Override public Thread newThread(Runnable r) %7B%0A      
+r -%3E %7B%0A
     
@@ -1163,22 +1163,16 @@
         
-  
-    
 t.setDae
@@ -1196,22 +1196,16 @@
         
-      
 return t
@@ -1210,28 +1210,8 @@
  t;%0A
-                %7D%0A  
     

use lambda