public void remove(DataSource datasource) { Object[] arr = dcs.keySet().toArray(); String key, id = createId(datasource); for (int i = 0; i < arr.length; i++) { key = (String) arr[i]; if (key.startsWith(id)) { DCStack conns = dcs.get(key); conns.clear(); } } RefInteger ri = counter.get(id); if (ri != null) ri.setValue(0); else counter.put(id, new RefIntegerSync(0)); }
public void clear() { // int size=0; // remove all timed out conns try { Object[] arr = dcs.entrySet().toArray(); if (ArrayUtil.isEmpty(arr)) return; for (int i = 0; i < arr.length; i++) { DCStack conns = (DCStack) ((Map.Entry) arr[i]).getValue(); if (conns != null) conns.clear(); // size+=conns.size(); } } catch (Throwable t) { } }