Package org.eclipse.rdf4j.http.client
Class SharedHttpClientSessionManager
java.lang.Object
org.eclipse.rdf4j.http.client.SharedHttpClientSessionManager
- All Implemented Interfaces:
HttpClientDependent
,HttpClientSessionManager
public class SharedHttpClientSessionManager
extends Object
implements HttpClientSessionManager, HttpClientDependent
A Manager for HTTP sessions that uses a shared
HttpClient
to manage HTTP connections.- Author:
- James Leigh
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Configurable system propertyorg.eclipse.rdf4j.client.executors.corePoolSize
for specifying the background executor core thread pool size. -
Constructor Summary
ConstructorDescriptionSharedHttpClientSessionManager
(org.apache.http.impl.client.CloseableHttpClient dependentClient, ScheduledExecutorService dependentExecutorService) -
Method Summary
Modifier and TypeMethodDescriptioncreateRDF4JProtocolSession
(String serverURL) Creates a new session to the remote RDF4J REST API.createSPARQLProtocolSession
(String queryEndpointUrl, String updateEndpointUrl) Creates a new SPARQL Protocol session to the remote SPARQL endpoint.protected final ExecutorService
Get theExecutorService
used by this session manager.org.apache.http.client.HttpClient
HttpClient
that has been assigned or has been used by this object.void
Deprecated.Create a new instance instead of trying to reactivate an old instance.void
setHttpClient
(org.apache.http.client.HttpClient httpClient) Assign anHttpClient
that this object should use.void
setHttpClientBuilder
(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder) Set an optionalHttpClientBuilder
to create the innerhttpClient
(if the latter is not provided externally as dependent client).void
shutDown()
Closes any remaining connections and threads used by the sessions created by this object.
-
Field Details
-
CORE_POOL_SIZE_PROPERTY
Configurable system propertyorg.eclipse.rdf4j.client.executors.corePoolSize
for specifying the background executor core thread pool size.- See Also:
-
-
Constructor Details
-
SharedHttpClientSessionManager
public SharedHttpClientSessionManager() -
SharedHttpClientSessionManager
public SharedHttpClientSessionManager(org.apache.http.impl.client.CloseableHttpClient dependentClient, ScheduledExecutorService dependentExecutorService)
-
-
Method Details
-
getHttpClient
public org.apache.http.client.HttpClient getHttpClient()Description copied from interface:HttpClientDependent
HttpClient
that has been assigned or has been used by this object. The life cycle might not be or might be tied to this object, depending on whetherHttpClient
was passed to or created by this object respectively.- Specified by:
getHttpClient
in interfaceHttpClientDependent
- Specified by:
getHttpClient
in interfaceHttpClientSessionManager
- Returns:
- Returns the httpClient.
-
setHttpClient
public void setHttpClient(org.apache.http.client.HttpClient httpClient) Description copied from interface:HttpClientDependent
Assign anHttpClient
that this object should use. The life cycle of the givenHttpClient
is independent of this object. Closing or shutting down this object does not have any impact on the given client. Callers must ensure that the given client is properly closed elsewhere.- Specified by:
setHttpClient
in interfaceHttpClientDependent
- Parameters:
httpClient
- The httpClient to use for remote/service calls.
-
setHttpClientBuilder
public void setHttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder) Set an optionalHttpClientBuilder
to create the innerhttpClient
(if the latter is not provided externally as dependent client).- Parameters:
httpClientBuilder
- the builder for the managed HttpClient- See Also:
-
createSPARQLProtocolSession
public SPARQLProtocolSession createSPARQLProtocolSession(String queryEndpointUrl, String updateEndpointUrl) Description copied from interface:HttpClientSessionManager
Creates a new SPARQL Protocol session to the remote SPARQL endpoint.- Specified by:
createSPARQLProtocolSession
in interfaceHttpClientSessionManager
-
createRDF4JProtocolSession
Description copied from interface:HttpClientSessionManager
Creates a new session to the remote RDF4J REST API.- Specified by:
createRDF4JProtocolSession
in interfaceHttpClientSessionManager
-
shutDown
public void shutDown()Description copied from interface:HttpClientSessionManager
Closes any remaining connections and threads used by the sessions created by this object.- Specified by:
shutDown
in interfaceHttpClientSessionManager
-
initialize
Deprecated.Create a new instance instead of trying to reactivate an old instance.No-op -
getExecutorService
Get theExecutorService
used by this session manager.- Returns:
- a
ExecutorService
used by allSPARQLProtocolSession
andRDF4JProtocolSession
instances created by this session manager.
-