jetty-9 - HTTP client: better cleanup at stop.
This commit is contained in:
parent
88cbfed7e0
commit
4ffe66f899
|
@ -43,6 +43,12 @@ public class HttpAuthenticationStore implements AuthenticationStore
|
|||
authentications.remove(authentication);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearAuthentications()
|
||||
{
|
||||
authentications.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Authentication findAuthentication(String type, String uri, String realm)
|
||||
{
|
||||
|
|
|
@ -171,13 +171,17 @@ public class HttpClient extends AggregateLifeCycle
|
|||
|
||||
for (HttpDestination destination : destinations.values())
|
||||
destination.close();
|
||||
|
||||
destinations.clear();
|
||||
|
||||
conversations.clear();
|
||||
|
||||
handlers.clear();
|
||||
requestListeners.clear();
|
||||
cookieStore.clear();
|
||||
authenticationStore.clearAuthentications();
|
||||
authenticationStore.clearAuthenticationResults();
|
||||
|
||||
super.doStop();
|
||||
|
||||
LOG.info("Stopped {}", this);
|
||||
}
|
||||
|
||||
|
@ -424,6 +428,11 @@ public class HttpClient extends AggregateLifeCycle
|
|||
this.scheduler = scheduler;
|
||||
}
|
||||
|
||||
public SelectorManager getSelectorManager()
|
||||
{
|
||||
return selectorManager;
|
||||
}
|
||||
|
||||
public int getMaxConnectionsPerAddress()
|
||||
{
|
||||
return maxConnectionsPerAddress;
|
||||
|
|
|
@ -261,6 +261,7 @@ public class HttpConnection extends AbstractConnection implements Connection
|
|||
LOG.debug("{} oshut", this);
|
||||
getEndPoint().close();
|
||||
LOG.debug("{} closed", this);
|
||||
client.getSelectorManager().connectionClosed(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -33,6 +33,11 @@ public interface AuthenticationStore
|
|||
*/
|
||||
public void removeAuthentication(Authentication authentication);
|
||||
|
||||
/**
|
||||
* Removes all {@link Authentication}s stored
|
||||
*/
|
||||
public void clearAuthentications();
|
||||
|
||||
/**
|
||||
* Returns the authentication that matches the given type (for example, "Basic" or "Digest"),
|
||||
* the given request URI and the given realm.
|
||||
|
|
|
@ -177,7 +177,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
|||
*
|
||||
* @param connection the connection just opened
|
||||
*/
|
||||
protected void connectionOpened(Connection connection)
|
||||
public void connectionOpened(Connection connection)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -194,7 +194,7 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
|
|||
*
|
||||
* @param connection the connection just closed
|
||||
*/
|
||||
protected void connectionClosed(Connection connection)
|
||||
public void connectionClosed(Connection connection)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue