this.key = key;
try {
cache.getAdvancedCache().getTransactionManager().begin();
boolean lockObtained = cache.getAdvancedCache().withFlags(Flag.FAIL_SILENTLY).lock(key);
if (!lockObtained) {
throw new BinaryStoreException(JcrI18n.errorLockingBinaryValue.text(key));
}
} catch (BinaryStoreException ex) {
throw ex;
} catch (Exception ex) {
throw new BinaryStoreException(JcrI18n.errorStoringBinaryValue.text(key), ex);
}
}