Package org.apache.lucene.replicator
Class LocalReplicator
- java.lang.Object
-
- org.apache.lucene.replicator.LocalReplicator
-
- All Implemented Interfaces:
Closeable,AutoCloseable,Replicator
@Deprecated public class LocalReplicator extends Object implements Replicator
Deprecated.use org.apache.lucene.replicator.nrt insteadAReplicatorimplementation for use by the side that publishesRevisions, as well for clients tocheck for updates. When a client needs to be updated, it is returned aSessionTokenthrough which it canobtainthe files of that revision. As long as a revision is being replicated, this replicator guarantees that it will not bereleased.Replication sessions expire by default after
DEFAULT_SESSION_EXPIRATION_THRESHOLD, and the threshold can be configured throughsetExpirationThreshold(long).- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_SESSION_EXPIRATION_THRESHOLDDeprecated.Threshold for expiring inactive sessions.
-
Constructor Summary
Constructors Constructor Description LocalReplicator()Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description SessionTokencheckForUpdate(String currentVersion)Deprecated.Check whether the given version is up-to-date and returns aSessionTokenwhich can be used for fetching the revision files, otherwise returnsnull.voidclose()Deprecated.protected voidensureOpen()Deprecated.Ensure that replicator is still open, or throwAlreadyClosedExceptionotherwise.longgetExpirationThreshold()Deprecated.Returns the expiration threshold.InputStreamobtainFile(String sessionID, String source, String fileName)Deprecated.Returns anInputStreamfor the requested file and source in the context of the givensession.voidpublish(Revision revision)Deprecated.Publish a newRevisionfor consumption by clients.voidrelease(String sessionID)Deprecated.Notify that the specifiedSessionTokenis no longer needed by the caller.voidsetExpirationThreshold(long expirationThreshold)Deprecated.Modify session expiration time - if a replication session is inactive that long it is automatically expired, and further attempts to operate within this session will throw aSessionExpiredException.
-
-
-
Field Detail
-
DEFAULT_SESSION_EXPIRATION_THRESHOLD
public static final long DEFAULT_SESSION_EXPIRATION_THRESHOLD
Deprecated.Threshold for expiring inactive sessions. Defaults to 30 minutes.- See Also:
- Constant Field Values
-
-
Method Detail
-
ensureOpen
protected final void ensureOpen()
Deprecated.Ensure that replicator is still open, or throwAlreadyClosedExceptionotherwise.
-
checkForUpdate
public SessionToken checkForUpdate(String currentVersion)
Deprecated.Description copied from interface:ReplicatorCheck whether the given version is up-to-date and returns aSessionTokenwhich 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:
checkForUpdatein interfaceReplicator
-
close
public void close() throws IOExceptionDeprecated.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getExpirationThreshold
public long getExpirationThreshold()
Deprecated.Returns the expiration threshold.- See Also:
setExpirationThreshold(long)
-
obtainFile
public InputStream obtainFile(String sessionID, String source, String fileName) throws IOException
Deprecated.Description copied from interface:ReplicatorReturns anInputStreamfor 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:
obtainFilein interfaceReplicator- Throws:
SessionExpiredException- if the specified session has already expiredIOException
-
publish
public void publish(Revision revision) throws IOException
Deprecated.Description copied from interface:ReplicatorPublish a newRevisionfor 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 bereleasedby the replicator.- Specified by:
publishin interfaceReplicator- Throws:
IOException
-
release
public void release(String sessionID) throws IOException
Deprecated.Description copied from interface:ReplicatorNotify that the specifiedSessionTokenis no longer needed by the caller.- Specified by:
releasein interfaceReplicator- Throws:
IOException
-
setExpirationThreshold
public void setExpirationThreshold(long expirationThreshold) throws IOExceptionDeprecated.Modify session expiration time - if a replication session is inactive that long it is automatically expired, and further attempts to operate within this session will throw aSessionExpiredException.- Throws:
IOException
-
-