-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Cookiejar optimization #1708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
slandelle
merged 15 commits into
AsyncHttpClient:master
from
sivaalli:cookiejar-optimization
Apr 3, 2020
Merged
Cookiejar optimization #1708
Changes from 9 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b5500b4
making domain as the key for fast lookups.
sivaalli ee75fa9
removing unnecessary imports added by me.
sivaalli 2784950
added a single thread service to cleanup expired cookies.
sivaalli 3f01937
removing redundant interface declaration
sivaalli 6b81e1a
removing unnecessary import
sivaalli dff16e6
not removing cookies during retrieval operations
sivaalli cedd3c9
removing from outermap only if inner map entries are removed.
sivaalli a0c0365
adding config to get the delay in ms and also making a CookieEviction…
sivaalli 4152df1
removing unnecessary imports.
sivaalli 6ddeb72
making necessary suggestions as requested by @slandelle
sivaalli 747bee9
removing unnecessary import
sivaalli 4c8f18c
removing visible for test on public method
sivaalli 60a2c5b
fixing a typo
sivaalli 1a57d0b
scheduling a single taks for shared cookiestore and netty timer.
sivaalli 1437c05
added another test case and added docs on Counted
sivaalli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
client/src/main/java/org/asynchttpclient/cookie/CookieEvictionTask.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package org.asynchttpclient.cookie; | ||
|
|
||
| import java.util.concurrent.TimeUnit; | ||
|
|
||
| import org.asynchttpclient.AsyncHttpClientConfig; | ||
|
|
||
| import io.netty.util.Timeout; | ||
| import io.netty.util.TimerTask; | ||
|
|
||
| /** | ||
| * Evicts expired cookies from the {@linkplain CookieStore} periodically. | ||
| * The default delay is 30 seconds. Ypu may override the default using | ||
| * {@linkplain AsyncHttpClientConfig#expiredCookieEvictionDelay()}. | ||
| */ | ||
| public class CookieEvictionTask implements TimerTask { | ||
|
|
||
| private long evictDelayInMs; | ||
| private CookieStore cookieStore; | ||
|
|
||
| public CookieEvictionTask(long evictDelayInMs, CookieStore cookieStore) { | ||
| this.evictDelayInMs = evictDelayInMs; | ||
| this.cookieStore = cookieStore; | ||
| } | ||
|
|
||
| @Override | ||
| public void run(Timeout timeout) throws Exception { | ||
| cookieStore.evictExpired(); | ||
| timeout.timer().newTimeout(this, evictDelayInMs, TimeUnit.MILLISECONDS); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.