ConfD User Community

Is there something similar to confd_fd_ready in Java tailf lib?

The ‘dpTrans’ class in ‘com.tailf.dp’ has this setSocket method…

setSocket
public void setSocket(Socket sock)
A possibility to give a specified worker socket for the transaction. The default worker socket is otherwise allocated by Dp when the transaction is created. Only use this method from within the DpTransCallback.init() method.
If this option is used the Socket needs to be connected to ConfD/NCS.

Parameters:
sock - A socket connected to ConfD/NCS.

For using this method, it requires a socket connected to confD. In my understanding, there must be something similar to confd_fd_ready in Java also, for worker threads to run callback functions. I am trying to implement something similar to the ‘ConfD_Example/intro/9c_threads/ thr_daemon.c’.

Quick check, have you seen the examples.confd/intro/java/9-threads/ThrDaemon.java example?

yes, that is using dp class to internally manage the threadpool. we wanted a little more control over assigning threads to action callbacks, so trying to use this setSocket method in init.

With the Java API, if you for example get a java.io.EOFException on the worker socket you provided to the worker thread, the worker thread will log the error. I believe that the recommended approach will be for you to write your own log4j appended that could track, log and filter at least such exceptions.