/** * Aborts this Transaction, reverting the state * * @param t the aborting transaction */ public synchronized void abort(Transaction t) { currentTx=null; bean.getLock().unlock(); changedAttributes.clear(); }
private void handleValidationException(Set constraintViolations) throws ConstraintViolationException { if (constraintViolations != null && !constraintViolations.isEmpty()) { Iterator<ConstraintViolation<ConfigBeanProxy>> it = constraintViolations.iterator(); StringBuilder sb = new StringBuilder(); sb.append(MessageFormat.format(i18n.getString("bean.validation.failure"), this.<ConfigBeanProxy>getProxyType().getSimpleName())); String violationMsg = i18n.getString("bean.validation.constraintViolation"); while (it.hasNext()) { ConstraintViolation cv = it.next(); sb.append(" "); sb.append(MessageFormat.format(violationMsg, cv.getMessage(), cv.getPropertyPath())); if (it.hasNext()) { sb.append(i18n.getString("bean.validation.separator")); } } bean.getLock().unlock(); throw new ConstraintViolationException(sb.toString(), constraintViolations); } }
static <T extends ConfigBeanProxy> WriteableView getWriteableView(T s, ConfigBean sourceBean) throws TransactionFailure { WriteableView f = new WriteableView(s); try { if (sourceBean.getLock().tryLock(lockTimeOutInSeconds, TimeUnit.SECONDS)) { sourceBean.setWriteableView(f); return f; } } catch(InterruptedException e) { // ignore, will throw a TransactionFailure exception } throw new TransactionFailure("Config bean already locked " + sourceBean, null); }
throw new TransactionFailure(e.getMessage(), e); } finally { bean.getLock().unlock();
handleValidation(property, newValue); } catch(Exception v) { bean.getLock().unlock(); throw new RuntimeException(v); String siblingKey = sibling.getKey(); if (newValue.equals(siblingKey)) { bean.getLock().unlock(); throw new IllegalArgumentException( "Keys cannot be duplicate. Old value of this key " +
/** * Aborts this Transaction, reverting the state * * @param t the aborting transaction */ public synchronized void abort(Transaction t) { currentTx=null; bean.getLock().unlock(); changedAttributes.clear(); }
/** * Aborts this Transaction, reverting the state * * @param t the aborting transaction */ public synchronized void abort(Transaction t) { currentTx=null; bean.getLock().unlock(); changedAttributes.clear(); }
/** * Aborts this Transaction, reverting the state * * @param t the aborting transaction */ public synchronized void abort(Transaction t) { currentTx=null; bean.getLock().unlock(); changedAttributes.clear(); }
/** * Aborts this Transaction, reverting the state * * @param t the aborting transaction */ public synchronized void abort(Transaction t) { currentTx=null; bean.getLock().unlock(); changedAttributes.clear(); }
final void apply() throws TransactionFailure { try { joinTransaction(mTransaction, mWriteable); makeChanges(); commit(mTransaction); } finally { mConfigBean.getLock().unlock(); } }
private void handleValidationException(Set constraintViolations) throws ConstraintViolationException { if (constraintViolations != null && !constraintViolations.isEmpty()) { Iterator<ConstraintViolation<ConfigBeanProxy>> it = constraintViolations.iterator(); StringBuilder sb = new StringBuilder(); sb.append(MessageFormat.format(i18n.getString("bean.validation.failure"), this.<ConfigBeanProxy>getProxyType().getSimpleName())); String violationMsg = i18n.getString("bean.validation.constraintViolation"); while (it.hasNext()) { ConstraintViolation cv = it.next(); sb.append(" "); sb.append(MessageFormat.format(violationMsg, cv.getMessage(), cv.getPropertyPath())); if (it.hasNext()) { sb.append(i18n.getString("bean.validation.separator")); } } bean.getLock().unlock(); throw new ConstraintViolationException(sb.toString(), constraintViolations); } }
private void handleValidationException(Set constraintViolations) throws ConstraintViolationException { if (constraintViolations != null && !constraintViolations.isEmpty()) { Iterator<ConstraintViolation<ConfigBeanProxy>> it = constraintViolations.iterator(); StringBuilder sb = new StringBuilder(); sb.append(MessageFormat.format(i18n.getString("bean.validation.failure"), this.<ConfigBeanProxy>getProxyType().getSimpleName())); String violationMsg = i18n.getString("bean.validation.constraintViolation"); while (it.hasNext()) { ConstraintViolation cv = it.next(); sb.append(" "); sb.append(MessageFormat.format(violationMsg, cv.getMessage(), cv.getPropertyPath())); if (it.hasNext()) { sb.append(i18n.getString("bean.validation.separator")); } } bean.getLock().unlock(); throw new ConstraintViolationException(sb.toString(), constraintViolations); } }
private void handleValidationException(Set constraintViolations) throws ConstraintViolationException { if (constraintViolations != null && !constraintViolations.isEmpty()) { Iterator<ConstraintViolation<ConfigBeanProxy>> it = constraintViolations.iterator(); StringBuilder sb = new StringBuilder(); sb.append(MessageFormat.format(i18n.getString("bean.validation.failure"), this.<ConfigBeanProxy>getProxyType().getSimpleName())); String violationMsg = i18n.getString("bean.validation.constraintViolation"); while (it.hasNext()) { ConstraintViolation cv = it.next(); sb.append(" "); sb.append(MessageFormat.format(violationMsg, cv.getMessage(), cv.getPropertyPath())); if (it.hasNext()) { sb.append(i18n.getString("bean.validation.separator")); } } bean.getLock().unlock(); throw new ConstraintViolationException(sb.toString(), constraintViolations); } }
static <T extends ConfigBeanProxy> WriteableView getWriteableView(final T s, final ConfigBean sourceBean) throws TransactionFailure { final WriteableView f = new WriteableView(s); if (sourceBean.getLock().tryLock()) { return f; } throw new TransactionFailure("Config bean already locked " + sourceBean, null); }
static <T extends ConfigBeanProxy> WriteableView getWriteableView(T s, ConfigBean sourceBean) throws TransactionFailure { WriteableView f = new WriteableView(s); try { if (sourceBean.getLock().tryLock(lockTimeOutInSeconds, TimeUnit.SECONDS)) { return f; } } catch(InterruptedException e) { // ignore, will throw a TransactionFailure exception } throw new TransactionFailure("Config bean already locked " + sourceBean, null); }
private void handleValidationException(Set constraintViolations) throws ConstraintViolationException { if (constraintViolations != null && !constraintViolations.isEmpty()) { Iterator<ConstraintViolation<ConfigBeanProxy>> it = constraintViolations.iterator(); StringBuilder sb = new StringBuilder(); sb.append(MessageFormat.format(i18n.getString("bean.validation.failure"), this.<ConfigBeanProxy>getProxyType().getSimpleName())); String violationMsg = i18n.getString("bean.validation.constraintViolation"); while (it.hasNext()) { ConstraintViolation cv = it.next(); sb.append(" "); sb.append(MessageFormat.format(violationMsg, cv.getMessage(), cv.getPropertyPath())); if (it.hasNext()) { sb.append(i18n.getString("bean.validation.separator")); } } bean.getLock().unlock(); throw new ConstraintViolationException(sb.toString(), constraintViolations); } }
static <T extends ConfigBeanProxy> WriteableView getWriteableView(T s, ConfigBean sourceBean) throws TransactionFailure { WriteableView f = new WriteableView(s); try { if (sourceBean.getLock().tryLock(lockTimeOutInSeconds, TimeUnit.SECONDS)) { return f; } } catch(InterruptedException e) { // ignore, will throw a TransactionFailure exception } throw new TransactionFailure("Config bean already locked " + sourceBean, null); }
static <T extends ConfigBeanProxy> WriteableView getWriteableView(T s, ConfigBean sourceBean) throws TransactionFailure { WriteableView f = new WriteableView(s); try { if (sourceBean.getLock().tryLock(lockTimeOutInSeconds, TimeUnit.SECONDS)) { sourceBean.setWriteableView(f); return f; } } catch(InterruptedException e) { // ignore, will throw a TransactionFailure exception } throw new TransactionFailure("Config bean already locked " + sourceBean, null); }
static <T extends ConfigBeanProxy> WriteableView getWriteableView(T s, ConfigBean sourceBean) throws TransactionFailure { WriteableView f = new WriteableView(s); try { if (sourceBean.getLock().tryLock(lockTimeOutInSeconds, TimeUnit.SECONDS)) { sourceBean.setWriteableView(f); return f; } } catch(InterruptedException e) { // ignore, will throw a TransactionFailure exception } throw new TransactionFailure("Config bean already locked " + sourceBean, null); }
throw new TransactionFailure(e.getMessage(), e); } finally { bean.getLock().unlock();