InteractionLayer (record)

Binds an Interaction (WHAT is being executed) with an InteractionContext (WHO is executing, WHEN and WHERE).

InteractionLayer s are so called because they may be nested (held in a stack). For example the org.apache.causeway.applib.services.sudo.SudoService creates a new temporary layer with a different InteractionContext#getUser() user , while fixtures that mock the clock switch out the InteractionContext#getClock() clock .

The stack of layers is per-thread, managed by InteractionService as a thread-local).

API

InteractionLayer.java
record InteractionLayer {
  InteractionLayer(InteractionLayer parent, InteractionContext interactionContext, InteractionCarrier interactionCarrier)
  InteractionLayer addOnCloseListener(Runnable listener)
  Interaction interaction()
  boolean isRoot()
  int parentCount()
  int totalLayerCount()
  InteractionLayer rootLayer()
  boolean isClosed()
  void close(FirstExceptionCollector exCollector)
  void closeAll(FirstExceptionCollector exCollector)
}