java wtc_java通过wtc调用tuxedo服务超时

java通过wtc调用tuxedo返回 tperrno = 13 (TPETIME)超时错误

一开始通过调查找到一篇文章关于tuxedo的所有超时控制的,以为是ubbconfig的配置有问题,把BLOCKTIME设置很大,怎么都不行

后来终于知道了原因

原来java中如果要防止调用超时,必须使用异步调用方法tpacall而不是tpcall,并且设置最后一个参数为ApplicationToMonitorInterface.TPNOTIME

代码如下

private static TypedFML32 invoke2(String serviceName, TypedBuffer buffer) {

TuxedoConnection tuxConn = null;

TypedFML32 result = null;

CallDescriptor callDescriptor = null;

Reply reply = null;

try {

tuxConn = TxdServiceLocator.getTuxedoConnection();

System.out.println("get tuxedoConnection start "+sdFormat.format(new Date())+" serviceName="+serviceName);

callDescriptor = tuxConn.tpacall(serviceName, buffer, ApplicationToMonitorInterface.TPNOTIME);

reply = tuxConn.tpgetrply(callDescriptor, ApplicationToMonitorInterface.TPNOTIME);

if (reply != null) {

result = (TypedFML32) reply.getReplyBuffer();

}

}catch (Exception e) {

e.printStackTrace();

}finally {

if (tuxConn != null) {

tuxConn.tpterm();

}

}

return result;

}

本文链接:https://my.lmcjl.com/post/15146.html

展开阅读全文

4 评论

留下您的评论.