question

Upvotes
Accepted
1.5k 5 6 7

RFA Java: How to catch library internal error?

We've seen some unfortunate events with so called API internal errors, meaning those that are unexpected but are caught by the API itself and then reported in the log. Example:

19-Nov-2018 10:29:02.128 SEVERE
        [_Default::MPOP1 Session EventQueueGroup]
com.reuters.rfa.internal.connection.rssl.RSSLConnection.processTransportData
        com.reuters.rfa.connection.rssl._Default.MPOP1C

Caught internal exception .......
.....

In addition to reporting this to RDC we would also like to programmatically catch these events. How can this be done?

Why? We've seen the application stall in such a situation and it would seem much better to simply exit the application (possibly to let it restart) when something unexpected like that happens. The current functionality, which is to report in the log but then continue as if nothing has happened, is a dangerous path.

treprfarfa-api
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

· Write an Answer
Upvotes
Accepted
80.1k 257 52 75

@Lars-at-Addicticks

From the description, the events appear in the log. Therefore, you can create a custom log handler to catch these log events. You can refer to this example.

	public class MyLogHandler extends Handler{


		@Override
		public void publish(LogRecord record) {
			// TODO Auto-generated method stub
			System.out.println("### Log "+record.getMessage());
		}


		@Override
		public void flush() {
			// TODO Auto-generated method stub
			
		}


		@Override
		public void close() throws SecurityException {
			// TODO Auto-generated method stub
			
		}
		
	}


            Logger logger = Logger.getLogger("com.reuters.rfa");            
            
            MyLogHandler myLogHandler = new MyLogHandler();
            myLogHandler.setLevel(Level.SEVERE);
            logger.addHandler(myLogHandler);

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Thank you. This is for sure a solution. However, if there are several sessions in the same application then this solution won't tell me which of those have experienced the problem.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.