我正在使用jpos 2.1.0,其中我正在为iso8583客户端使用外部打包程序xml文件。由于两到三天内的大量请求,我遇到了“打开太多文件”,并且设置了ulimit -n =50000。我怀疑由于超出了此限制,打包程序文件没有被正确关闭。请帮助我正确关闭打开的文件。
JposLogger logger = new JposLogger(isoLogLocation);
org.jpos.iso.ISOPackager customPackager = new GenericPackager(isoPackagerLocation+iso8583Properties.getPackager());
BaseChannel channel = new ASCIIChannel(iso8583Properties.getServerIp(), Integer.parseInt(iso8583Properties.getServerPort()), customPackager);
logger.jposlogconfig(channel);
try {
channel.setTimeout(45000);
channel.connect();
}catch(Exception ex) {
log4j.error(ex.getMessage());
throw new ConnectIpsException("Unable to establish connection with bank.");
}
log4j.info("Connection established using ASCIIChannel");
ISOMsg m = new ISOMsg();
m.set(0, "1200");
........
m.set(126, "connectIPS");
m.setPackager(customPackager);
log4j.info(ISOUtil.hexdump(m.pack()));
channel.send(m);
log4j.info("Message has been send");
ISOMsg r = channel.receive();
r.setPackager(customPackager);
log4j.info(ISOUtil.hexdump(r.pack()));
String actionCode = (String) r.getValue("39");
channel.disconnect();
return bancsxfr;
}
答案 0 :(得分:0)
您知道当您打开文件,套接字或通道时,需要关闭它,对吧?
我看不到尝试关闭频道的finally
。
您那里有大量泄漏。