-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Changes: Segmented map based on domain names. So instead of traversing all the domains it traverses the domains that are of interest. Use NettyTimer to clean up the expired cookies asynchronously. The timer task that provides this functionality is CookieEvictionTask.
- Loading branch information
Showing
12 changed files
with
326 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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. You may override the default using | ||
* {@linkplain AsyncHttpClientConfig#expiredCookieEvictionDelay()}. | ||
*/ | ||
public class CookieEvictionTask implements TimerTask { | ||
|
||
private final long evictDelayInMs; | ||
private final 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 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.