本文整理匯總了Java中javax.transaction.xa.XAResource.XA_RDONLY屬性的典型用法代碼示例。如果您正苦於以下問題:Java XAResource.XA_RDONLY屬性的具體用法?Java XAResource.XA_RDONLY怎麽用?Java XAResource.XA_RDONLY使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類javax.transaction.xa.XAResource
的用法示例。
在下文中一共展示了XAResource.XA_RDONLY屬性的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: prepare
/**
* Prepare the transaction TODO: Store prepare results
*
* @return - the tx code
*/
@SuppressWarnings("unchecked")
public int prepare() throws IndexerException
{
boolean isPrepared = true;
boolean isModified = false;
Map<StoreRef, LuceneIndexer> indexers = (Map<StoreRef, LuceneIndexer>) AlfrescoTransactionSupport.getResource(indexersKey);
if (indexers != null)
{
for (LuceneIndexer indexer : indexers.values())
{
try
{
isModified |= indexer.isModified();
indexer.prepare();
}
catch (IndexerException e)
{
isPrepared = false;
throw new IndexerException("Failed to prepare: requires rollback", e);
}
}
}
if (isPrepared)
{
if (isModified)
{
return XAResource.XA_OK;
}
else
{
return XAResource.XA_RDONLY;
}
}
else
{
throw new IndexerException("Failed to prepare: requires rollback");
}
}
示例2: prepare
/**
* Prepare to commit At the moment this makes sure we have all the locks TODO: This is not doing proper
* serialisation against the index as would a data base transaction.
*
* @return the tx state
* @throws LuceneIndexException
*/
public int prepare() throws LuceneIndexException
{
if (s_logger.isDebugEnabled())
{
s_logger.debug(Thread.currentThread().getName() + " Starting Prepare");
}
switch (getStatus().getStatus())
{
case Status.STATUS_COMMITTING:
throw new IndexerException("Unable to prepare: Transaction is committing");
case Status.STATUS_COMMITTED:
throw new IndexerException("Unable to prepare: Transaction is commited ");
case Status.STATUS_ROLLING_BACK:
throw new IndexerException("Unable to prepare: Transaction is rolling back");
case Status.STATUS_ROLLEDBACK:
throw new IndexerException("Unable to prepare: Transaction is aleady rolled back");
case Status.STATUS_MARKED_ROLLBACK:
throw new IndexerException("Unable to prepare: Transaction is marked for roll back");
case Status.STATUS_PREPARING:
throw new IndexerException("Unable to prepare: Transaction is already preparing");
case Status.STATUS_PREPARED:
throw new IndexerException("Unable to prepare: Transaction is already prepared");
default:
try
{
setStatus(TransactionStatus.PREPARING);
if (isModified())
{
doPrepare();
if (s_logger.isDebugEnabled())
{
s_logger.debug(Thread.currentThread().getName() + " Waiting to Finish Preparing");
}
}
setStatus(TransactionStatus.PREPARED);
return isModified() ? XAResource.XA_OK : XAResource.XA_RDONLY;
}
catch (LuceneIndexException e)
{
setRollbackOnly();
if (s_logger.isDebugEnabled())
{
s_logger.debug(Thread.currentThread().getName() + " Prepare Failed", e);
}
throw new LuceneIndexException("Index failed to prepare", e);
}
catch (Throwable t)
{
// If anything goes wrong we try and do a roll back
rollback();
if (s_logger.isDebugEnabled())
{
s_logger.debug(Thread.currentThread().getName() + " Prepare Failed", t);
}
throw new LuceneIndexException("Prepared failed", t);
}
finally
{
if (s_logger.isDebugEnabled())
{
s_logger.debug(Thread.currentThread().getName() + " Ending Prepare");
}
}
}
}
示例3: prepare
public int prepare(Xid arg0) throws XAException { return XAResource.XA_RDONLY; }