boB Gage wrote:
Emmanuel,
That's kind of how the original C++ code that I'm porting worked...
The various devices we use each have their own serial parameters
(baud, stop/start/partity bits et al) so all have their own
SerialAddress objects to open & close. Each device handler (ie our
code) has it's own codec factory -- so there's not a single shared one
for all the devices to be discovered (that would be way too unwieldy
for words).
I've tried re-using IoConnector objects and just change handlers, but
the IoConnector.setHandler() method (IoService.java) complains
bitterly if I assign a new handler to an existing connection.
I would have kept the same handler, just switched the codec. Creating a
new NioConnector is quite expensive.
I have eliminated the synchronized clauses as a source, and had my
Java understanding expanded in the process. :-) One of the two
unbound threads *is* caught in that quoted wait() call however.
Perhaps because we failed to flush a failed session before closing
it??? [ the notify is in a flush ]
Hmmmm... Without the code, it's difficult to say. Also, it's now 3 weeks
I didn't looked at the code, so I can't give you an decent advice atm...
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org