- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中bitronix.tm.internal.XAResourceHolderState
类的一些代码示例,展示了XAResourceHolderState
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XAResourceHolderState
类的具体详情如下:
包路径:bitronix.tm.internal.XAResourceHolderState
类名称:XAResourceHolderState
[英]XAResourceHolder state container. Instances are kept in the transaction and bound to / unbound from the XAResourceHolder as the resource participates in different transactions. A XAResourceHolder without XAResourceHolderStateis considered to be in local transaction mode.
Objects of this class also expose resource specific configuration like the unique resource name.
The XAResource state during a transaction participation is also contained: assigned XID, transaction start / end state...
There is exactly one XAResourceHolderState object per XAResourceHolder per javax.transaction.Transaction.
[中]XAResourceHolder状态容器。实例保存在事务中,并与XAResourceHolder绑定/解除绑定,因为资源参与不同的事务。没有XaResourceHolderState的XAResourceHolder被视为处于本地事务模式。
此类的对象还公开特定于资源的配置,如唯一的资源名称。
事务参与期间的XAResource状态也包含在内:分配的XID、事务开始/结束状态。。。
每个XAResourceHolder每个javax正好有一个XAResourceHolderState对象。交易交易
代码示例来源:origin: ehcache/ehcache3
public XAResourceHolderState startRecovery() throws RecoveryException {
if (recoveryXAResourceHolder != null) {
throw new RecoveryException("recovery already in progress on " + this);
}
if (xaResourceHolders.isEmpty()) {
throw new RecoveryException("no XAResource registered, recovery cannot be done on " + this);
}
recoveryXAResourceHolder = new RecoveryXAResourceHolder(xaResourceHolders.values().iterator().next());
return new XAResourceHolderState(recoveryXAResourceHolder, this);
}
代码示例来源:origin: org.codehaus.btm/btm
public boolean equals(Object obj) {
if (!(obj instanceof XAResourceHolderState))
return false;
XAResourceHolderState other = (XAResourceHolderState) obj;
return equals(other.bean, bean) && equals(other.xid, xid);
}
代码示例来源:origin: bitronix/btm
public void testRemove() {
Scheduler<XAResourceHolderState> resourceScheduler = new Scheduler<XAResourceHolderState>();
XAResourceHolderState xarhs0 = new XAResourceHolderState(null, new MockResourceBean(0));
XAResourceHolderState xarhs1 = new XAResourceHolderState(null, new MockResourceBean(1));
resourceScheduler.add(xarhs0, xarhs0.getTwoPcOrderingPosition());
resourceScheduler.add(xarhs1, xarhs1.getTwoPcOrderingPosition());
resourceScheduler.remove(xarhs0);
resourceScheduler.add(xarhs0, xarhs0.getTwoPcOrderingPosition());
Iterator<XAResourceHolderState> it = resourceScheduler.iterator();
assertTrue(it.hasNext());
assertTrue(xarhs0 == it.next());
it.remove();
assertTrue(xarhs1 == it.next());
it.remove();
}
代码示例来源:origin: org.codehaus.btm/btm
XAResourceHolderState alreadyEnlistedHolder = findXAResourceHolderState(xaResourceHolderState.getXAResource());
if (alreadyEnlistedHolder != null && !alreadyEnlistedHolder.isEnded()) {
xaResourceHolderState.setXid(alreadyEnlistedHolder.getXid());
log.warn("ignoring enlistment of already enlisted but not ended resource " + xaResourceHolderState);
return;
xid = toBeJoinedHolderState.getXid();
flag = XAResource.TMJOIN;
if (flag != XAResource.TMJOIN && xaResourceHolderState.getTwoPcOrderingPosition() == Scheduler.ALWAYS_LAST_POSITION &&
!TransactionManagerServices.getConfiguration().isAllowMultipleLrc()) {
List<XAResourceHolderState> alwaysLastResources = resources.getByNaturalOrderForPosition(Scheduler.ALWAYS_LAST_POSITION);
xaResourceHolderState.setXid(xid);
xaResourceHolderState.start(flag);
resources.add(xaResourceHolderState, xaResourceHolderState.getTwoPcOrderingPosition());
代码示例来源:origin: bitronix/btm
private void forgetHeuristicCommit(XAResourceHolderState resourceHolder) {
try {
if (log.isDebugEnabled()) { log.debug("handling heuristic commit on resource " + resourceHolder.getXAResource()); }
resourceHolder.getXAResource().forget(resourceHolder.getXid());
if (log.isDebugEnabled()) { log.debug("forgotten heuristically committed resource " + resourceHolder.getXAResource()); }
} catch (XAException ex) {
String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex);
log.error("cannot forget " + resourceHolder.getXid() + " assigned to " + resourceHolder.getXAResource() +
", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
}
}
代码示例来源:origin: bitronix/btm
/**
* Resume all enlisted resources in the current transaction context.
* @throws XAException if the resource threw an exception during resume.
*/
public void resume() throws XAException {
// all XAResource needs to be re-enlisted but this must happen
// outside the Scheduler's iteration as enlist() can change the
// collection's content and confuse the iterator.
List<XAResourceHolderState> toBeReEnlisted = new ArrayList<XAResourceHolderState>();
for (XAResourceHolderState xaResourceHolderState : resources) {
if (log.isDebugEnabled()) { log.debug("resuming " + xaResourceHolderState); }
// If a prepared statement is (re-)used after suspend/resume is performed its XAResource needs to be
// re-enlisted. This must be done outside this loop or that will confuse the iterator!
toBeReEnlisted.add(new XAResourceHolderState(xaResourceHolderState));
}
if (toBeReEnlisted.size() > 0 && log.isDebugEnabled()) log.debug("re-enlisting " + toBeReEnlisted.size() + " resource(s)");
for (XAResourceHolderState xaResourceHolderState : toBeReEnlisted) {
if (log.isDebugEnabled()) { log.debug("re-enlisting resource " + xaResourceHolderState); }
try {
enlist(xaResourceHolderState);
xaResourceHolderState.getXAResourceHolder().putXAResourceHolderState(xaResourceHolderState.getXid(), xaResourceHolderState);
} catch (BitronixSystemException ex) {
throw new BitronixXAException("error re-enlisting resource during resume: " + xaResourceHolderState, XAException.XAER_RMERR, ex);
}
}
}
代码示例来源:origin: bitronix/btm
/**
* Search for an eventually already enlisted {@link XAResourceHolderState} that could be joined with the
* {@link XAResourceHolderState} passed as parameter.<br/>
* If datasource configuration property <code>bitronix.useTmJoin=false</code> is set this method always returns null.
* @param xaResourceHolderState a {@link XAResourceHolderState} looking to be joined.
* @return another enlisted {@link XAResourceHolderState} that can be joined with the one passed in or null if none is found.
* @throws XAException if call to XAResource.isSameRM() fails.
*/
private XAResourceHolderState getManagedResourceWithSameRM(XAResourceHolderState xaResourceHolderState) throws XAException {
if (!xaResourceHolderState.getUseTmJoin()) {
if (log.isDebugEnabled()) { log.debug("join disabled on resource " + xaResourceHolderState); }
return null;
}
for (XAResourceHolderState alreadyEnlistedHolderState : resources) {
if (log.isDebugEnabled())
log.debug("checking joinability of " + xaResourceHolderState + " with " + alreadyEnlistedHolderState);
if (alreadyEnlistedHolderState.isEnded() &&
!alreadyEnlistedHolderState.isSuspended() &&
xaResourceHolderState.getXAResource().isSameRM(alreadyEnlistedHolderState.getXAResource())) {
if (log.isDebugEnabled()) { log.debug("resources are joinable"); }
return alreadyEnlistedHolderState;
}
if (log.isDebugEnabled()) { log.debug("resources are not joinable"); }
}
if (log.isDebugEnabled()) { log.debug("no joinable resource found for " + xaResourceHolderState); }
return null;
}
代码示例来源:origin: org.codehaus.btm/btm
protected static Set<String> collectResourcesUniqueNames(List<XAResourceHolderState> resources) {
Set<String> uniqueNames = new HashSet<String>();
for (XAResourceHolderState resourceHolderState : resources) {
uniqueNames.add(resourceHolderState.getUniqueName());
}
return uniqueNames;
}
代码示例来源:origin: bitronix/btm
/**
* Log exceptions that happened during a phase failure.
* @param ex the phase exception.
*/
protected void logFailedResources(PhaseException ex) {
List<Exception> exceptions = ex.getExceptions();
List<XAResourceHolderState> resources = ex.getResourceStates();
for (int i = 0; i < exceptions.size(); i++) {
Exception e = exceptions.get(i);
XAResourceHolderState holderState = resources.get(i);
log.error("resource " + holderState.getUniqueName() + " failed on " + holderState.getXid(), e);
}
}
代码示例来源:origin: bitronix/btm
/**
* Delist the specified {@link XAResourceHolderState}. A reference to the resource is kept anyway.
* @param xaResourceHolderState the {@link XAResourceHolderState} to be delisted.
* @param flag the delistment flag.
* @return true if the resource could be delisted, false otherwise.
* @throws XAException if the resource threw an exception during delistment.
* @throws BitronixSystemException if an internal error occured.
*/
public boolean delist(XAResourceHolderState xaResourceHolderState, int flag) throws XAException, BitronixSystemException {
if (findXAResourceHolderState(xaResourceHolderState.getXAResource()) != null) {
if (log.isDebugEnabled()) { log.debug("delisting resource " + xaResourceHolderState); }
xaResourceHolderState.end(flag);
return true;
}
log.warn("trying to delist resource that has not been previously enlisted: " + xaResourceHolderState);
return false;
}
代码示例来源:origin: org.codehaus.btm/btm
/**
* Suspend all enlisted resources from the current transaction context.
* @throws XAException if the resource threw an exception during suspend.
*/
public void suspend() throws XAException {
for (XAResourceHolderState xaResourceHolderState : resources) {
if (!xaResourceHolderState.isEnded()) {
if (log.isDebugEnabled()) log.debug("suspending " + xaResourceHolderState);
xaResourceHolderState.end(XAResource.TMSUCCESS);
}
} // while
}
代码示例来源:origin: org.codehaus.btm/btm
/**
* Remove this transaction's {@link XAResourceHolderState} from all enlisted
* {@link bitronix.tm.resource.common.XAResourceHolder}s.
*/
public void clearXAResourceHolderStates() {
if (log.isDebugEnabled()) log.debug("clearing XAResourceHolder states on " + resources.size() + " resource(s)");
Iterator<XAResourceHolderState> it = resources.iterator();
while (it.hasNext()) {
XAResourceHolderState xaResourceHolderState = it.next();
XAResourceHolder resourceHolder = xaResourceHolderState.getXAResourceHolder();
// clear out the current state
resourceHolder.removeXAResourceHolderState(xaResourceHolderState.getXid());
Map statesForGtrid = resourceHolder.getXAResourceHolderStatesForGtrid(gtrid);
if (statesForGtrid != null) log.warn("resource " + resourceHolder + " did not clean up " + statesForGtrid.size() + "transaction states for GTRID [" + gtrid + "]");
else if (log.isDebugEnabled()) log.debug("resource " + resourceHolder + " cleaned up all transaction states for GTRID [" + gtrid + "]");
it.remove();
}
}
代码示例来源:origin: bitronix/btm
@Override
public String toString() {
return "an XAResourceHolderState with uniqueName=" + bean.getUniqueName() +
" XAResource=" + getXAResource() +
(started ? " (started)":"") +
(ended ? " (ended)":"") +
(suspended ? " (suspended)":"") +
" with XID " + xid;
}
}
代码示例来源:origin: bitronix/btm
xidCount = recover(xaResourceHolderState, xids, XAResource.TMSTARTRSCAN);
} catch (XAException ex) {
if (xaResourceHolderState.getIgnoreRecoveryFailures()) {
if (log.isDebugEnabled()) { log.debug("ignoring recovery failure on resource " + xaResourceHolderState, ex); }
return Collections.emptySet();
代码示例来源:origin: bitronix/btm
public void testReverseRemove() {
Scheduler<XAResourceHolderState> resourceScheduler = new Scheduler<XAResourceHolderState>();
XAResourceHolderState xarhs0 = new XAResourceHolderState(null, new MockResourceBean(0));
XAResourceHolderState xarhs1 = new XAResourceHolderState(null, new MockResourceBean(1));
resourceScheduler.add(xarhs0, xarhs0.getTwoPcOrderingPosition());
resourceScheduler.add(xarhs1, xarhs1.getTwoPcOrderingPosition());
resourceScheduler.remove(xarhs0);
resourceScheduler.add(xarhs0, xarhs0.getTwoPcOrderingPosition());
Iterator<XAResourceHolderState> it = resourceScheduler.reverseIterator();
assertTrue(it.hasNext());
assertTrue(xarhs1 == it.next());
it.remove();
assertTrue(xarhs0 == it.next());
it.remove();
}
代码示例来源:origin: bitronix/btm
XAResourceHolderState alreadyEnlistedHolder = findXAResourceHolderState(xaResourceHolderState.getXAResource());
if (alreadyEnlistedHolder != null && !alreadyEnlistedHolder.isEnded()) {
xaResourceHolderState.setXid(alreadyEnlistedHolder.getXid());
log.warn("ignoring enlistment of already enlisted but not ended resource " + xaResourceHolderState);
return;
xid = toBeJoinedHolderState.getXid();
flag = XAResource.TMJOIN;
if (flag != XAResource.TMJOIN && xaResourceHolderState.getTwoPcOrderingPosition() == Scheduler.ALWAYS_LAST_POSITION &&
!TransactionManagerServices.getConfiguration().isAllowMultipleLrc()) {
List<XAResourceHolderState> alwaysLastResources = resources.getByNaturalOrderForPosition(Scheduler.ALWAYS_LAST_POSITION);
xaResourceHolderState.setXid(xid);
xaResourceHolderState.start(flag);
resources.add(xaResourceHolderState, xaResourceHolderState.getTwoPcOrderingPosition());
代码示例来源:origin: org.codehaus.btm/btm
private void forgetHeuristicCommit(XAResourceHolderState resourceHolder) {
try {
if (log.isDebugEnabled()) log.debug("handling heuristic commit on resource " + resourceHolder.getXAResource());
resourceHolder.getXAResource().forget(resourceHolder.getXid());
if (log.isDebugEnabled()) log.debug("forgotten heuristically committed resource " + resourceHolder.getXAResource());
} catch (XAException ex) {
String extraErrorDetails = TransactionManagerServices.getExceptionAnalyzer().extractExtraXAExceptionDetails(ex);
log.error("cannot forget " + resourceHolder.getXid() + " assigned to " + resourceHolder.getXAResource() +
", error=" + Decoder.decodeXAExceptionErrorCode(ex) + (extraErrorDetails == null ? "" : ", extra error=" + extraErrorDetails), ex);
}
}
代码示例来源:origin: org.codehaus.btm/btm
/**
* Resume all enlisted resources in the current transaction context.
* @throws XAException if the resource threw an exception during resume.
*/
public void resume() throws XAException {
// all XAResource needs to be re-enlisted but this must happen
// outside the Scheduler's iteration as enlist() can change the
// collection's content and confuse the iterator.
List<XAResourceHolderState> toBeReEnlisted = new ArrayList<XAResourceHolderState>();
for (XAResourceHolderState xaResourceHolderState : resources) {
if (log.isDebugEnabled()) log.debug("resuming " + xaResourceHolderState);
// If a prepared statement is (re-)used after suspend/resume is performed its XAResource needs to be
// re-enlisted. This must be done outside this loop or that will confuse the iterator!
toBeReEnlisted.add(new XAResourceHolderState(xaResourceHolderState));
}
if (toBeReEnlisted.size() > 0 && log.isDebugEnabled()) log.debug("re-enlisting " + toBeReEnlisted.size() + " resource(s)");
for (XAResourceHolderState xaResourceHolderState : toBeReEnlisted) {
if (log.isDebugEnabled()) log.debug("re-enlisting resource " + xaResourceHolderState);
try {
enlist(xaResourceHolderState);
xaResourceHolderState.getXAResourceHolder().putXAResourceHolderState(xaResourceHolderState.getXid(), xaResourceHolderState);
} catch (BitronixSystemException ex) {
throw new BitronixXAException("error re-enlisting resource during resume: " + xaResourceHolderState, XAException.XAER_RMERR, ex);
}
}
}
代码示例来源:origin: org.codehaus.btm/btm
/**
* Search for an eventually already enlisted {@link XAResourceHolderState} that could be joined with the
* {@link XAResourceHolderState} passed as parameter.<br/>
* If datasource configuration property <code>bitronix.useTmJoin=false</code> is set this method always returns null.
* @param xaResourceHolderState a {@link XAResourceHolderState} looking to be joined.
* @return another enlisted {@link XAResourceHolderState} that can be joined with the one passed in or null if none is found.
* @throws XAException if call to XAResource.isSameRM() fails.
*/
private XAResourceHolderState getManagedResourceWithSameRM(XAResourceHolderState xaResourceHolderState) throws XAException {
if (!xaResourceHolderState.getUseTmJoin()) {
if (log.isDebugEnabled()) log.debug("join disabled on resource " + xaResourceHolderState);
return null;
}
for (XAResourceHolderState alreadyEnlistedHolderState : resources) {
if (log.isDebugEnabled())
log.debug("checking joinability of " + xaResourceHolderState + " with " + alreadyEnlistedHolderState);
if (alreadyEnlistedHolderState.isEnded() &&
!alreadyEnlistedHolderState.isSuspended() &&
xaResourceHolderState.getXAResource().isSameRM(alreadyEnlistedHolderState.getXAResource())) {
if (log.isDebugEnabled()) log.debug("resources are joinable");
return alreadyEnlistedHolderState;
}
if (log.isDebugEnabled()) log.debug("resources are not joinable");
}
if (log.isDebugEnabled()) log.debug("no joinable resource found for " + xaResourceHolderState);
return null;
}
代码示例来源:origin: bitronix/btm
protected static Set<String> collectResourcesUniqueNames(List<XAResourceHolderState> resources) {
Set<String> uniqueNames = new HashSet<String>();
for (XAResourceHolderState resourceHolderState : resources) {
uniqueNames.add(resourceHolderState.getUniqueName());
}
return uniqueNames;
}
本文整理了Java中bitronix.tm.internal.XAResourceHolderState类的一些代码示例,展示了XAResourceHolderState类的具体用法。这些代码示例主要
我的一个应用程序有问题。该应用程序是一个自行编写的 Java 应用程序,它通过 JMS 连接到 50 多个不同的消息队列并使用来自这些队列的消息。 从功能的角度来看,来自不同队列的所有消息的处理工作正
我正在尝试创建事务管理器并将其与 Hibernate for Oracle 一起使用。 我的 persistence.xml 文件是: org.hibernate.ejb.Hiber
我的目标是使用 Bitronix 交易,我应该使用两种资源: 数据库 JMS 我有以下java代码: package com.mycompany.app; import java.net.URI; i
您好,我有一个使用 spring 和 hibernate 的 Java web 应用程序。 我有一个名为Role 的模型类。对于所有模型类,都有通用的 GenericDao.java public i
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.isFailed()方法的一些代码示例,展示了XAResourceHolderState.is
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.getTwoPcOrderingPosition()方法的一些代码示例,展示了XAResour
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.isSuspended()方法的一些代码示例,展示了XAResourceHolderState
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.start()方法的一些代码示例,展示了XAResourceHolderState.start
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.getXAResource()方法的一些代码示例,展示了XAResourceHolderSta
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.getUseTmJoin()方法的一些代码示例,展示了XAResourceHolderStat
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.setXid()方法的一些代码示例,展示了XAResourceHolderState.setX
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.end()方法的一些代码示例,展示了XAResourceHolderState.end()的具
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.setTransactionTimeoutDate()方法的一些代码示例,展示了XAResou
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.getIgnoreRecoveryFailures()方法的一些代码示例,展示了XAResou
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.isEnded()方法的一些代码示例,展示了XAResourceHolderState.isE
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.getUniqueName()方法的一些代码示例,展示了XAResourceHolderSta
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.getXid()方法的一些代码示例,展示了XAResourceHolderState.getX
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.equals()方法的一些代码示例,展示了XAResourceHolderState.equa
本文整理了Java中bitronix.tm.internal.XAResourceHolderState.getXAResourceHolder()方法的一些代码示例,展示了XAResourceHol
我是一名优秀的程序员,十分优秀!