I'm working on a project in Java, which is communicating with two serial port devices using Suns's serial port library. I must somehow keep connections to devices open all the time and handle events of them (on data revieved...). The application is interacting with user (via SOAP) and is a console application (later it might be moved to an application server, but ignore that for now).
The question is how to handle devices. For now I have a static class with two static variables that returns objects that handle the device. In that class's static constructor I open connections and set initial parameters etc. Then whenever I need a device in application, I get it by something like: Device.MyDevice, Device. MyDevice2 etc... Is there any better way of doing this or is this one ok?
Remember, I don't have problems with connecting to devices, I need architectural advice.
Thanks