Class DenyAclCollector

java.lang.Object
org.opencastproject.elasticsearch.index.rebuild.DenyAclCollector

public final class DenyAclCollector extends Object
Collects the identifiers of objects whose ACL contains deny rules, so that an index rebuild can report them once at the end instead of logging a line per entry.

The search index cannot express denial, so such entries are dropped when an object is indexed. That is worth telling an administrator about, but the per-entry message it used to produce fired once per deny entry per object and drowned the rebuild log.

Collection is only active between start() and stop(), which IndexRebuildService brackets a rebuild with. Outside a rebuild — during ordinary indexing — record(java.lang.String) does nothing beyond a volatile read, so nothing accumulates in a long-running instance.

State is held per thread. A rebuild runs on the thread that called it, and keeping the collected ids thread-local means concurrent ordinary indexing on other threads cannot add to a rebuild's report, nor can two rebuilds interfere.

  • Method Summary

    Modifier and Type
    Method
    Description
    static Set<String>
    Return the identifiers collected on this thread, in encounter order.
    static void
    record(String identifier)
    Note that the object with the given identifier carries at least one deny entry.
    static void
    Start collecting on the current thread, discarding anything previously collected.
    static void
    Stop collecting on the current thread and release the collected identifiers.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • start

      public static void start()
      Start collecting on the current thread, discarding anything previously collected.
    • record

      public static void record(String identifier)
      Note that the object with the given identifier carries at least one deny entry. Does nothing when no rebuild is running on this thread.
      Parameters:
      identifier - the identifier of the event or series, may be null
    • collected

      public static Set<String> collected()
      Return the identifiers collected on this thread, in encounter order.
      Returns:
      the identifiers, empty if no rebuild is running
    • stop

      public static void stop()
      Stop collecting on the current thread and release the collected identifiers.