[ 
https://issues.apache.org/jira/browse/PROTON-1718?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16309971#comment-16309971
 ] 

Robbie Gemmell commented on PROTON-1718:
----------------------------------------

The reactor is expressly single threaded other than the wakeup method, you cant 
safely use it or its directly associated transport/connection-related objects 
from multiple threads at the same time. If you are using the run() method, then 
that thread is the only one that can use/update them, except to call wakeup, 
and if you block the reactor thread itself (e.g with a sleep) during operation 
for extended periods then it wont be able to actually send or receive anything 
further on the wire while thats happening.

When you 'send' for sasl (which doesnt actually send anything on the wire 
immediately, only later when the IO processing occurs) is indeed important 
since any IO work is only done explicitly at a stage of the thread processing 
the reactor (which is often after processing received data off the wire). The 
reactor model somewhat hides the engine and the IO mechanics from you, so while 
the proton engine API as originally created allows doing all this SASL stuff 
fairly simply, having the reactor API wrapped around it makes it difficult to 
use in this scenario. More so if you are trying to use multiple threads on top.

If you want to involve other threads you will need to coordinate between them. 
One way would appear to be scheduling a Handler of onTimerTask on the reactor 
that then completes the work when fired, or perhaps another would be calling 
the reactor wakeup and having an onReactorQuiesced handler somewhere able to 
process any work when called prior to it going back to blocking on its selector 
(or periodically since it wakes itself up every so often; a few seconds by 
default I think). A further option still might be adding your own 'Selectable' 
to the reactor and having that perform the desired processing as its called.

> (Proton-J) Custom Sasl
> ----------------------
>
>                 Key: PROTON-1718
>                 URL: https://issues.apache.org/jira/browse/PROTON-1718
>             Project: Qpid Proton
>          Issue Type: Improvement
>          Components: proton-j
>    Affects Versions: proton-j-0.24.0
>            Reporter: Tim Taylor
>              Labels: features
>
> I would like to be able to provide a custom SASL implementation for Proton-j 
> to use instead of being forced to use the default SaslImpl.java 
> implementation.
> Ideally, code like below would be possible
> private class CustomSasl implements org.apache.qpid.proton.engine.Sasl
> {
> ...
> }
> ...
> ...
> //transport.sasl(...) saves the provided sasl implementation and uses it 
> internally
> Sasl sasl = transport.sasl(new CustomSasl());
> Do you currently have a workaround that would allow me to use Proton-J this 
> way?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to