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 sharedHttpClientto manage HTTP connections.- Author:
- James Leigh
-
-
Field Summary
Fields Modifier and Type Field Description static StringCORE_POOL_SIZE_PROPERTYConfigurable system propertyorg.eclipse.rdf4j.client.executors.corePoolSizefor specifying the background executor core thread pool size.
-
Constructor Summary
Constructors Constructor Description SharedHttpClientSessionManager()SharedHttpClientSessionManager(org.apache.http.impl.client.CloseableHttpClient dependentClient, ScheduledExecutorService dependentExecutorService)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description RDF4JProtocolSessioncreateRDF4JProtocolSession(String serverURL)Creates a new session to the remote RDF4J REST API.SPARQLProtocolSessioncreateSPARQLProtocolSession(String queryEndpointUrl, String updateEndpointUrl)Creates a new SPARQL Protocol session to the remote SPARQL endpoint.protected ExecutorServicegetExecutorService()Get theExecutorServiceused by this session manager.org.apache.http.client.HttpClientgetHttpClient()HttpClientthat has been assigned or has been used by this object.voidinitialize()Deprecated.Create a new instance instead of trying to reactivate an old instance.voidsetHttpClient(org.apache.http.client.HttpClient httpClient)Assign anHttpClientthat this object should use.voidsetHttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder)Set an optionalHttpClientBuilderto create the innerhttpClient(if the latter is not provided externally as dependent client).voidshutDown()Closes any remaining connections and threads used by the sessions created by this object.
-
-
-
Field Detail
-
CORE_POOL_SIZE_PROPERTY
public static final String CORE_POOL_SIZE_PROPERTY
Configurable system propertyorg.eclipse.rdf4j.client.executors.corePoolSizefor specifying the background executor core thread pool size.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SharedHttpClientSessionManager
public SharedHttpClientSessionManager()
-
SharedHttpClientSessionManager
public SharedHttpClientSessionManager(org.apache.http.impl.client.CloseableHttpClient dependentClient, ScheduledExecutorService dependentExecutorService)
-
-
Method Detail
-
getHttpClient
public org.apache.http.client.HttpClient getHttpClient()
Description copied from interface:HttpClientDependentHttpClientthat 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 whetherHttpClientwas passed to or created by this object respectively.- Specified by:
getHttpClientin interfaceHttpClientDependent- Specified by:
getHttpClientin interfaceHttpClientSessionManager- Returns:
- Returns the httpClient.
-
setHttpClient
public void setHttpClient(org.apache.http.client.HttpClient httpClient)
Description copied from interface:HttpClientDependentAssign anHttpClientthat this object should use. The life cycle of the givenHttpClientis 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:
setHttpClientin interfaceHttpClientDependent- Parameters:
httpClient- The httpClient to use for remote/service calls.
-
setHttpClientBuilder
public void setHttpClientBuilder(org.apache.http.impl.client.HttpClientBuilder httpClientBuilder)
Set an optionalHttpClientBuilderto create the innerhttpClient(if the latter is not provided externally as dependent client).- Parameters:
httpClientBuilder- the builder for the managed HttpClient- See Also:
HttpClientBuilders
-
createSPARQLProtocolSession
public SPARQLProtocolSession createSPARQLProtocolSession(String queryEndpointUrl, String updateEndpointUrl)
Description copied from interface:HttpClientSessionManagerCreates a new SPARQL Protocol session to the remote SPARQL endpoint.- Specified by:
createSPARQLProtocolSessionin interfaceHttpClientSessionManager
-
createRDF4JProtocolSession
public RDF4JProtocolSession createRDF4JProtocolSession(String serverURL)
Description copied from interface:HttpClientSessionManagerCreates a new session to the remote RDF4J REST API.- Specified by:
createRDF4JProtocolSessionin interfaceHttpClientSessionManager
-
shutDown
public void shutDown()
Description copied from interface:HttpClientSessionManagerCloses any remaining connections and threads used by the sessions created by this object.- Specified by:
shutDownin interfaceHttpClientSessionManager
-
initialize
@Deprecated public void initialize()
Deprecated.Create a new instance instead of trying to reactivate an old instance.No-op
-
getExecutorService
protected final ExecutorService getExecutorService()
Get theExecutorServiceused by this session manager.- Returns:
- a
ExecutorServiceused by allSPARQLProtocolSessionandRDF4JProtocolSessioninstances created by this session manager.
-
-