TestRollbackOnlyTpcallTPETIMEService.java
上传用户:xfwatch
上传日期:2020-12-14
资源大小:872k
文件大小:1k
源码类别:

中间件编程

开发平台:

Java

  1. package org.jboss.blacktie.jatmibroker.tx;
  2. import org.apache.log4j.LogManager;
  3. import org.apache.log4j.Logger;
  4. import org.jboss.blacktie.jatmibroker.xatmi.BlacktieService;
  5. import org.jboss.blacktie.jatmibroker.xatmi.Connection;
  6. import org.jboss.blacktie.jatmibroker.xatmi.ConnectionException;
  7. import org.jboss.blacktie.jatmibroker.xatmi.Response;
  8. import org.jboss.blacktie.jatmibroker.xatmi.TPSVCINFO;
  9. import org.jboss.blacktie.jatmibroker.xatmi.X_OCTET;
  10. public class TestRollbackOnlyTpcallTPETIMEService implements BlacktieService {
  11. private static final Logger log = LogManager
  12. .getLogger(TestRollbackOnlyTpcallTPETIMEService.class);
  13. public Response tpservice(TPSVCINFO svcinfo) {
  14. try {
  15. int timeout = 21;
  16. log.info("test_tpcall_TPETIME_service, sleeping for " + timeout
  17. + " seconds");
  18. Thread.sleep(timeout * 1000);
  19. log.info("test_tpcall_TPETIME_service, slept for " + timeout
  20. + " seconds");
  21. int len = 60;
  22. X_OCTET toReturn = (X_OCTET) svcinfo.tpalloc("X_OCTET", null);
  23. toReturn.setByteArray("test_tpcall_TPETIME_service".getBytes());
  24. return new Response(Connection.TPSUCCESS, 0, toReturn, len, 0);
  25. } catch (ConnectionException e) {
  26. return new Response(Connection.TPFAIL, 0, null, 0, 0);
  27. } catch (InterruptedException e) {
  28. return new Response(Connection.TPFAIL, 0, null, 0, 0);
  29. }
  30. }
  31. }