[ 
https://issues.apache.org/jira/browse/HTTPCORE-48?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513218
 ] 

Oleg Kalnichevski commented on HTTPCORE-48:
-------------------------------------------

> I think an acceptable solution could be this: on NEED_TASK status inside 
> doHandshake, delegate the job to a thread (managed by 
> an executor), once this job finished, set a flag or something similar on the 
> session that requested the handshaking. Then all method 
> in SSLIOSession (except bind) before do anything, check this "completion 
> flag" if it's setted, else return null or throw an exception.

Hi Andrea,

Yes, I think this is the way to go. 

> The only problem is when the SSL client/server dispatcher calls another 
> method, before bind phase completion, this should fail (and 
> the caller manage properly this case), or should be designed some mechanism 
> to store this pending call somewhere, and invoke in 
> the executor thread after the handshaking phase has finished?! 

Actually I think it is all much simpler. If the I/O session is in the NEED_TASK 
state, read / write operations can simply return 0 to indicate that no data has 
been sent / received. Not taking any action is perfectly valid for non-blocking 
I/O operations. 

Oleg

> Make SSL IOSession decorator to use an Executor interface to execute all 
> potentially blocking handshake tasks
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: HTTPCORE-48
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-48
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore NIO
>            Reporter: Oleg Kalnichevski
>             Fix For: 4.0-beta1
>
>
> Presently the SSL IOSession decorator executes all potentially blocking 
> handshake tasks on the I/O thread. Use an Executor interface from 
> java.util.concurrent to make possible the execution of handshake tasks using 
> worker threads, thus making the I/O thread available for processing I/O 
> events even if some SSL connections are blocked pending completion of a 
> handshake task.
> Oleg

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to