Tm1SessionPool.Builder
import io.skipcheck.tm1.client.session.Tm1SessionPool.Builder; Builds a Tm1SessionPool.
Members
idleTimeout | How long a session may go unused before it's evicted. |
maxAge | How long a session may live, used or not, before it's evicted. |
maxSize | The most sessions the pool holds; beyond it, the least recently used is evicted. |
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. |
sweepInterval | How often the pool looks for expired sessions on its own, besides on each Tm1SessionPool.session call. |
scheduler | Where the pool's timers run, and its clock. |
build | The pool. |
idleTimeout
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
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
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
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
Tm1SessionPool.Builder sweepInterval(Duration sweepInterval) How often the pool looks for expired sessions on its own, besides on each
Tm1SessionPool.session call. Default 1 minute.
Parameters
sweepInterval- the interval
Returns
- this builder
scheduler
Tm1SessionPool.Builder 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
Tm1SessionPool build()The pool. It starts its sweep at once, and opens sessions only when asked.
Returns
- the pool
Also in the Javadoc.