package hozza.network.security.threading.deadlock;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

@Component
public class DeadlockMonitor implements InitializingBean
{
    @Override
    public void afterPropertiesSet()
    {
        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
        executorService.scheduleAtFixedRate(new DeadlockMonitorTask(), 0, 5, TimeUnit.SECONDS);
        System.out.println("MONITORING DEADLOCKS");
    }
}
