org.apache.solr.update
Class DefaultSolrCoreState

java.lang.Object
  extended by org.apache.solr.update.SolrCoreState
      extended by 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.IndexWriterCloser
 
Field Summary
protected  ReentrantLock commitLock
           
static org.slf4j.Logger log
           
 
Fields inherited from class org.apache.solr.update.SolrCoreState
closed
 
Constructor Summary
DefaultSolrCoreState(DirectoryFactory directoryFactory)
           
 
Method Summary
 void cancelRecovery()
           
 void close(SolrCoreState.IndexWriterCloser closer)
           
 void closeIndexWriter(SolrCore core, boolean rollback)
          Expert method that closes the IndexWriter - you must call SolrCoreState.openIndexWriter(SolrCore) in a finally block after calling this method.
protected  SolrIndexWriter createMainIndexWriter(SolrCore core, String name)
           
 void doRecovery(CoreContainer cc, CoreDescriptor cd)
           
 void failed()
           
 Lock getCommitLock()
           
 DirectoryFactory getDirectoryFactory()
           
 RefCounted<IndexWriter> getIndexWriter(SolrCore core)
          Get the current IndexWriter.
 void newIndexWriter(SolrCore core, boolean rollback)
          Force the creation of a new IndexWriter using the settings from the given SolrCore.
 void openIndexWriter(SolrCore core)
          Expert method that opens the IndexWriter - you must call SolrCoreState.closeIndexWriter(SolrCore, boolean) first, and then call this method in a finally block.
 void recovered()
           
 void rollbackIndexWriter(SolrCore core)
          Rollback the current IndexWriter.
 
Methods inherited from class org.apache.solr.update.SolrCoreState
decrefSolrCoreState, getUpdateLock, increfSolrCoreState
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static org.slf4j.Logger log

commitLock

protected final ReentrantLock commitLock
Constructor Detail

DefaultSolrCoreState

public DefaultSolrCoreState(DirectoryFactory directoryFactory)
Method Detail

getIndexWriter

public RefCounted<IndexWriter> getIndexWriter(SolrCore core)
                                       throws IOException
Description copied from class: SolrCoreState
Get the current IndexWriter. If a new IndexWriter must be created, use the settings from the given SolrCore.

Specified by:
getIndexWriter in class SolrCoreState
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: SolrCoreState
Force the creation of a new IndexWriter using the settings from the given SolrCore.

Specified by:
newIndexWriter in class SolrCoreState
rollback - 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: SolrCoreState
Expert method that closes the IndexWriter - you must call SolrCoreState.openIndexWriter(SolrCore) in a finally block after calling this method.

Specified by:
closeIndexWriter in class SolrCoreState
Parameters:
core - that the IW belongs to
rollback - 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: SolrCoreState
Expert method that opens the IndexWriter - you must call SolrCoreState.closeIndexWriter(SolrCore, boolean) first, and then call this method in a finally block.

Specified by:
openIndexWriter in class SolrCoreState
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: SolrCoreState
Rollback the current IndexWriter. When creating the new IndexWriter use the settings from the given SolrCore.

Specified by:
rollbackIndexWriter in class SolrCoreState
Throws:
IOException - If there is a low-level I/O error.

createMainIndexWriter

protected SolrIndexWriter createMainIndexWriter(SolrCore core,
                                                String name)
                                         throws IOException
Throws:
IOException

getDirectoryFactory

public DirectoryFactory getDirectoryFactory()
Specified by:
getDirectoryFactory in class SolrCoreState
Returns:
the DirectoryFactory that should be used.

doRecovery

public void doRecovery(CoreContainer cc,
                       CoreDescriptor cd)
Specified by:
doRecovery in class SolrCoreState

cancelRecovery

public void cancelRecovery()
Specified by:
cancelRecovery in class SolrCoreState

recovered

public void recovered()
Specified by:
recovered in interface RecoveryStrategy.RecoveryListener

failed

public void failed()
Specified by:
failed in interface RecoveryStrategy.RecoveryListener

close

public void close(SolrCoreState.IndexWriterCloser closer)
Specified by:
close in class SolrCoreState

getCommitLock

public Lock getCommitLock()
Specified by:
getCommitLock in class SolrCoreState


Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.