Package org.ametys.cms.search.solr
Class AbstractAmetysConcurrentUpdateClient
- java.lang.Object
-
- org.apache.solr.client.solrj.SolrClient
-
- org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient
-
- org.ametys.cms.search.solr.AbstractAmetysConcurrentUpdateClient
-
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable
- Direct Known Subclasses:
DefaultUpdateClient,NoAutoCommitUpdateClient
public abstract class AbstractAmetysConcurrentUpdateClient extends org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient
Concurrent update solr client specific for Ametys.
Allow operations on only one collection (specified by the constructor), and forbid operations on all other collections. Delegate the processing to the ConcurrentUpdateSolrClient (superclass) if the collection is the one in use- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private String_collectionNameName of the collection, on which operation are allowedprivate org.slf4j.Logger_logger
-
Constructor Summary
Constructors Constructor Description AbstractAmetysConcurrentUpdateClient(String solrServerUrl, Optional<Integer> solrSocketTimeout, String collectionName, int queueSize, int threadCount, org.slf4j.Logger logger)Constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void_checkCollectionInUse(String collection)private static org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient.Builder_getBuilder(String solrServerUrl, Optional<Integer> solrSocketTimeout, int queueSize, int threadCount)org.apache.solr.client.solrj.response.UpdateResponseadd(String collection, Collection<org.apache.solr.common.SolrInputDocument> docs)org.apache.solr.client.solrj.response.UpdateResponseadd(String collection, Collection<org.apache.solr.common.SolrInputDocument> docs, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponseadd(String collection, Iterator<org.apache.solr.common.SolrInputDocument> docIterator)org.apache.solr.client.solrj.response.UpdateResponseadd(String collection, org.apache.solr.common.SolrInputDocument doc)org.apache.solr.client.solrj.response.UpdateResponseadd(String collection, org.apache.solr.common.SolrInputDocument doc, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponseadd(Collection<org.apache.solr.common.SolrInputDocument> docs)org.apache.solr.client.solrj.response.UpdateResponseadd(Collection<org.apache.solr.common.SolrInputDocument> docs, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponseadd(Iterator<org.apache.solr.common.SolrInputDocument> docIterator)org.apache.solr.client.solrj.response.UpdateResponseadd(org.apache.solr.common.SolrInputDocument doc)org.apache.solr.client.solrj.response.UpdateResponseadd(org.apache.solr.common.SolrInputDocument doc, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponseaddBean(Object obj)org.apache.solr.client.solrj.response.UpdateResponseaddBean(Object obj, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponseaddBean(String collection, Object obj)org.apache.solr.client.solrj.response.UpdateResponseaddBean(String collection, Object obj, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponseaddBeans(String collection, Collection<?> beans)org.apache.solr.client.solrj.response.UpdateResponseaddBeans(String collection, Collection<?> beans, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponseaddBeans(String collection, Iterator<?> beanIterator)org.apache.solr.client.solrj.response.UpdateResponseaddBeans(Collection<?> beans)org.apache.solr.client.solrj.response.UpdateResponseaddBeans(Collection<?> beans, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponseaddBeans(Iterator<?> beanIterator)org.apache.solr.client.solrj.response.UpdateResponsecommit()org.apache.solr.client.solrj.response.UpdateResponsecommit(boolean waitFlush, boolean waitSearcher)org.apache.solr.client.solrj.response.UpdateResponsecommit(boolean waitFlush, boolean waitSearcher, boolean softCommit)org.apache.solr.client.solrj.response.UpdateResponsecommit(String collection)org.apache.solr.client.solrj.response.UpdateResponsecommit(String collection, boolean waitFlush, boolean waitSearcher)org.apache.solr.client.solrj.response.UpdateResponsecommit(String collection, boolean waitFlush, boolean waitSearcher, boolean softCommit)org.apache.solr.client.solrj.response.UpdateResponsedeleteById(String id)org.apache.solr.client.solrj.response.UpdateResponsedeleteById(String id, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponsedeleteById(String collection, String id)org.apache.solr.client.solrj.response.UpdateResponsedeleteById(String collection, String id, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponsedeleteById(String collection, List<String> ids)org.apache.solr.client.solrj.response.UpdateResponsedeleteById(String collection, List<String> ids, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponsedeleteById(List<String> ids)org.apache.solr.client.solrj.response.UpdateResponsedeleteById(List<String> ids, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponsedeleteByQuery(String query)org.apache.solr.client.solrj.response.UpdateResponsedeleteByQuery(String query, int commitWithinMs)org.apache.solr.client.solrj.response.UpdateResponsedeleteByQuery(String collection, String query)org.apache.solr.client.solrj.response.UpdateResponsedeleteByQuery(String collection, String query, int commitWithinMs)voidhandleError(Throwable t)voidonSuccess(org.apache.http.HttpResponse resp)org.apache.solr.client.solrj.response.UpdateResponseoptimize()org.apache.solr.client.solrj.response.UpdateResponseoptimize(boolean waitFlush, boolean waitSearcher)org.apache.solr.client.solrj.response.UpdateResponseoptimize(boolean waitFlush, boolean waitSearcher, int maxSegments)org.apache.solr.client.solrj.response.UpdateResponseoptimize(String collection)org.apache.solr.client.solrj.response.UpdateResponseoptimize(String collection, boolean waitFlush, boolean waitSearcher)org.apache.solr.client.solrj.response.UpdateResponseoptimize(String collection, boolean waitFlush, boolean waitSearcher, int maxSegments)org.apache.solr.client.solrj.response.UpdateResponserollback()org.apache.solr.client.solrj.response.UpdateResponserollback(String collection)-
Methods inherited from class org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient
blockUntilFinished, close, getQueryParams, request, setConnectionTimeout, setParser, setPollQueueTime, setQueryParams, setRequestWriter, setSoTimeout, shutdownNow
-
-
-
-
Field Detail
-
_collectionName
private String _collectionName
Name of the collection, on which operation are allowed
-
_logger
private org.slf4j.Logger _logger
-
-
Constructor Detail
-
AbstractAmetysConcurrentUpdateClient
public AbstractAmetysConcurrentUpdateClient(String solrServerUrl, Optional<Integer> solrSocketTimeout, String collectionName, int queueSize, int threadCount, org.slf4j.Logger logger)
Constructor- Parameters:
solrServerUrl- The Solr server URLsolrSocketTimeout- The Solr socket timeout (in millis)collectionName- The name of the collection, on which operations will be allowed. Operations on other collections will be forbidden.queueSize- The buffer size before the documents are sent to the serverthreadCount- The number of background threads used to empty the queuelogger- internal logger
-
-
Method Detail
-
_getBuilder
private static org.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient.Builder _getBuilder(String solrServerUrl, Optional<Integer> solrSocketTimeout, int queueSize, int threadCount)
-
handleError
public void handleError(Throwable t)
- Overrides:
handleErrorin classorg.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient
-
onSuccess
public void onSuccess(org.apache.http.HttpResponse resp)
- Overrides:
onSuccessin classorg.apache.solr.client.solrj.impl.ConcurrentUpdateSolrClient
-
_checkCollectionInUse
private void _checkCollectionInUse(String collection) throws org.apache.solr.client.solrj.SolrServerException
- Throws:
org.apache.solr.client.solrj.SolrServerException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(String collection, Collection<org.apache.solr.common.SolrInputDocument> docs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(Collection<org.apache.solr.common.SolrInputDocument> docs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(String collection, Collection<org.apache.solr.common.SolrInputDocument> docs, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(Collection<org.apache.solr.common.SolrInputDocument> docs, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(String collection, org.apache.solr.common.SolrInputDocument doc) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(org.apache.solr.common.SolrInputDocument doc) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(String collection, org.apache.solr.common.SolrInputDocument doc, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(org.apache.solr.common.SolrInputDocument doc, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(String collection, Iterator<org.apache.solr.common.SolrInputDocument> docIterator) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
add
public org.apache.solr.client.solrj.response.UpdateResponse add(Iterator<org.apache.solr.common.SolrInputDocument> docIterator) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
addBean
public org.apache.solr.client.solrj.response.UpdateResponse addBean(String collection, Object obj) throws IOException, org.apache.solr.client.solrj.SolrServerException
- Overrides:
addBeanin classorg.apache.solr.client.solrj.SolrClient- Throws:
IOExceptionorg.apache.solr.client.solrj.SolrServerException
-
addBean
public org.apache.solr.client.solrj.response.UpdateResponse addBean(Object obj) throws IOException, org.apache.solr.client.solrj.SolrServerException
- Overrides:
addBeanin classorg.apache.solr.client.solrj.SolrClient- Throws:
IOExceptionorg.apache.solr.client.solrj.SolrServerException
-
addBean
public org.apache.solr.client.solrj.response.UpdateResponse addBean(String collection, Object obj, int commitWithinMs) throws IOException, org.apache.solr.client.solrj.SolrServerException
- Overrides:
addBeanin classorg.apache.solr.client.solrj.SolrClient- Throws:
IOExceptionorg.apache.solr.client.solrj.SolrServerException
-
addBean
public org.apache.solr.client.solrj.response.UpdateResponse addBean(Object obj, int commitWithinMs) throws IOException, org.apache.solr.client.solrj.SolrServerException
- Overrides:
addBeanin classorg.apache.solr.client.solrj.SolrClient- Throws:
IOExceptionorg.apache.solr.client.solrj.SolrServerException
-
addBeans
public org.apache.solr.client.solrj.response.UpdateResponse addBeans(String collection, Collection<?> beans) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addBeansin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
addBeans
public org.apache.solr.client.solrj.response.UpdateResponse addBeans(Collection<?> beans) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addBeansin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
addBeans
public org.apache.solr.client.solrj.response.UpdateResponse addBeans(String collection, Collection<?> beans, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addBeansin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
addBeans
public org.apache.solr.client.solrj.response.UpdateResponse addBeans(Collection<?> beans, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addBeansin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
addBeans
public org.apache.solr.client.solrj.response.UpdateResponse addBeans(String collection, Iterator<?> beanIterator) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addBeansin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
addBeans
public org.apache.solr.client.solrj.response.UpdateResponse addBeans(Iterator<?> beanIterator) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
addBeansin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
commit
public org.apache.solr.client.solrj.response.UpdateResponse commit(String collection) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
commitin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
commit
public org.apache.solr.client.solrj.response.UpdateResponse commit() throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
commitin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
commit
public org.apache.solr.client.solrj.response.UpdateResponse commit(String collection, boolean waitFlush, boolean waitSearcher) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
commitin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
commit
public org.apache.solr.client.solrj.response.UpdateResponse commit(boolean waitFlush, boolean waitSearcher) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
commitin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
commit
public org.apache.solr.client.solrj.response.UpdateResponse commit(String collection, boolean waitFlush, boolean waitSearcher, boolean softCommit) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
commitin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
commit
public org.apache.solr.client.solrj.response.UpdateResponse commit(boolean waitFlush, boolean waitSearcher, boolean softCommit) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
commitin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
optimize
public org.apache.solr.client.solrj.response.UpdateResponse optimize(String collection) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
optimizein classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
optimize
public org.apache.solr.client.solrj.response.UpdateResponse optimize() throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
optimizein classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
optimize
public org.apache.solr.client.solrj.response.UpdateResponse optimize(String collection, boolean waitFlush, boolean waitSearcher) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
optimizein classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
optimize
public org.apache.solr.client.solrj.response.UpdateResponse optimize(boolean waitFlush, boolean waitSearcher) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
optimizein classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
optimize
public org.apache.solr.client.solrj.response.UpdateResponse optimize(String collection, boolean waitFlush, boolean waitSearcher, int maxSegments) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
optimizein classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
optimize
public org.apache.solr.client.solrj.response.UpdateResponse optimize(boolean waitFlush, boolean waitSearcher, int maxSegments) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
optimizein classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
rollback
public org.apache.solr.client.solrj.response.UpdateResponse rollback(String collection) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
rollbackin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
rollback
public org.apache.solr.client.solrj.response.UpdateResponse rollback() throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
rollbackin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteById
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, String id) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByIdin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteById
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String id) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByIdin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteById
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, String id, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByIdin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteById
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String id, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByIdin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteById
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, List<String> ids) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByIdin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteById
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(List<String> ids) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByIdin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteById
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(String collection, List<String> ids, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByIdin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteById
public org.apache.solr.client.solrj.response.UpdateResponse deleteById(List<String> ids, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByIdin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteByQuery
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String collection, String query) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByQueryin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteByQuery
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String query) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByQueryin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteByQuery
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String collection, String query, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByQueryin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
deleteByQuery
public org.apache.solr.client.solrj.response.UpdateResponse deleteByQuery(String query, int commitWithinMs) throws org.apache.solr.client.solrj.SolrServerException, IOException
- Overrides:
deleteByQueryin classorg.apache.solr.client.solrj.SolrClient- Throws:
org.apache.solr.client.solrj.SolrServerExceptionIOException
-
-