Package eu.clarin.sru.client
Class SRUThreadedClient
- java.lang.Object
-
- eu.clarin.sru.client.SRUThreadedClient
-
public class SRUThreadedClient extends Object
A client to perform SRU operations in parallel. The response of a SRU request is wrapped in a SRU response.This client is reusable and thread-safe: the application may reuse a client object and may shared it between multiple threads.
NB: The registered
SRURecordDataParser
need to be thread-safe
-
-
Constructor Summary
Constructors Constructor Description SRUThreadedClient(SRUClientConfig config)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Future<SRUExplainResponse>
explain(SRUExplainRequest request)
Deprecated.Use asynchronous callback interfaceexplain(SRUExplainRequest, SRUCallback)
.void
explain(SRUExplainRequest request, SRUCallback<SRUExplainRequest,SRUExplainResponse> callback)
Perform a explain operation and invoke a user supplied callback after the request has been completed.protected void
finalize()
Invokesshutdown
when this no longer referencedFuture<SRUScanResponse>
scan(SRUScanRequest request)
Deprecated.Use asynchronous callback interfacescan(SRUScanRequest, SRUCallback)
.void
scan(SRUScanRequest request, SRUCallback<SRUScanRequest,SRUScanResponse> callback)
Perform a scan operation and invoke a user supplied callback after the request has been completed.Future<SRUSearchRetrieveResponse>
searchRetrieve(SRUSearchRetrieveRequest request)
Deprecated.Use asynchronous callback interfacesearchRetrieve(SRUSearchRetrieveRequest, SRUCallback)
.void
searchRetrieve(SRUSearchRetrieveRequest request, SRUCallback<SRUSearchRetrieveRequest,SRUSearchRetrieveResponse> callback)
Perform a searchRetrieve operation and invoke a user supplied callback after the request has been completed.void
shutdown()
Initiates an orderly shutdown in which previously submitted requests are executed, but no new requests will be accepted.void
shutdownNow()
Terminate the client but drain queued requests.
-
-
-
Constructor Detail
-
SRUThreadedClient
public SRUThreadedClient(SRUClientConfig config)
Constructor.- Parameters:
config
- the configuration to be used for this client.- Throws:
NullPointerException
- if argumentconfig
isnull
IllegalArgumentException
- if an error occurred while registering record data parsers- See Also:
SRUClientConfig
-
-
Method Detail
-
explain
@Deprecated public Future<SRUExplainResponse> explain(SRUExplainRequest request) throws SRUClientException
Deprecated.Use asynchronous callback interfaceexplain(SRUExplainRequest, SRUCallback)
. This method will be removed in the future.Perform a explain operation.- Parameters:
request
- an instance of aSRUExplainRequest
object- Returns:
- a
Future
object that wraps aSRUExplainResponse
object - Throws:
SRUClientException
- if an unrecoverable error occurredNullPointerException
- if any required argument isnull
-
explain
public void explain(SRUExplainRequest request, SRUCallback<SRUExplainRequest,SRUExplainResponse> callback) throws SRUClientException
Perform a explain operation and invoke a user supplied callback after the request has been completed.- Parameters:
request
- an instance of aSRUExplainRequest
objectcallback
- the callback to be invoked- Throws:
SRUClientException
- if an unrecoverable error occurredNullPointerException
- if any required argument isnull
- See Also:
SRUCallback
-
scan
@Deprecated public Future<SRUScanResponse> scan(SRUScanRequest request) throws SRUClientException
Deprecated.Use asynchronous callback interfacescan(SRUScanRequest, SRUCallback)
. This method will be removed in the future.Perform a scan operation.- Parameters:
request
- an instance of aSRUScanRequest
object- Returns:
- a
Future
object that wraps aSRUScanResponse
object - Throws:
SRUClientException
- if an unrecoverable error occurredNullPointerException
- if any required argument isnull
-
scan
public void scan(SRUScanRequest request, SRUCallback<SRUScanRequest,SRUScanResponse> callback) throws SRUClientException
Perform a scan operation and invoke a user supplied callback after the request has been completed.- Parameters:
request
- an instance of aSRUScanRequest
objectcallback
- the callback to be invoked- Throws:
SRUClientException
- if an unrecoverable error occurredNullPointerException
- if any required argument isnull
- See Also:
SRUCallback
-
searchRetrieve
@Deprecated public Future<SRUSearchRetrieveResponse> searchRetrieve(SRUSearchRetrieveRequest request) throws SRUClientException
Deprecated.Use asynchronous callback interfacesearchRetrieve(SRUSearchRetrieveRequest, SRUCallback)
. This method will be removed in the future.Perform a searchRetrieve operation.- Parameters:
request
- an instance of aSRUSearchRetrieveRequest
object- Returns:
- a
Future
object that wraps aSRUExplainResponse
object - Throws:
SRUClientException
- if an unrecoverable error occurredNullPointerException
- if any required argument isnull
-
searchRetrieve
public void searchRetrieve(SRUSearchRetrieveRequest request, SRUCallback<SRUSearchRetrieveRequest,SRUSearchRetrieveResponse> callback) throws SRUClientException
Perform a searchRetrieve operation and invoke a user supplied callback after the request has been completed.- Parameters:
request
- an instance of aSRUSearchRetrieveRequest
objectcallback
- the callback to be invoked- Throws:
SRUClientException
- if an unrecoverable error occurredNullPointerException
- if any required argument isnull
- See Also:
SRUCallback
-
finalize
protected void finalize() throws Throwable
Invokesshutdown
when this no longer referenced
-
shutdown
public void shutdown()
Initiates an orderly shutdown in which previously submitted requests are executed, but no new requests will be accepted.
-
shutdownNow
public void shutdownNow()
Terminate the client but drain queued requests.
-
-