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 Details

  • Constructor Details

    • CursorService

      public CursorService(Function<O,R> extractor)
  • Method Details

    • 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 input CursorService and generates a new scrollId to associate with.
      Returns:
      the scrollId associated to the cursor.
    • registerCursor

      public String registerCursor(String scrollId, C cursor, int batchSize, int keepAliveSeconds)
      Registers the input CursorService associated to the input scrollId.
      Returns:
      the scrollId associated to the cursor.
    • registerCursorResult

      public String registerCursorResult(CursorResult<C,O> cursorResult)
      Registers the input CursorResult and generates a new scrollId to associate with.
      Returns:
      the scrollId associated to the cursor result.
    • registerCursorResult

      public String registerCursorResult(String scrollId, CursorResult<C,O> cursorResult)
      Registers the input CursorResult associated to the input scrollId.
      Returns:
      the scrollId associated to the cursor result.
    • unregisterCursor

      public boolean unregisterCursor(String scrollId)
      Unregisters cursor associated to the input scrollId.
      Parameters:
      scrollId - The scoll id of CursorResult to 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.