Class Tm1SessionPool.Builder

java.lang.Object
io.skipcheck.tm1.client.session.Tm1SessionPool.Builder
Enclosing class:
Tm1SessionPool

public static final class Tm1SessionPool.Builder extends Object
Builds a Tm1SessionPool.
  • Method Details

    • idleTimeout

      public Tm1SessionPool.Builder idleTimeout(Duration idleTimeout)
      How long a session may go unused before it's evicted. Default 10 minutes. Keep it below TM1's own session timeout, so the pool closes sessions before TM1 drops them.
      Parameters:
      idleTimeout - the idle limit
      Returns:
      this builder
    • maxAge

      public Tm1SessionPool.Builder maxAge(Duration maxAge)
      How long a session may live, used or not, before it's evicted. Default 8 hours. A session also picks up security changes, such as new rights, only when it's new.
      Parameters:
      maxAge - the age limit
      Returns:
      this builder
    • maxSize

      public Tm1SessionPool.Builder maxSize(int maxSize)
      The most sessions the pool holds; beyond it, the least recently used is evicted. Default 100. Evicted sessions in their grace period don't count.
      Parameters:
      maxSize - the limit, at least 1
      Returns:
      this builder
    • closeGrace

      public Tm1SessionPool.Builder closeGrace(Duration closeGrace)
      How long an evicted session stays open before it's closed, for a caller that got it just before and hasn't sent its request yet. A session with a request running stays open until that finishes, however long the grace period. Default 30 s; zero closes at once.
      Parameters:
      closeGrace - the grace period
      Returns:
      this builder
    • sweepInterval

      public Tm1SessionPool.Builder sweepInterval(Duration sweepInterval)
      How often the pool looks for expired sessions on its own, besides on each Tm1SessionPool.session(Tm1Identity) call. Default 1 minute.
      Parameters:
      sweepInterval - the interval
      Returns:
      this builder
    • scheduler

      public Tm1SessionPool.Builder scheduler(reactor.core.scheduler.Scheduler scheduler)
      Where the pool's timers run, and its clock. Default Schedulers.parallel(); tests can pass a VirtualTimeScheduler.
      Parameters:
      scheduler - the scheduler
      Returns:
      this builder
    • build

      public Tm1SessionPool build()
      The pool. It starts its sweep at once, and opens sessions only when asked.
      Returns:
      the pool