Package org.apache.solr.update
Class DefaultSolrCoreState
- java.lang.Object
-
- org.apache.solr.update.SolrCoreState
-
- org.apache.solr.update.DefaultSolrCoreState
-
- All Implemented Interfaces:
RecoveryStrategy.RecoveryListener
public final class DefaultSolrCoreState extends SolrCoreState implements RecoveryStrategy.RecoveryListener
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.update.SolrCoreState
SolrCoreState.CoreIsClosedException, SolrCoreState.IndexWriterCloser
-
-
Field Summary
-
Fields inherited from class org.apache.solr.update.SolrCoreState
closed
-
-
Constructor Summary
Constructors Constructor Description DefaultSolrCoreState(DirectoryFactory directoryFactory)Deprecated.DefaultSolrCoreState(DirectoryFactory directoryFactory, RecoveryStrategy.Builder recoveryStrategyBuilder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelRecovery()voidclose(SolrCoreState.IndexWriterCloser closer)voidcloseIndexWriter(SolrCore core, boolean rollback)Expert method that closes the IndexWriter - you must callSolrCoreState.openIndexWriter(SolrCore)in a finally block after calling this method.voiddoRecovery(CoreContainer cc, CoreDescriptor cd)voidfailed()called from recoveryStrat on a failed recoveryLockgetCommitLock()DirectoryFactorygetDirectoryFactory()RefCounted<org.apache.lucene.index.IndexWriter>getIndexWriter(SolrCore core)Get the current IndexWriter.booleangetLastReplicateIndexSuccess()ActionThrottlegetLeaderThrottle()org.apache.lucene.search.SortgetMergePolicySort()Get the current Sort of the current IndexWriter's MergePolicy..LockgetRecoveryLock()RecoveryStrategy.BuildergetRecoveryStrategyBuilder()voidnewIndexWriter(SolrCore core, boolean rollback)Force the creation of a new IndexWriter using the settings from the given SolrCore.voidopenIndexWriter(SolrCore core)Expert method that opens the IndexWriter - you must callSolrCoreState.closeIndexWriter(SolrCore, boolean)first, and then call this method in a finally block.voidrecovered()called from recoveryStrat on a successful recoveryvoidrollbackIndexWriter(SolrCore core)Rollback the current IndexWriter.voidsetLastReplicateIndexSuccess(boolean success)-
Methods inherited from class org.apache.solr.update.SolrCoreState
decrefSolrCoreState, deregisterInFlightUpdate, getReloadLock, getTragicException, getUpdateLock, increfSolrCoreState, pauseUpdatesAndAwaitInflightRequests, registerInFlightUpdate
-
-
-
-
Constructor Detail
-
DefaultSolrCoreState
@Deprecated public DefaultSolrCoreState(DirectoryFactory directoryFactory)
Deprecated.
-
DefaultSolrCoreState
public DefaultSolrCoreState(DirectoryFactory directoryFactory, RecoveryStrategy.Builder recoveryStrategyBuilder)
-
-
Method Detail
-
getIndexWriter
public RefCounted<org.apache.lucene.index.IndexWriter> getIndexWriter(SolrCore core) throws IOException
Description copied from class:SolrCoreStateGet the current IndexWriter. If a new IndexWriter must be created, use the settings from the givenSolrCore.- Specified by:
getIndexWriterin classSolrCoreState- Throws:
IOException- If there is a low-level I/O error.
-
newIndexWriter
public void newIndexWriter(SolrCore core, boolean rollback) throws IOException
Description copied from class:SolrCoreStateForce the creation of a new IndexWriter using the settings from the given SolrCore.- Specified by:
newIndexWriterin classSolrCoreStaterollback- close IndexWriter if false, else rollback- Throws:
IOException- If there is a low-level I/O error.
-
closeIndexWriter
public void closeIndexWriter(SolrCore core, boolean rollback) throws IOException
Description copied from class:SolrCoreStateExpert method that closes the IndexWriter - you must callSolrCoreState.openIndexWriter(SolrCore)in a finally block after calling this method.- Specified by:
closeIndexWriterin classSolrCoreState- Parameters:
core- that the IW belongs torollback- true if IW should rollback rather than close- Throws:
IOException- If there is a low-level I/O error.
-
openIndexWriter
public void openIndexWriter(SolrCore core) throws IOException
Description copied from class:SolrCoreStateExpert method that opens the IndexWriter - you must callSolrCoreState.closeIndexWriter(SolrCore, boolean)first, and then call this method in a finally block.- Specified by:
openIndexWriterin classSolrCoreState- Parameters:
core- that the IW belongs to- Throws:
IOException- If there is a low-level I/O error.
-
rollbackIndexWriter
public void rollbackIndexWriter(SolrCore core) throws IOException
Description copied from class:SolrCoreStateRollback the current IndexWriter. When creating the new IndexWriter use the settings from the givenSolrCore.- Specified by:
rollbackIndexWriterin classSolrCoreState- Throws:
IOException- If there is a low-level I/O error.
-
getMergePolicySort
public org.apache.lucene.search.Sort getMergePolicySort() throws IOExceptionDescription copied from class:SolrCoreStateGet the current Sort of the current IndexWriter's MergePolicy..- Specified by:
getMergePolicySortin classSolrCoreState- Throws:
IOException- If there is a low-level I/O error.
-
getDirectoryFactory
public DirectoryFactory getDirectoryFactory()
- Specified by:
getDirectoryFactoryin classSolrCoreState- Returns:
- the
DirectoryFactorythat should be used.
-
getRecoveryStrategyBuilder
public RecoveryStrategy.Builder getRecoveryStrategyBuilder()
- Specified by:
getRecoveryStrategyBuilderin classSolrCoreState- Returns:
- the
RecoveryStrategy.Builderthat should be used.
-
doRecovery
public void doRecovery(CoreContainer cc, CoreDescriptor cd)
- Specified by:
doRecoveryin classSolrCoreState
-
cancelRecovery
public void cancelRecovery()
- Specified by:
cancelRecoveryin classSolrCoreState
-
recovered
public void recovered()
called from recoveryStrat on a successful recovery- Specified by:
recoveredin interfaceRecoveryStrategy.RecoveryListener
-
failed
public void failed()
called from recoveryStrat on a failed recovery- Specified by:
failedin interfaceRecoveryStrategy.RecoveryListener
-
close
public void close(SolrCoreState.IndexWriterCloser closer)
- Specified by:
closein classSolrCoreState
-
getCommitLock
public Lock getCommitLock()
- Specified by:
getCommitLockin classSolrCoreState
-
getLeaderThrottle
public ActionThrottle getLeaderThrottle()
- Specified by:
getLeaderThrottlein classSolrCoreState- Returns:
- throttle to limit how fast a core attempts to become leader
-
getLastReplicateIndexSuccess
public boolean getLastReplicateIndexSuccess()
- Specified by:
getLastReplicateIndexSuccessin classSolrCoreState
-
setLastReplicateIndexSuccess
public void setLastReplicateIndexSuccess(boolean success)
- Specified by:
setLastReplicateIndexSuccessin classSolrCoreState
-
getRecoveryLock
public Lock getRecoveryLock()
- Specified by:
getRecoveryLockin classSolrCoreState
-
-