2 * Copyright (c) 2013 Cisco Systems, Inc. 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
8 package org.opendaylight.controller.config.yang.netty.threadgroup;
10 import io.netty.channel.nio.NioEventLoopGroup;
11 import java.util.concurrent.TimeUnit;
13 public class NioEventLoopGroupCloseable extends NioEventLoopGroup implements AutoCloseable {
14 private NioEventLoopGroupCloseable(int threadCount) {
18 private NioEventLoopGroupCloseable() {
23 public void close() throws Exception {
24 shutdownGracefully(0, 1, TimeUnit.SECONDS);
27 public static NioEventLoopGroupCloseable newInstance(Integer threadCount) {
28 if(threadCount == null || threadCount <= 0) {
29 return new NioEventLoopGroupCloseable();
32 return new NioEventLoopGroupCloseable(threadCount);