private boolean hasConnections() { if (entity_count == 0) { return (false); } List<RateControlledEntity> ref = high_priority_entities; for (RateControlledEntity e : ref) { if (e.getConnectionCount(read_waiter) > 0) { return (true); } } ref = normal_priority_entities; for (RateControlledEntity e : ref) { if (e.getConnectionCount(read_waiter) > 0) { return (true); } } return (false); }
public void updateStats(Set types, Map values) { if (types.contains(AzureusCoreStats.ST_NET_READ_CONTROL_LOOP_COUNT)) { values.put(AzureusCoreStats.ST_NET_READ_CONTROL_LOOP_COUNT, new Long(loop_count)); } if (types.contains(AzureusCoreStats.ST_NET_READ_CONTROL_NP_COUNT)) { values.put(AzureusCoreStats.ST_NET_READ_CONTROL_NP_COUNT, new Long(non_progress_count)); } if (types.contains(AzureusCoreStats.ST_NET_READ_CONTROL_P_COUNT)) { values.put(AzureusCoreStats.ST_NET_READ_CONTROL_P_COUNT, new Long(progress_count)); } if (types.contains(AzureusCoreStats.ST_NET_READ_CONTROL_WAIT_COUNT)) { values.put(AzureusCoreStats.ST_NET_READ_CONTROL_WAIT_COUNT, new Long(wait_count)); } if (types.contains(AzureusCoreStats.ST_NET_READ_CONTROL_ENTITY_COUNT)) { values.put( AzureusCoreStats.ST_NET_READ_CONTROL_ENTITY_COUNT, new Long(high_priority_entities.size() + normal_priority_entities.size())); } if (types.contains(AzureusCoreStats.ST_NET_READ_CONTROL_CON_COUNT) || types.contains(AzureusCoreStats.ST_NET_READ_CONTROL_READY_CON_COUNT)) { int ready_connections = 0; int connections = 0; ArrayList[] refs = {normal_priority_entities, high_priority_entities}; for (int i = 0; i < refs.length; i++) { ArrayList ref = refs[i]; for (int j = 0; j < ref.size(); j++) { RateControlledEntity entity = (RateControlledEntity) ref.get(j); connections += entity.getConnectionCount(read_waiter); ready_connections += entity.getReadyConnectionCount(read_waiter); } } values.put(AzureusCoreStats.ST_NET_READ_CONTROL_CON_COUNT, new Long(connections)); values.put(AzureusCoreStats.ST_NET_READ_CONTROL_READY_CON_COUNT, new Long(ready_connections)); } }