Why are we seeing Reentrant Decode OMMException
In the rfa_common_lib/SnapshotThread class, all Exceptions are caught and quietly eaten. If an exception was thrown and caught, the log message is not written. When I add e.printStackTrace() into the catch block, I see the following exception many times:
com.reuters.rfa.omm.OMMException: Reentrant decode
at com.reuters.rfa.internal.rwf.RwfDecoder.setupDecodeFor(Unknown Source)
at com.reuters.rfa.internal.rwf.RwfDecoder.decodeFieldEntry(Unknown Source)
at com.reuters.rfa.internal.rwf.RwfFieldListIterator.next(Unknown Source)
at com.reuters.rfa.internal.rwf.RwfFieldListIterator.next(Unknown Source)
at com.vanguard.rfa.RFASnapshot.<init>(RFASnapshot.java:88)
at com.vanguard.rfa.SnapshotThread.run(SnapshotThread.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Does anyone know what the “Reentrant decode” means?
Is Javadoc available for the Reuters RFA API?
Thanks,
Hello @robert_hau,
This com.reuters.rfa.omm.OMMException: Reentrant decode can happen in the situation that multi-threads try to decode the same OMM object.
The snippet code below shows how to replicate this exception:
public void processEvent(Event event) { if (event.getType() == Event.COMPLETION_EVENT) { System.out.println(_className + ": Receive a COMPLETION_EVENT, " + event.getHandle()); return; } System.out.println(_className + ".processEvent: Received Item Event..."); if (event.getType() != Event.OMM_ITEM_EVENT) { System.out.println("ERROR: " + _className + " Received an unsupported Event type."); _mainApp.cleanup(-1); return; } OMMItemEvent ie = (OMMItemEvent)event; OMMMsg respMsg = ie.getMsg(); for (int i=0; i<2; i++) { new DecoderThread(respMsg).start(); } } class DecoderThread extends Thread { final OMMMsg msg; public DecoderThread(OMMMsg msg) { this.msg = msg; } public void run() { OMMData payload = msg.getPayload(); for (Iterator iter = ((OMMIterable)payload).iterator(); iter.hasNext();) { OMMFieldEntry entry = (OMMFieldEntry)iter.next(); System.out.println(entry.getData()); } } }
In that case, please check and review the application source code to ensure whether it has a possibility that an OMMMsg object is decoded by multiple-threads or not.
Hope this helps.