Package org.nuxeo.ecm.core.api
Class CursorService<C,O,R>
- java.lang.Object
-
- org.nuxeo.ecm.core.api.CursorService<C,O,R>
-
- Type Parameters:
C- The cursor type.O- The cursor item type.R- The result type.
- Direct Known Subclasses:
MongoDBCursorService
public class CursorService<C,O,R> extends Object
A low level holder of DB cursors that manages cleaning on timeout.- Since:
- 9.1
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,CursorResult<C,O>>cursorResultsprotected Function<O,R>extractor
-
Constructor Summary
Constructors Constructor Description CursorService(Function<O,R> extractor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckForTimedOutScroll()voidclear()Clear and close all cursors owned by this service.protected booleanisScrollTimedOut(String scrollId, CursorResult<C,O> cursorResult)StringregisterCursor(C cursor, int batchSize, int keepAliveSeconds)Registers the inputCursorServiceand generates a newscrollIdto associate with.StringregisterCursor(String scrollId, C cursor, int batchSize, int keepAliveSeconds)Registers the inputCursorServiceassociated to the inputscrollId.StringregisterCursorResult(String scrollId, CursorResult<C,O> cursorResult)Registers the inputCursorResultassociated to the inputscrollId.StringregisterCursorResult(CursorResult<C,O> cursorResult)Registers the inputCursorResultand generates a newscrollIdto associate with.ScrollResult<R>scroll(String scrollId)booleanunregisterCursor(String scrollId)Unregisters cursor associated to the inputscrollId.
-
-
-
Method Detail
-
checkForTimedOutScroll
public void checkForTimedOutScroll()
-
isScrollTimedOut
protected boolean isScrollTimedOut(String scrollId, CursorResult<C,O> cursorResult)
-
registerCursor
public String registerCursor(C cursor, int batchSize, int keepAliveSeconds)
Registers the inputCursorServiceand generates a newscrollIdto associate with.- Returns:
- the scrollId associated to the cursor.
-
registerCursor
public String registerCursor(String scrollId, C cursor, int batchSize, int keepAliveSeconds)
Registers the inputCursorServiceassociated to the inputscrollId.- Returns:
- the scrollId associated to the cursor.
-
registerCursorResult
public String registerCursorResult(CursorResult<C,O> cursorResult)
Registers the inputCursorResultand generates a newscrollIdto associate with.- Returns:
- the scrollId associated to the cursor result.
-
registerCursorResult
public String registerCursorResult(String scrollId, CursorResult<C,O> cursorResult)
Registers the inputCursorResultassociated to the inputscrollId.- Returns:
- the scrollId associated to the cursor result.
-
unregisterCursor
public boolean unregisterCursor(String scrollId)
Unregisters cursor associated to the inputscrollId.- Parameters:
scrollId- The scoll id ofCursorResultto unregister- Returns:
- Whether or not the cursor was unregistered.
-
scroll
public ScrollResult<R> scroll(String scrollId)
- Returns:
- the next batch of cursor associated to the input
scrollId
-
clear
public void clear()
Clear and close all cursors owned by this service.
-
-