Class HttpReplicator
java.lang.Object
org.apache.lucene.replicator.http.HttpClientBase
org.apache.lucene.replicator.http.HttpReplicator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Replicator
An HTTP implementation of
Replicator
. Assumes the API supported by ReplicationService
.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
Fields inherited from class org.apache.lucene.replicator.http.HttpClientBase
DEFAULT_CONNECTION_TIMEOUT, DEFAULT_SO_TIMEOUT, url
-
Constructor Summary
ConstructorDescriptionHttpReplicator
(String host, int port, String path, org.apache.http.conn.HttpClientConnectionManager conMgr) Construct with specified connection manager. -
Method Summary
Modifier and TypeMethodDescriptioncheckForUpdate
(String currVersion) Check whether the given version is up-to-date and returns aSessionToken
which can be used for fetching the revision files, otherwise returnsnull
.obtainFile
(String sessionID, String source, String fileName) Returns anInputStream
for the requested file and source in the context of the givensession
.void
Publish a newRevision
for consumption by clients.void
Notify that the specifiedSessionToken
is no longer needed by the caller.Methods inherited from class org.apache.lucene.replicator.http.HttpClientBase
close, doAction, doAction, ensureOpen, executeGET, executePOST, isClosed, responseInputStream, responseInputStream, throwKnownError, verifyStatus
-
Constructor Details
-
Method Details
-
checkForUpdate
Description copied from interface:Replicator
Check whether the given version is up-to-date and returns aSessionToken
which can be used for fetching the revision files, otherwise returnsnull
.NOTE: when the returned session token is no longer needed, you should call
Replicator.release(String)
so that the session resources can be reclaimed, including the revision files.- Specified by:
checkForUpdate
in interfaceReplicator
- Throws:
IOException
-
obtainFile
Description copied from interface:Replicator
Returns anInputStream
for the requested file and source in the context of the givensession
.NOTE: it is the caller's responsibility to close the returned stream.
- Specified by:
obtainFile
in interfaceReplicator
- Throws:
SessionExpiredException
- if the specified session has already expiredIOException
-
publish
Description copied from interface:Replicator
Publish a newRevision
for consumption by clients. It is the caller's responsibility to verify that the revision files exist and can be read by clients. When the revision is no longer needed, it will bereleased
by the replicator.- Specified by:
publish
in interfaceReplicator
- Throws:
IOException
-
release
Description copied from interface:Replicator
Notify that the specifiedSessionToken
is no longer needed by the caller.- Specified by:
release
in interfaceReplicator
- Throws:
IOException
-