Rafael,

I implemented my own Driver as you suggested and noticed issue just after
running createConnector method.

I want to send a single message and I have single thread to receive
potential messages.
During sending the message in put(message) method getLink is run which delegates
connector creation to a driver implementation. There are few steps
done and new connection is set
to the connector. In the mean time MessageAvailable looks for any
incoming messages
by iterating through connectors taken from a driver. Unlucky part is
that before connection
is set on connector in getLink MessageAvailable tries to asses whether
there are messages
so I end up with:

Exception in thread "Proton Reactor" java.lang.NullPointerException
at 
org.apache.qpid.proton.messenger.impl.MessengerImpl$MessageAvailable.test(MessengerImpl.java:1097)
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)
at 
org.ovirt.vdsm.jsonrpc.client.reactors.proton.ProtonReactor.run(ProtonReactor.java:96)

Do you have any suggestions how to over come this issue?

Piotr


On Tue, Feb 25, 2014 at 7:27 PM, Rafael Schloming <[email protected]> wrote:
> 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 <
> [email protected]> 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: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to