lundi 8 mars 2021

Possible alternative of java timer thread operating on 0mq socket

This is more of a design question.

I am working in existing codebase which has a core dump issue. On research I found that code is using 0mq socket which is not thread safe. There is a timer thread which runs after every min and tries to send some data over the socket. On system/webapp shutdown there will be some other thread which would close the socket and context object.

I know this is not the proper way of using 0mq sockets. Now either,

  • I stay with the timer thread and use some locks so that when timer thread is sending the data, socket should not close and if socket is closed it should no send any data.
  • or else any other alternative to to timer thread.

Any suggestions on best practices or any alternative to the timer thread in this context.

Aucun commentaire:

Enregistrer un commentaire