gpt4 book ai didi

com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource类的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 00:57:05 24 4
gpt4 key购买 nike

本文整理了Java中com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource类的一些代码示例,展示了XAOnePhaseResource类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XAOnePhaseResource类的具体详情如下:
包路径:com.arjuna.ats.internal.jta.resources.arjunacore.XAOnePhaseResource
类名称:XAOnePhaseResource

XAOnePhaseResource介绍

[英]One Phase resource wrapper for XAResources.
[中]XAResources的单阶段资源包装器。

代码示例

代码示例来源: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: jbosstm/narayana

throw generateUnpackError(new ClassNotFoundException());
throw generateUnpackError(sqle) ;
throw generateUnpackError(cnfe) ;
throw generateUnpackError(ioe) ;
throw generateUnpackError(cce) ;

代码示例来源:origin: org.jboss.narayana.jts/narayana-jts-idlj

/**
 * Commit the one phase resource.
 * @return TwoPhaseOutcome.FINISH_OK or TwoPhaseOutcome.FINISH_ERROR
 */
public int rollback()
{
  try
  {
    xaResource.rollback(xid) ;
    return TwoPhaseOutcome.FINISH_OK ;
  }
  catch (final XAException xae)
  {
    addDeferredThrowable(xae);
    jtaLogger.i18NLogger.warn_resources_arjunacore_XAOnePhaseResource_rollbackexception(XAHelper.xidToString(xid), xae);
  }
  catch (final Throwable ex)
  {
    if (jtaLogger.logger.isTraceEnabled()) {
      jtaLogger.logger.trace("XAOnePhaseResource.rollback(" + xid + ") " + ex.getMessage());
    }
  }
  return TwoPhaseOutcome.FINISH_ERROR ;
}

代码示例来源:origin: jbosstm/narayana

@Test
public void testInvalid ()
{
  XAOnePhaseResource xares = new XAOnePhaseResource();
  
  assertEquals(xares.commit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
  assertEquals(xares.rollback(), TwoPhaseOutcome.FINISH_ERROR);
}

代码示例来源:origin: jbosstm/narayana

@Test
public void testCommit ()
{
  SampleOnePhaseResource res = new SampleOnePhaseResource();
  XidImple xid = new XidImple(new Uid());
  XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
  
  assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
  assertTrue(res.onePhaseCalled());
}

代码示例来源:origin: jbosstm/narayana

@Test
  public void testPackUnpack () throws Exception
  {
    DummyXA res = new DummyXA(false);
    XidImple xid = new XidImple(new Uid());
    XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
    OutputObjectState os = new OutputObjectState();
    
    xares.pack(os);
    
    InputObjectState is = new InputObjectState(os);
    
    xares.unpack(is);
  }
}

代码示例来源:origin: jbosstm/narayana

@Test
public void testPackUnpackError () throws Exception
{
  SampleOnePhaseResource res = new SampleOnePhaseResource();
  XidImple xid = new XidImple(new Uid());
  XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
  OutputObjectState os = new OutputObjectState();
  
  try
  {
    xares.pack(os);
    
    fail();
  }
  catch (final IOException ex)
  {           
  }
}

代码示例来源:origin: jbosstm/narayana

@Test
public void testCommitHeuristic ()
{
  SampleOnePhaseResource res = new SampleOnePhaseResource(SampleOnePhaseResource.ErrorType.heurcom);
  XidImple xid = new XidImple(new Uid());
  XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
  assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
  assertTrue(res.forgetCalled());
}

代码示例来源:origin: jbosstm/narayana

@Test
public void test () throws Exception
{
  DummyRecoverableXAConnection rc = new DummyRecoverableXAConnection();
  Object[] obj = new Object[1];
  SampleOnePhaseResource res = new SampleOnePhaseResource();
  
  obj[XAResourceRecord.XACONNECTION] = rc;
  
  XAOnePhaseResource xares = new XAOnePhaseResource(res, new XidImple(new Uid()), obj);
  
  OutputObjectState os = new OutputObjectState();
  
  xares.pack(os);
  
  InputObjectState is = new InputObjectState(os);
  
  xares.unpack(is);
}

代码示例来源:origin: jbosstm/narayana

@Test
public void testCommitHeuristic ()
{
  SampleOnePhaseResource res = new SampleOnePhaseResource(ErrorType.heurcom);
  XidImple xid = new XidImple(new Uid());
  XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
  
  assertEquals(xares.commit(), TwoPhaseOutcome.FINISH_OK);
  assertTrue(res.forgetCalled());
}

代码示例来源: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/jbossjta

throw generateUnpackError(new ClassNotFoundException());
throw generateUnpackError(sqle) ;
throw generateUnpackError(cnfe) ;
throw generateUnpackError(ioe) ;
throw generateUnpackError(cce) ;

代码示例来源:origin: org.jboss.narayana.jta/jta

/**
 * Commit the one phase resource.
 * @return TwoPhaseOutcome.FINISH_OK or TwoPhaseOutcome.FINISH_ERROR
 */
public int rollback()
{
  try
  {
    xaResource.rollback(xid) ;
    return TwoPhaseOutcome.FINISH_OK ;
  }
  catch (final XAException xae)
  {
    addDeferredThrowable(xae);
    jtaLogger.i18NLogger.warn_resources_arjunacore_XAOnePhaseResource_rollbackexception(XAHelper.xidToString(xid), xae);
  }
  catch (final Throwable ex)
  {
    if (jtaLogger.logger.isTraceEnabled()) {
      jtaLogger.logger.trace("XAOnePhaseResource.rollback(" + xid + ") " + ex.getMessage());
    }
  }
  return TwoPhaseOutcome.FINISH_ERROR ;
}

代码示例来源:origin: jbosstm/narayana

@Test
  public void testRollbackHeuristic ()
  {
    SampleOnePhaseResource res = new SampleOnePhaseResource(SampleOnePhaseResource.ErrorType.heurrb);
    XidImple xid = new XidImple(new Uid());
    XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);

    assertEquals(xares.commit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
    assertTrue(res.forgetCalled());
  }
}

代码示例来源:origin: jbosstm/narayana

return new LastResourceRecord(new XAOnePhaseResource(xaRes, xid, params));

代码示例来源:origin: org.jboss.narayana.jts/narayana-jts-idlj

throw generateUnpackError(new ClassNotFoundException());
throw generateUnpackError(sqle) ;
throw generateUnpackError(cnfe) ;
throw generateUnpackError(ioe) ;
throw generateUnpackError(cce) ;

代码示例来源:origin: org.jboss.jbossts.jta/narayana-jta

/**
 * Commit the one phase resource.
 * @return TwoPhaseOutcome.FINISH_OK or TwoPhaseOutcome.FINISH_ERROR
 */
public int rollback()
{
  try
  {
    xaResource.rollback(xid) ;
    return TwoPhaseOutcome.FINISH_OK ;
  }
  catch (final XAException xae)
  {
    addDeferredThrowable(xae);
    jtaLogger.i18NLogger.warn_resources_arjunacore_XAOnePhaseResource_rollbackexception(XAHelper.xidToString(xid), xae);
  }
  catch (final Throwable ex)
  {
    if (jtaLogger.logger.isTraceEnabled()) {
      jtaLogger.logger.trace("XAOnePhaseResource.rollback(" + xid + ") " + ex.getMessage());
    }
  }
  return TwoPhaseOutcome.FINISH_ERROR ;
}

代码示例来源:origin: jbosstm/narayana

@Test
public void testRollbackHeuristic ()
{
  SampleOnePhaseResource res = new SampleOnePhaseResource(ErrorType.heurrb);
  XidImple xid = new XidImple(new Uid());
  XAOnePhaseResource xares = new XAOnePhaseResource(res, xid, null);
  
  assertEquals(xares.commit(), TwoPhaseOutcome.ONE_PHASE_ERROR);
  assertTrue(res.forgetCalled());
}

代码示例来源:origin: org.jboss.narayana.jta/jta

return new LastResourceRecord(new XAOnePhaseResource(xaRes, xid, params));

代码示例来源:origin: org.jboss.jbossts.jta/narayana-jta

throw generateUnpackError(new ClassNotFoundException());
throw generateUnpackError(sqle) ;
throw generateUnpackError(cnfe) ;
throw generateUnpackError(ioe) ;
throw generateUnpackError(cce) ;

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com