List of usage examples for org.apache.commons.pool2 KeyedObjectPool invalidateObject
void invalidateObject(K key, V obj) throws Exception;
From source file:org.openhab.io.transport.modbus.internal.ModbusManagerImpl.java
private void invalidate(ModbusSlaveEndpoint endpoint, Optional<ModbusSlaveConnection> connection) { KeyedObjectPool<ModbusSlaveEndpoint, ModbusSlaveConnection> pool = connectionPool; if (pool == null) { return;/*from w w w . j a va2 s . c o m*/ } long start = System.currentTimeMillis(); connection.ifPresent(con -> { try { pool.invalidateObject(endpoint, con); } catch (Exception e) { logger.warn("Error invalidating connection in pool for endpoint {}. Error was: {} {}", endpoint, e.getClass().getName(), e.getMessage(), e); } }); logger.trace("invalidating connection for endpoint {} took {} ms", endpoint, System.currentTimeMillis() - start); }