@Override
@SuppressWarnings("PMD.UseConcurrentHashMap")
public Map<String, Stats> all() throws IOException {
try {
final JdbcSession session = new JdbcSession(this.connection())
.autocommit(false);
// @checkstyle LineLength (2 lines)
final Map<String, Stats> result = session
.sql("SELECT DOMAIN, SUM(BYTES) FROM DOMAIN_STATS GROUP BY DOMAIN FOR UPDATE")
.select(STATS_ALL);
session.sql("DELETE FROM DOMAIN_STATS").execute().commit();
return result;
} catch (final SQLException ex) {
throw new IOException(ex);
}
}