2 * Copyright (c) 2018 Ericsson India Global Services Pvt Ltd. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.netvirt.elan.utils;
11 import com.google.common.util.concurrent.ThreadFactoryBuilder;
12 import java.util.concurrent.Executors;
13 import java.util.concurrent.ScheduledExecutorService;
14 import java.util.concurrent.ThreadFactory;
15 import javax.inject.Singleton;
18 public class Scheduler implements AutoCloseable {
20 private final ThreadFactory namedThreadFactory = new ThreadFactoryBuilder()
21 .setNameFormat("elan-sched-%d").build();
23 private final ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1,
26 public ScheduledExecutorService getScheduledExecutorService() {
27 return scheduledExecutorService;
32 scheduledExecutorService.shutdown();