本文整理了Java中com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.<init>()
方法的一些代码示例,展示了XAResourceRecord.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XAResourceRecord.<init>()
方法的具体详情如下:
包路径:com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord
类名称:XAResourceRecord
方法名:<init>
[英]The params represent specific parameters we need to recreate the connection to the database in the event of a failure. If they're not set then recovery is out of our control. Could also use it to pass other information, such as the readonly flag.
[中]参数表示在发生故障时重新创建与数据库的连接所需的特定参数。如果它们没有被设定,那么复苏就失去了我们的控制。还可以使用它传递其他信息,例如只读标志。
代码示例来源:origin: jboss.jbossts/jbossjts
public static AbstractRecord create()
{
return new XAResourceRecord();
}
代码示例来源:origin: org.jboss.jbossts/jbossjta
/**
* Attempt to create an AbstractRecord wrapping the given XAResource. Return null if this fails, or
* is diallowed by the current configuration of multiple last resource behaviour.
*
* @param xaRes
* @param params
* @param xid
* @return
*/
private AbstractRecord createRecord(XAResource xaRes, Object[] params, Xid xid)
{
final AbstractRecord record;
if ((xaRes instanceof LastResourceCommitOptimisation)
|| ((LAST_RESOURCE_OPTIMISATION_INTERFACE != null) && LAST_RESOURCE_OPTIMISATION_INTERFACE
.isInstance(xaRes)))
{
record = new LastResourceRecord(new XAOnePhaseResource(xaRes, xid, params));
}
else
{
record = new XAResourceRecord(this, xaRes, xid, params);
}
return record;
}
代码示例来源:origin: jboss.jbossts/jbossjts
/**
* Attempt to create an AbstractRecord wrapping the given XAResource. Return null if this fails, or
* is diallowed by the current configuration of multiple last resource behaviour.
*
* @param xaRes
* @param params
* @param xid
* @return
*/
private AbstractRecord createRecord(XAResource xaRes, Object[] params, Xid xid)
{
final AbstractRecord record;
if ((xaRes instanceof LastResourceCommitOptimisation)
|| ((LAST_RESOURCE_OPTIMISATION_INTERFACE != null) && LAST_RESOURCE_OPTIMISATION_INTERFACE
.isInstance(xaRes)))
{
record = new LastResourceRecord(new XAOnePhaseResource(xaRes, xid, params));
}
else
{
record = new XAResourceRecord(this, xaRes, xid, params);
}
return record;
}
代码示例来源:origin: org.jboss.jbossts.jta/narayana-jta
return new XAResourceRecord(this, xaRes, xid, params);
代码示例来源:origin: org.jboss.narayana.jta/jta
return new XAResourceRecord(this, xaRes, xid, params);
代码示例来源:origin: jbosstm/narayana
return new XAResourceRecord(this, xaRes, xid, params);
代码示例来源:origin: jbosstm/narayana
return new XAResourceRecord(this, xaRes, xid, params);
代码示例来源:origin: org.jboss.narayana.jts/narayana-jts-idlj
return new XAResourceRecord(this, xaRes, xid, params);
代码示例来源:origin: jbosstm/narayana
SubordinateAtomicAction saa = new SubordinateAtomicAction();
saa.add(new XAResourceRecord(null, new XAResource() {
@Override
public void commit(Xid xid, boolean b) throws XAException {
代码示例来源:origin: jbosstm/narayana
XAResourceRecord xares = new XAResourceRecord(tx, res, tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.end, FailType.normal), tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.end, FailType.timeout), tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.end, FailType.XA_RBCOMMFAIL), tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.commit, FailType.heurcom), tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.commit, FailType.timeout), tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.commit, FailType.nota), tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.commit, FailType.inval), tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.commit, FailType.proto), tx.getTxId(), null);
xares = new XAResourceRecord(tx, new FailureXAResource(FailLocation.commit, FailType.rmfail), tx.getTxId(), null);
代码示例来源:origin: jbosstm/narayana
@Test
public void testValid2PC () throws Exception
{
TransactionImple tx = new TransactionImple(0);
DummyXA res = new DummyXA(false);
XAResourceRecord xares = new XAResourceRecord(tx, res, tx.getTxId(), null);
assertEquals(xares.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(xares.topLevelCommit(), TwoPhaseOutcome.FINISH_OK);
}
代码示例来源:origin: jbosstm/narayana
@Test
public void testRecover () throws Exception
{
ArrayList<String> r = new ArrayList<String>();
TransactionImple tx = new TransactionImple(0);
assertTrue(tx.enlistResource(new RecoveryXAResource()));
assertEquals(tx.doPrepare(), TwoPhaseOutcome.PREPARE_OK);
r.add("com.hp.mwtests.ts.jta.recovery.DummyXARecoveryResource");
jtaPropertyManager.getJTAEnvironmentBean().setXaResourceRecoveryClassNames(r);
XARecoveryModule xarm = new XARecoveryModule();
assertNull(xarm.getNewXAResource( new XAResourceRecord(null, null, new XidImple(), null) ));
for (int i = 0; i < 11; i++)
{
xarm.periodicWorkFirstPass();
xarm.periodicWorkSecondPass();
}
assertTrue(xarm.getNewXAResource( new XAResourceRecord(null, null, new XidImple(new Uid()), null) ) == null);
assertNull(xarm.getNewXAResource( new XAResourceRecord(null, null, new XidImple(), null) ));
}
代码示例来源:origin: jbosstm/narayana
assertEquals(AddOutcome.AR_ADDED, aa.add(new XAResourceRecord(null, new XARRTestResource(), new XidImple(aa), null)));
代码示例来源:origin: jbosstm/narayana
@Test
public void testNested () throws Exception
{
XAResourceRecord xares = new XAResourceRecord();
assertEquals(xares.nestedOnePhaseCommit(), TwoPhaseOutcome.FINISH_ERROR);
assertEquals(xares.nestedPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(xares.nestedCommit(), TwoPhaseOutcome.FINISH_OK);
assertEquals(xares.nestedAbort(), TwoPhaseOutcome.FINISH_OK);
}
}
代码示例来源:origin: jbosstm/narayana
@Test
public void testCommitFailure () throws Exception
{
FailureXAResource fxa = new FailureXAResource(FailureXAResource.FailLocation.commit);
TransactionImple tx = new TransactionImple(0);
XAResourceRecord xares = new XAResourceRecord(tx, fxa, tx.getTxId(), null);
assertEquals(xares.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(xares.topLevelCommit(), TwoPhaseOutcome.HEURISTIC_MIXED);
assertTrue(xares.forgetHeuristic());
}
代码示例来源:origin: jbosstm/narayana
@Test
public void test () throws Exception
{
XAResourceRecord xares = new XAResourceRecord();
Object obj = new Object();
xares.setValue(obj);
assertTrue(xares.value() != obj);
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
xares = new XAResourceRecord(new TransactionImple(0), new DummyXA(false), new XidImple(new Uid()), params);
assertTrue(xares.type() != null);
xares.merge(xares);
xares.replace(xares);
assertTrue(xares.toString() != null);
}
代码示例来源:origin: jbosstm/narayana
@Test
public void testRollbackFailure () throws Exception
{
FailureXAResource fxa = new FailureXAResource(FailureXAResource.FailLocation.rollback);
TransactionImple tx = new TransactionImple(0);
XAResourceRecord xares = new XAResourceRecord(tx, fxa, tx.getTxId(), null);
assertEquals(xares.topLevelPrepare(), TwoPhaseOutcome.PREPARE_OK);
assertEquals(xares.topLevelAbort(), TwoPhaseOutcome.HEURISTIC_MIXED);
assertTrue(xares.forgetHeuristic());
}
代码示例来源:origin: jbosstm/narayana
@Test
public void testInvalid () throws Exception
{
XAResourceRecord xares = new XAResourceRecord();
assertEquals(xares.getXid(), null);
assertEquals(xares.value(), null);
assertEquals(xares.topLevelOnePhaseCommit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
assertEquals(xares.topLevelPrepare(), TwoPhaseOutcome.PREPARE_NOTOK);
assertEquals(xares.topLevelAbort(), TwoPhaseOutcome.FINISH_ERROR);
assertEquals(xares.topLevelCommit(), TwoPhaseOutcome.FINISH_ERROR);
}
代码示例来源:origin: jbosstm/narayana
@Test
public void testReadonly () throws Exception
{
XAResourceRecord xares;
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
xares = new XAResourceRecord(new TransactionImple(0), new TestResource(true), new XidImple(new Uid()), params);
assertEquals(xares.topLevelCommit(), TwoPhaseOutcome.NOT_PREPARED);
assertEquals(xares.topLevelPrepare(), TwoPhaseOutcome.PREPARE_READONLY);
}
代码示例来源:origin: jbosstm/narayana
@Test
public void testPackUnpack () throws Exception
{
XAResourceRecord xares;
DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
Object[] params = new Object[1];
params[XAResourceRecord.XACONNECTION] = rc;
xares = new XAResourceRecord(new TransactionImple(0), new DummyXA(false), new XidImple(new Uid()), params);
OutputObjectState os = new OutputObjectState();
assertTrue(xares.save_state(os, ObjectType.ANDPERSISTENT));
InputObjectState is = new InputObjectState(os);
assertTrue(xares.restore_state(is, ObjectType.ANDPERSISTENT));
xares = new XAResourceRecord(new TransactionImple(0), new DummyXA(false), new XidImple(new Uid()), null);
os = new OutputObjectState();
assertTrue(xares.save_state(os, ObjectType.ANDPERSISTENT));
is = new InputObjectState(os);
assertTrue(xares.restore_state(is, ObjectType.ANDPERSISTENT));
}
内容来源于网络,如有侵权,请联系作者删除!