To be honest I wouldn't necessarily bother using the Driver for proton-j.
It is there to allow for testing, but it should be easy enough to either do
your own I/O or use one of a number of off the shelf I/O libraries (getty,
MINA, etc). All the driver does is provide a very simplistic way to pump
bytes between a network socket and the Transport interface provided by the
engine API. It is really only a few lines of code to do this pumping
yourself though if you have a suitable I/O library available, and if you
were to do this you'd get a lot more flexibility in terms of how your
threading works. The only real constraint is that the Connection and
Transport object should only be accessed by one thread at a time.

--Rafael


On Tue, Feb 25, 2014 at 10:49 AM, Piotr Kliczewski <
piotr.kliczew...@gmail.com> wrote:

> Hello,
>
> In the java doc for Driver interface I see:
>
> "Unless otherwise stated, methods on Driver implementations are not
> necessarily thread-safe."
>
> and during testing I got:
>
> Exception in thread "Proton Reactor"
> java.util.ConcurrentModificationException
>         at
> java.util.LinkedList$ListItr.checkForComodification(LinkedList.java:953)
>         at java.util.LinkedList$ListItr.next(LinkedList.java:886)
>         at
> org.apache.qpid.proton.messenger.impl.MessengerImpl$MessageAvailable.test(MessengerImpl.java:1094)
>         at
> org.apache.qpid.proton.messenger.impl.MessengerImpl.waitUntil(MessengerImpl.java:872)
>         at
> org.apache.qpid.proton.messenger.impl.MessengerImpl.waitUntil(MessengerImpl.java:853)
>         at
> org.apache.qpid.proton.messenger.impl.MessengerImpl.recv(MessengerImpl.java:451)
>         at
> org.apache.qpid.proton.messenger.impl.MessengerImpl.recv(MessengerImpl.java:456)
>
> What is the best practice for threading when using proton-j?
>
> Piotr
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
> For additional commands, e-mail: users-h...@qpid.apache.org
>
>

Reply via email to