The Refinitiv Elektron API throws an NPE error when the scheduler is stopped for the weekend.
Consumer created :
ommConsumers = new OmmConsumer[4];
OmmConsumerConfig config = EmaFactory.createOmmConsumerConfig();
ommConsumers[threadId] =EmaFactory.createOmmConsumer(config.host(ReutersConfiguration.getHost()).username(ReutersConfiguration.getUserId()));
ElementList batch = EmaFactory.createElementList();
OmmArray array = EmaFactory.createOmmArray();
instrumentDefinitionsForThread.forEach(currency -> {
array.add(EmaFactory.createOmmArrayEntry().ascii(currency.getReutersSymbol()));
});
batch.add(EmaFactory.createElementEntry().array(EmaRdm.ENAME_BATCH_ITEM_LIST, array));
registeredClients[threadId] = new ReutersListenerAndProcessor(threadId, instrumentDefinitionsForThread);
ommConsumers[threadId].registerClient(EmaFactory.createReqMsg().serviceName(SCHEMA_NAME).payload(batch), registeredClients[threadId]);
Consumer cleanup:
IntStream.range(0, 4).filter(i -> ommConsumers[i] !=null)
.forEach(i->{ try{
ommConsumers[i].uninitialize();
} catch (Exception e) {
LOGGER.log(Level.WARNING,e);
}
});
NPE as result when cleanup is called:
com.thomsonreuters.ema.access.OmmConsumerImpl pool-2-thread-1 WARNING: loggerMsg\n ClientName: ChannelDictionary\n Severity: Warning\n Text: RDMDictionary stream was closed with status message\n streamId 3\n Reason State: Closed/Suspect/None - text: "channel down."\nloggerMsgEnd\n\n
Aug 20 17:26:22 119427 172622.476000 2970 com.thomsonreuters.ema.access.OmmConsumerImpl pool-2-thread-1 WARNING: loggerMsg\n ClientName: ChannelDictionary\n Severity: Warning\n Text: RDMDictionary stream was closed with status message\n streamId 4\n Reason State: Closed/Suspect/None - text: "channel down."\nloggerMsgEnd\n\n
119427 172632.817227 2972 Exception in thread "pool-10-thread-1" java.lang.NullPointerException
119427 172632.817319 2973 at com.thomsonreuters.ema.access.OmmBaseImpl.rsslReactorDispatchLoop(OmmBaseImpl.java:986)
119427 172632.817360 2974 at com.thomsonreuters.ema.access.OmmBaseImpl.run(OmmBaseImpl.java:1131)
119427 172632.817388 2975 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
119427 172632.817406 2976 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
119427 172632.817421 2977 at java.lang.Thread.run(Thread.java:748)