Appearance
TryEvictHost Method
Definition
- Namespace:
JASE.Network - Assembly:
JASE.Network.dll
Overloads
| Name | Description |
|---|---|
bool TryEvictHost(string keyOrUri) | Attempts to evict (dispose) the pooled HttpClient and its transport connections for the specified host key or absolute URI string. |
bool TryEvictHost(Uri uri) | Attempts to evict (dispose) the pooled HttpClient and its transport connections associated with the given absolute Uri. |
bool TryEvictHost(string keyOrUri)
csharp
bool TryEvictHost(string keyOrUri)Attempts to evict (dispose) the pooled HttpClient and its transport connections for the specified host key or absolute URI string.
Parameters
| Name | Description |
|---|---|
keyOrUri | Either a host-port key in the form "host:port" (e.g., "api.example.com:443") or an absolute URI (e.g., "https://api.example.com/v1/foo"). |
Returns
if a matching pool entry was found and scheduled/disposed; otherwise .
Remarks
Use this to force-close all pooled connections for a host (e.g., after cert/credential changes, or in tests when you need to observe connection teardown callbacks). If keyOrUri is an absolute URI, the method normalizes to the internal host-port key. This method is safe to call concurrently.
bool TryEvictHost(Uri uri)
csharp
bool TryEvictHost(Uri uri)Attempts to evict (dispose) the pooled HttpClient and its transport connections associated with the given absolute Uri.
Parameters
| Name | Description |
|---|---|
uri | An absolute URI whose host and port will be normalized to the internal pool key. |
Returns
if a matching pool entry was found and scheduled/disposed; otherwise
Remarks
Normalizes the host (IDN lower-cased) and resolved port (default 443 for HTTPS, 80 for HTTP) to locate the pool entry. Evicting a host will close all idle connections and tear down active ones as the handler disposes transports.