-->

太多的文件使用外部packager.xml文件通用包装机打开时(Too many files ope

2019-10-28 16:52发布

我使用我在哪里使用ISO8583客户外部打包的XML文件的初级专业人员2.1.0。 由于两三天大量的请求,我遇到“打开的文件太多”,我已经设置的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;
}

Answer 1:

你知道,当你打开一个文件,一个插座,或一个通道,你需要关闭它,对吗?

我没有看到finally你尝试将关闭通道。

你必须有一个巨大的泄漏。



文章来源: Too many files open when using generic packager with external packager.xml file
标签: iso8583 jpos