@Override
 public void releaseIpAddress(String ip) {
   SearchCriteria<StorageNetworkIpAddressVO> sc = ipSearch.create();
   sc.setParameters("ipAddress", ip);
   StorageNetworkIpAddressVO vo = createForUpdate();
   vo.setTakenAt(null);
   update(vo, sc);
 }
 @Override
 @DB
 public StorageNetworkIpAddressVO takeIpAddress(long rangeId) {
   SearchCriteria<StorageNetworkIpAddressVO> sc = untakenIp.create();
   sc.setParameters("rangeId", rangeId);
   Transaction txn = Transaction.currentTxn();
   txn.start();
   StorageNetworkIpAddressVO ip = lockOneRandomRow(sc, true);
   if (ip == null) {
     txn.rollback();
     return null;
   }
   ip.setTakenAt(new Date());
   update(ip.getId(), ip);
   txn.commit();
   return ip;
 }