[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

thank you ,I understand how the nio select works.
but the idea I said is not right either,thank you very much !




> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Assigned] (HTTPCLIENT-1864) [OSGi] Allow to configure the OSGi client default timeouts

2017-08-02 Thread Julian Sedding (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Sedding reassigned HTTPCLIENT-1864:
--

Assignee: Julian Sedding

> [OSGi] Allow to configure the OSGi client default timeouts
> --
>
> Key: HTTPCLIENT-1864
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1864
> Project: HttpComponents HttpClient
>  Issue Type: Improvement
>  Components: HttpClient (classic)
>Affects Versions: 4.5
>Reporter: Timothee Maret
>Assignee: Julian Sedding
>Priority: Minor
> Fix For: Stuck
>
>
> The OSGI HTTP client currently comes with default connection and socket 
> timeouts.
> The default timeouts are infinite values. Those infinite timeouts imply that 
> a failing connection may hang forever wasting the associated resources and 
> potentially causing the process to stop with hardly reproducible issues.
> There already is a way to configure the timeouts per client instance. This 
> approach provides a great flexibility but it comes at the cost of I. tedious 
> and error prone configurations, II. not solving the issue once for all (new 
> components may forget to add support for timeouts).
> Allowing to configure the default globally or via the factory configuration 
> (with defaults) would give a simpler configuration overall and inherit the 
> configurable default to all consumers of the client.
> This improvement shall only applies to the OSGI client.



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

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



[jira] [Updated] (HTTPCLIENT-1864) [OSGi] Allow to configure the OSGi client default timeouts

2017-08-02 Thread Julian Sedding (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCLIENT-1864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Julian Sedding updated HTTPCLIENT-1864:
---
Labels:   (was: stuck volunteers-wanted)

> [OSGi] Allow to configure the OSGi client default timeouts
> --
>
> Key: HTTPCLIENT-1864
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1864
> Project: HttpComponents HttpClient
>  Issue Type: Improvement
>  Components: HttpClient (classic)
>Affects Versions: 4.5
>Reporter: Timothee Maret
>Assignee: Julian Sedding
>Priority: Minor
> Fix For: Stuck
>
>
> The OSGI HTTP client currently comes with default connection and socket 
> timeouts.
> The default timeouts are infinite values. Those infinite timeouts imply that 
> a failing connection may hang forever wasting the associated resources and 
> potentially causing the process to stop with hardly reproducible issues.
> There already is a way to configure the timeouts per client instance. This 
> approach provides a great flexibility but it comes at the cost of I. tedious 
> and error prone configurations, II. not solving the issue once for all (new 
> components may forget to add support for timeouts).
> Allowing to configure the default globally or via the factory configuration 
> (with defaults) would give a simpler configuration overall and inherit the 
> configurable default to all consumers of the client.
> This improvement shall only applies to the OSGI client.



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

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



[jira] [Commented] (HTTPCLIENT-1864) [OSGi] Allow to configure the OSGi client default timeouts

2017-08-02 Thread Julian Sedding (JIRA)

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

Julian Sedding commented on HTTPCLIENT-1864:


[~marett] I have an experimental bundle with support for injecting 
pre-configured HttpClient instances via OSGi service registry (install in 
addition to httpclient-osgi). Check out 
https://github.com/code-distillery/httpclient-configuration-support and let me 
know if that looks interesting. I am planning to contribute this back to the 
httpclient-osgi project once I am happy with it and when I find the time.

> [OSGi] Allow to configure the OSGi client default timeouts
> --
>
> Key: HTTPCLIENT-1864
> URL: https://issues.apache.org/jira/browse/HTTPCLIENT-1864
> Project: HttpComponents HttpClient
>  Issue Type: Improvement
>  Components: HttpClient (classic)
>Affects Versions: 4.5
>Reporter: Timothee Maret
>Priority: Minor
> Fix For: Stuck
>
>
> The OSGI HTTP client currently comes with default connection and socket 
> timeouts.
> The default timeouts are infinite values. Those infinite timeouts imply that 
> a failing connection may hang forever wasting the associated resources and 
> potentially causing the process to stop with hardly reproducible issues.
> There already is a way to configure the timeouts per client instance. This 
> approach provides a great flexibility but it comes at the cost of I. tedious 
> and error prone configurations, II. not solving the issue once for all (new 
> components may forget to add support for timeouts).
> Allowing to configure the default globally or via the factory configuration 
> (with defaults) would give a simpler configuration overall and inherit the 
> configurable default to all consumers of the client.
> This improvement shall only applies to the OSGI client.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

you are right.so i change the source code as follows:
protected void timeoutCheck(final SelectionKey key, final long now, final 
MinHoldTime minHoldTime) {
final IOSessionImpl session = (IOSessionImpl) key.attachment();
if (session != null) {
final int timeout = session.getSocketTimeout();
{color:red}if (minHoldTime.get() == 0 || minHoldTime.get() > 
timeout ) {
minHoldTime.set(timeout);
}{color}
if (timeout > 0) {
if (session.getLastAccessTime() + timeout < now) {
sessionTimedOut(session);
}
}
}
}
the red color is added by me. in this case,the timeoutCheckInterval  can be 
adjust dynamicly

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread Oleg Kalnichevski (JIRA)

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

Oleg Kalnichevski commented on HTTPCORE-480:


I suspect you misunderstand how the selector's select method is expected to 
work. It returns immediately if there is at least one channel with I/O 
interest, not at the select timeout.

Oleg

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

set selectTimeout = timeoutCheckInterval in the code is not a good idea I think 
in the code .
because when retrun from the 
 readyCount = this.selector.select(this.selectTimeout)
the timeout check is  just one of the all operations. 
the other operations could be checked every selectTimeout. but the timeout 
check is no needed every selectTimeout.
timeout check  interval can be dynamicly set by the code .
that is set the timeoutCheckInterval  = min(all sessions timeout)

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread Oleg Kalnichevski (JIRA)

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

Oleg Kalnichevski commented on HTTPCORE-480:


The timeout check applies to _all_ _active_ sessions managed by the I/O reactor 
all of which may have different timeout settings. If your application always 
uses the same timeout for all active sessions and it is known to be greater or 
equal to 10 min what you are proposing may make sense for your _specific_ 
application but is not generally applicable to all applications. Not to mention 
that the protocol layer can change the timeout settings at runtime for instance 
then executing 'expect-continue' handshake.

Oleg   

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Comment Edited] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 edited comment on HTTPCORE-480 at 8/2/17 3:19 PM:
-

you don't konw  what i mean.

I don't want to  reduce frequency of the timeout check,I just say there is no 
need to check the selectedKeys if there is no needed.
no matter what the value of the timeoutCheckInterval. because the selectTimeout 
= timeoutCheckInterval  in the code , the code :
if (keys != null) {
for (final SelectionKey key : keys) {
timeoutCheck(key, currentTime,minholdTime);
}
}
will be executed every time the timeout check. that means the key in the keys 
will be checked every time the timeout check.
for example , the session timeout set is 10 min.
but the key will be checked every 1s by default value.
but it should not be. .
if change the code as currentTime - this.lastTimeoutCheck) < 
this.timeoutCheckInterval + minholdTime.get(), the minholdTime.get() will 
return 10min.
then , the key in the keys will no be checked (of course , there is no need to 
check).

the user can set the selectTimeout as 10min. but it is not obviously as the 
user. the code should be more intelligent and modify the minholdTime.get() 
dynamicly。
you know not every user can read the source code and change the selectTimeout .


was (Author: silver9886):
you don't konw  what i mean.

I don't want to  reduce frequency of the timeout check,I just say there is no 
need to check the selectedKeys if there is no needed.
no matter what the value of the timeoutCheckInterval. because the selectTimeout 
= timeoutCheckInterval  in the code , the code :
if (keys != null) {
for (final SelectionKey key : keys) {
timeoutCheck(key, currentTime,minholdTime);
}
}
will be executed every time the timeout check. that means the key in the keys 
will be checked every time the timeout check.
for example , the session timeout set is 10 min.
but the key will be checked every 1s by default value.
but it should not be. .
if change the code as currentTime - this.lastTimeoutCheck) < 
this.timeoutCheckInterval + minholdTime.get(), the minholdTime.get() will 
return 10min.
then , the key in the keys will no be checked (of course , there is no need the 
check).

the user can set the selectTimeout as 10min. but it is not obviously as the 
user. the code should be more intelligent and modify the minholdTime.get() 
dynamicly。
you know not every user can read the source code and change the selectTimeout .

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

you don't konw  what i mean.

I don't want to  reduce frequency of the timeout check,I just say there is no 
need to check the selectedKeys if there is no needed.
no matter what the value of the timeoutCheckInterval. because the selectTimeout 
= timeoutCheckInterval  in the code , the code :
if (keys != null) {
for (final SelectionKey key : keys) {
timeoutCheck(key, currentTime,minholdTime);
}
}
will be executed every time the timeout check. that means the key in the keys 
will be checked every time the timeout check.
for example , the session timeout set is 10 min.
but the key will be checked every 1s by default value.
but it should not be. .
if change the code as currentTime - this.lastTimeoutCheck) < 
this.timeoutCheckInterval + minholdTime.get(), the minholdTime.get() will 
return 10min.
then , the key in the keys will no be checked (of course , there is no need the 
check).

the user can set the selectTimeout as 10min. but it is not obviously as the 
user. the code should be more intelligent and modify the minholdTime.get() 
dynamicly。
you know not every user can read the source code and change the selectTimeout .

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Resolved] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread Oleg Kalnichevski (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski resolved HTTPCORE-480.

Resolution: Invalid

With a reasonable value of timeoutCheckInterval, which is 1000 ms by default, 
the check is performed only after timeoutCheckInterval ms have elapsed since 
the last check, that is no often than 1 second. If you want to reduce frequency 
of the timeout check you can just increase timeoutCheckInterval.

Oleg 

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Reopened] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

silver9886 reopened HTTPCORE-480:
-

so if currentTime - this.lastTimeoutCheck) < this.timeoutCheckInterval + 
min(sessions.sockettimeout)
the code wil not iterator the keys,that is more efficiency.

am i wrong?

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

because timeoutCheckInterval = timeoutCheckInterval in the code ,  (currentTime 
- this.lastTimeoutCheck) >= this.timeoutCheckInterval will be true.so the keys 
must be iteratored every time .

but  if the currentTime - this.lastTimeoutCheck < this.timeoutCheckInterval + 
min(session.sockettimeout) ,there i{color:red}s no need to iterator the 
keys.{color}

am i clear?



> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Resolved] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread Oleg Kalnichevski (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski resolved HTTPCORE-480.

Resolution: Information Provided

bq. as the original code , (currentTime - this.lastTimeoutCheck) >= 
this.timeoutCheckInterval is true every time 

This makes no sense. You need to set a reasonable select timeout value in your 
{{IOReactorConfig}}. The select timeout parameter will be used as 
timeoutCheckInterval value. 

Oleg

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

as the original code , (currentTime - this.lastTimeoutCheck) >= 
this.timeoutCheckInterval is true every time .
so the keys must be iteratored every time . but if the currentTime - 
this.lastTimeoutCheck <  this.timeoutCheckInterval + min(session.sockettimeout) 
,there is no need to iterator the keys.

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

so if currentTime - this.lastTimeoutCheck) < this.timeoutCheckInterval + 
minholdTime.get()
the code wil not iterator the keys,that is more efficiency.

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread Oleg Kalnichevski (JIRA)

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

Oleg Kalnichevski commented on HTTPCORE-480:


Let me try it one more time. *What _exactly_ is the problem you are trying to 
solve?* 

Oleg

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

the new idea is this(i upload the diff png) :
add a protected class MinHoldTime default value is 0.
if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 
minholdTime.get()) {
if (keys != null) {
for (final SelectionKey key : keys)
{ timeoutCheck(key, currentTime,minholdTime); }
}
}
in the timeoutCheck,we can get the min sockettimeout is all sessions and change 
the minholdTime.get() return value.
protected void timeoutCheck(final SelectionKey key, final long now, final 
MinHoldTime minHoldTime) {
final IOSessionImpl session = (IOSessionImpl) key.attachment();
if (session != null) {
final int timeout = session.getSocketTimeout();
if (minHoldTime.get() == 0 || minHoldTime.get() > timeout )
{ minHoldTime.set(timeout); }
if (timeout > 0) {
if (session.getLastAccessTime() + timeout < now)
{ sessionTimedOut(session); }
}
}
}

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Updated] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

silver9886 updated HTTPCORE-480:

Attachment: AbstractIOReactor-change.png
BaseIOReactor-change.png
BaseIOReactor-add class.png

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor-change.png, BaseIOReactor-add 
> class.png, BaseIOReactor-change.png
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Updated] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

silver9886 updated HTTPCORE-480:

Attachment: (was: BaseIOReactor.java)

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Updated] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

silver9886 updated HTTPCORE-480:

Attachment: (was: AbstractIOReactor.java)

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Comment Edited] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 edited comment on HTTPCORE-480 at 8/2/17 1:14 PM:
-


the new idea is this(i update the attach .java file) :
add a protected class MinHoldTime default value is 0.
if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval 
+ minholdTime.get()) {
if (keys != null) {
for (final SelectionKey key : keys) {
timeoutCheck(key, currentTime,minholdTime);
}
}
}
in the timeoutCheck,we can get the min sockettimeout is all sessions and change 
the minholdTime.get() return value.
protected void timeoutCheck(final SelectionKey key, final long now, final 
MinHoldTime minHoldTime) {
final IOSessionImpl session = (IOSessionImpl) key.attachment();
if (session != null) {
final int timeout = session.getSocketTimeout();
if (minHoldTime.get() == 0 || minHoldTime.get() > timeout ) {
minHoldTime.set(timeout);
}
if (timeout > 0) {
if (session.getLastAccessTime() + timeout < now) {
sessionTimedOut(session);
}
}
}
}
 


was (Author: silver9886):
when return from readyCount = this.selector.select(this.selectTimeout); the 
time has elapsed (this.selectTimeout default is 1s). 
when the code execute the code if( (currentTime - this.lastTimeoutCheck) >= 
this.timeoutCheckInterval) the time is elapsed larger than (this.selectTimeout 
default is 1s).
beacuse the pc need the time to execute the code between readyCount = 
this.selector.select(this.selectTimeout); and if( (currentTime - 
this.lastTimeoutCheck) >= this.timeoutCheckInterval)
so currentTime - this.lastTimeoutCheck >= this.timeoutCheckInterval will always 
return true(because timeoutCheckInterval=selectTimeout ).
I think if there is no post/get request , the currentTime - 
this.lastTimeoutCheck should no be true.
suppose the time executed elapsed between 
readyCount = this.selector.select(this.selectTimeout); and if( (currentTime - 
this.lastTimeoutCheck) >= this.timeoutCheckInterval) 
at last need 1 millisecond.

the new idea is this(i update the attach .java file) :
add a protected class MinHoldTime default value is 1 (means at last 1 
millisecond).
if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval 
+ minholdTime.get()) {
if (keys != null) {
for (final SelectionKey key : keys) {
timeoutCheck(key, currentTime,minholdTime);
}
}
}
in the timeoutCheck,we can get the min sockettimeout is all sessions and change 
the minholdTime.get() return value.
protected void timeoutCheck(final SelectionKey key, final long now, final 
MinHoldTime minHoldTime) {
final IOSessionImpl session = (IOSessionImpl) key.attachment();
if (session != null) {
final int timeout = session.getSocketTimeout();
if (minHoldTime.get() == 1 || minHoldTime.get() > timeout ) {
minHoldTime.set(timeout);
}
if (timeout > 0) {
if (session.getLastAccessTime() + timeout < now) {
sessionTimedOut(session);
}
}
}
}
 

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor.java, BaseIOReactor.java
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Updated] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread Oleg Kalnichevski (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski updated HTTPCORE-480:
---
Priority: Minor  (was: Major)

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Minor
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor.java, BaseIOReactor.java
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread Oleg Kalnichevski (JIRA)

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

Oleg Kalnichevski commented on HTTPCORE-480:


What _exactly_ is the problem you are trying to solve? I still do not 
understand what inefficiency you are talking about or what efficiency you are 
trying to improve. Could you please submit your changes in unified diff format 
or as a PR at GitHub? Please also note we cannot make API incompatible changes 
in 4.4.x branch.

Oleg

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor.java, BaseIOReactor.java
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Updated] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

silver9886 updated HTTPCORE-480:

Priority: Major  (was: Trivial)

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor.java, BaseIOReactor.java
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Commented] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

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

silver9886 commented on HTTPCORE-480:
-

when return from readyCount = this.selector.select(this.selectTimeout); the 
time has elapsed (this.selectTimeout default is 1s). 
when the code execute the code if( (currentTime - this.lastTimeoutCheck) >= 
this.timeoutCheckInterval) the time is elapsed larger than (this.selectTimeout 
default is 1s).
beacuse the pc need the time to execute the code between readyCount = 
this.selector.select(this.selectTimeout); and if( (currentTime - 
this.lastTimeoutCheck) >= this.timeoutCheckInterval)
so currentTime - this.lastTimeoutCheck >= this.timeoutCheckInterval will always 
return true(because timeoutCheckInterval=selectTimeout ).
I think if there is no post/get request , the currentTime - 
this.lastTimeoutCheck should no be true.
suppose the time executed elapsed between 
readyCount = this.selector.select(this.selectTimeout); and if( (currentTime - 
this.lastTimeoutCheck) >= this.timeoutCheckInterval) 
at last need 1 millisecond.

the new idea is this(i update the attach .java file) :
add a protected class MinHoldTime default value is 1 (means at last 1 
millisecond).
if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval 
+ minholdTime.get()) {
if (keys != null) {
for (final SelectionKey key : keys) {
timeoutCheck(key, currentTime,minholdTime);
}
}
}
in the timeoutCheck,we can get the min sockettimeout is all sessions and change 
the minholdTime.get() return value.
protected void timeoutCheck(final SelectionKey key, final long now, final 
MinHoldTime minHoldTime) {
final IOSessionImpl session = (IOSessionImpl) key.attachment();
if (session != null) {
final int timeout = session.getSocketTimeout();
if (minHoldTime.get() == 1 || minHoldTime.get() > timeout ) {
minHoldTime.set(timeout);
}
if (timeout > 0) {
if (session.getLastAccessTime() + timeout < now) {
sessionTimedOut(session);
}
}
}
}
 

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Trivial
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor.java, BaseIOReactor.java
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Updated] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

silver9886 updated HTTPCORE-480:

Attachment: AbstractIOReactor.java
BaseIOReactor.java

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Trivial
> Fix For: 4.4.7
>
> Attachments: AbstractIOReactor.java, BaseIOReactor.java
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Updated] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

silver9886 updated HTTPCORE-480:

Attachment: (was: BaseIOReactor.java)

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Trivial
> Fix For: 4.4.7
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Updated] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread Oleg Kalnichevski (JIRA)

 [ 
https://issues.apache.org/jira/browse/HTTPCORE-480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Oleg Kalnichevski updated HTTPCORE-480:
---
Priority: Trivial  (was: Critical)

I am not sure I understand the problem. The change should make the code more 
efficient in what way? Why +2?

Oleg 

> improve the code in check timeout
> -
>
> Key: HTTPCORE-480
> URL: https://issues.apache.org/jira/browse/HTTPCORE-480
> Project: HttpComponents HttpCore
>  Issue Type: Improvement
>  Components: HttpCore NIO
>Affects Versions: 4.4.6
>Reporter: silver9886
>Priority: Trivial
> Fix For: 4.4.7
>
> Attachments: BaseIOReactor.java
>
>
> change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
> if( (currentTime - this.lastTimeoutCheck) >= 
> this.timeoutCheckInterval) ->
>if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)
> because :the code will run for a time and network tranport expend the time 
> too.  So currentTime - this.lastTimeoutCheck should be 
> larger than selectTimeout in order to check timeout. In this case , This will 
> make the code more efficiency.



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

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



[jira] [Created] (HTTPCORE-480) improve the code in check timeout

2017-08-02 Thread silver9886 (JIRA)
silver9886 created HTTPCORE-480:
---

 Summary: improve the code in check timeout
 Key: HTTPCORE-480
 URL: https://issues.apache.org/jira/browse/HTTPCORE-480
 Project: HttpComponents HttpCore
  Issue Type: Improvement
  Components: HttpCore NIO
Affects Versions: 4.4.6
Reporter: silver9886
Priority: Critical
 Fix For: 4.4.7
 Attachments: BaseIOReactor.java

change the code in org.apache.http.impl.nio.reactor.BaseIOReactor:
if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval) 
->
   if( (currentTime - this.lastTimeoutCheck) >= this.timeoutCheckInterval + 2)

because :the code will run for a time and network tranport expend the time too. 
 So currentTime - this.lastTimeoutCheck should be 
larger than selectTimeout in order to check timeout. In this case , This will 
make the code more efficiency.



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

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