use of com.sun.jdo.api.persistence.support.JDOUnsupportedOptionException in project Payara by payara.
the class TransactionImpl method setNontransactionalRead.
public void setNontransactionalRead(boolean flag) {
//
if (isActive() && optimistic && !flag)
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages, // NOI18N
"transaction.transactionimpl.setoptimistic.notallowed"));
//
// Now get an exclusive lock so we can modify the nontransactionalRead flag.
//
persistenceManager.acquireExclusiveLock();
try {
// Cannot change flag to false inside an active optimistic tx
if (isActive() && optimistic && !flag)
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages, // NOI18N
"transaction.transactionimpl.setoptimistic.notallowed"));
this.nontransactionalRead = flag;
persistenceManager.notifyNontransactionalRead(flag);
// Adjust depending flags
if (flag == false) {
retainValues = flag;
optimistic = flag;
// Notify PM about Tx type change
persistenceManager.notifyOptimistic(flag);
}
} finally {
persistenceManager.releaseExclusiveLock();
}
}
use of com.sun.jdo.api.persistence.support.JDOUnsupportedOptionException in project Payara by payara.
the class ErrorMsg method unsupported.
/**
* Indicates that a feature is not supported by the current release.
* @param line line number
* @param col column number
* @param msg message
*/
public void unsupported(int line, int col, String msg) throws JDOUnsupportedOptionException {
JDOUnsupportedOptionException ex;
if (line > 1) {
// include line and column info
Object[] args = { context, new Integer(line), new Integer(col), msg };
ex = new JDOUnsupportedOptionException(I18NHelper.getMessage(messages, "jqlc.errormsg.generic.msglinecolumn", // NOI18N
args));
} else if (col > 0) {
// include column info
Object[] args = { context, new Integer(col), msg };
ex = new JDOUnsupportedOptionException(I18NHelper.getMessage(messages, "jqlc.errormsg.generic.msgcolumn", // NOI18N
args));
} else {
Object[] args = { context, msg };
ex = new JDOUnsupportedOptionException(I18NHelper.getMessage(messages, "jqlc.errormsg.generic.msg", // NOI18N
args));
}
logger.throwing("jqlc.ErrorMsg", "unsupported", ex);
throw ex;
}
use of com.sun.jdo.api.persistence.support.JDOUnsupportedOptionException in project Payara by payara.
the class TransactionImpl method setRetainValues.
public void setRetainValues(boolean flag) {
//
if (isActive() && !optimistic && flag)
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages, // NOI18N
"transaction.transactionimpl.setoptimistic.notallowed"));
//
// Now get an exclusive lock so we can modify the retainValues flag.
//
persistenceManager.acquireExclusiveLock();
try {
// Cannot change flag to true inside an active pessimistic tx
if (isActive() && !optimistic && flag)
throw new JDOUnsupportedOptionException(I18NHelper.getMessage(messages, // NOI18N
"transaction.transactionimpl.setoptimistic.notallowed"));
this.retainValues = flag;
// Adjust depending flags
if (flag) {
nontransactionalRead = flag;
persistenceManager.notifyNontransactionalRead(flag);
}
} finally {
persistenceManager.releaseExclusiveLock();
}
}
Aggregations