@Override public void delete(List<String> keys) throws FailStoreException { if (keys == null || keys.size() == 0) { return; } try { for (String key : keys) { map.remove(key); } db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
@Override public void delete(List<String> keys) throws FailStoreException { if (keys == null || keys.size() == 0) { return; } try { for (String key : keys) { map.remove(key); } db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
@Override public void delete(String key) throws FailStoreException { try { map.remove(key); // persist changes into disk db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
@Override public void delete(String key) throws FailStoreException { try { map.remove(key); // persist changes into disk db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
@Override public void put(String key, Object value) throws FailStoreException { try { String valueString = JSON.toJSONString(value); map.put(key, valueString); // persist changes into disk db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
@Override public void put(String key, Object value) throws FailStoreException { try { String valueString = JSON.toJSONString(value); map.put(key, valueString); // persist changes into disk db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
public void rollback() { this.tx.rollback(); this.txClosed = true; }
/** * Roll back database transaction. This method is a NOOP if there is no database. */ private void rollback() { if (_db == null) { return; } try { _db.rollback(); } catch (Exception e) { throw new IllegalStateException("Could not roll back transaction", e); } } }
@Override public void delete(List<String> keys) throws FailStoreException { if (keys == null || keys.size() == 0) { return; } try { for (String key : keys) { map.remove(key); } db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
@Override public void delete(String key) throws FailStoreException { try { map.remove(key); // persist changes into disk db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
@Override public void put(String key, Object value) throws FailStoreException { try { String valueString = JSON.toJSONString(value); map.put(key, valueString); // persist changes into disk db.commit(); } catch (Exception e) { db.rollback(); throw new FailStoreException(e); } }
db.rollback(); throw e;