I have an application that can run either with or without a USB CDC device attached to the machine. This device is programmed to respond to a question with a specific answer so I can detect which serial port is is connected to. The thing is, I need to know when to perform this check. I don't want to create a thread to run this check over and over again, so I need to know how to listen to a "device connected" event. I have searched it before, but maybe I'm just not using the right key words, so any help would be very nice.
Obs: I'm using Java 1.7 and the RXTX library.