LrJposChannel.emptyMessageMap

Empties the message map that is used to measure duration.

public static void emptyMessageMap()

Return values

This function does not return any values.

General information

Some messages do not have responses, and they can accumulate on the message map, increasing memory consumption. If you expect many messages without responses, you can use this function to manually empty the map.

Example

Copy code
public void emptyMessageMap() throws Throwable {
        GenericPackager packager = new GenericPackager(PACKAGERCONFIGFILE);
        LrJposChannel.initChannel(LrJposChannel.ChannelType.ASCIIChannel, "localhost", 8000, packager);
        
        LrJposChannel.connect();
        
        LrISOMsg m = new LrISOMsg();
        m.setMTI("0100");
        m.set(ISO87Fields.PAN_PRIMARY_ACCOUNT_NUMBER, "1234567890000000000")
        m.set(3, "523456")
        m.set(4, "123456789121")
        m.set(12, "20241605108110");
        m.set(47, "32432")

        for (int i=0; i<10000; i++) {
            LrJposChannel.send(m);
            if (i%1000==0){
                LrJposChannel.emptyMessageMap();
            }
        }
        
        LrJposChannel.disconnect();
        LrJposChannel.closeChannel();
}