* @param date The date to use for the increment.
* @throws IOException When updating the counter fails.
*/
public void incrementUsage(String shortId, RequestInfo info, long incrBy,
Date date) throws IOException {
Country country = null;
if (info != null) {
country = rm.getCountry(info.get(RequestInfo.InfoName.RemoteAddr));
}
// increment user statistics
HTable table = rm.getTable(ShortUrlTable.NAME);
byte[] rowKey = Bytes.toBytes(shortId);
Increment increment = new Increment(rowKey);
increment.addColumn(ShortUrlTable.DATA_FAMILY, ShortUrlTable.CLICKS,
incrBy);
addIncrement(increment, StatisticsCategory.CLICK, date, null, incrBy);
if (country != null) {
addIncrement(increment, StatisticsCategory.COUNTRY, date,
country.getCode(), incrBy);
}
table.increment(increment);
rm.putTable(table);
}