List of usage examples for org.apache.commons.pool2 KeyedObjectPool close
void close();
From source file:org.openhab.io.transport.modbus.internal.ModbusManagerImpl.java
@Deactivate protected void deactivate() { synchronized (this) { KeyedObjectPool<ModbusSlaveEndpoint, ModbusSlaveConnection> connectionPool = this.connectionPool; if (connectionPool != null) { Set<@NonNull PollTask> polls = getRegisteredRegularPolls(); for (PollTask task : polls) { unregisterRegularPoll(task); }/*from www .java 2 s. c om*/ connectionPool.close(); this.connectionPool = connectionPool = null; } if (monitorFuture != null) { monitorFuture.cancel(true); monitorFuture = null; } // Note that it is not allowed to shutdown the executor, since they will be reused when // when pool is received from ThreadPoolManager is called scheduledThreadPoolExecutor = null; connectionFactory = null; logger.debug("Modbus manager deactivated"); } }