Class StateCacheProperties

java.lang.Object
swiss.trustbroker.config.dto.StateCacheProperties

public class StateCacheProperties extends Object
Configuration for DB state cache.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    StateCacheProperties(int targetMaxEntries, int minSessionLifetimeSec, String reapSchedule, int reapMaxDelaySec, int reapWarnThresholdMs, int txCommitDelay, int txRetryDelayMs, int txRetryCount, boolean schemaMigration)
    Creates a new StateCacheProperties instance.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    protected boolean
     
    boolean
     
    int
    Prevents collecting sessions related to a pending login.
    int
    Delay at most 25 sec randomly to allow multiple reapers on the same session DB.
    Use by scheduled job checking for expired sessions and delete them from the session DB StateCache.
    int
    Expected reap cycle execution in milliseconds before we start to WARN about bad performance.
    int
    If the session DB runs full (more than targetMaxEntries), XTB starts garbage collecting sessions, that might expire anyway soon to make room for new sessions and prevent storage issues.
    int
    Delay before transaction commit in milliseconds.
    int
    Number of retries doubling the txRetryDelayMs on every try.
    int
    Delay before transaction retry in milliseconds (negative values indicate no retry).
    int
     
    boolean
    State cache schema migration.
    void
    setMinSessionLifetimeSec(int minSessionLifetimeSec)
    Prevents collecting sessions related to a pending login.
    void
    setReapMaxDelaySec(int reapMaxDelaySec)
    Delay at most 25 sec randomly to allow multiple reapers on the same session DB.
    void
    setReapSchedule(String reapSchedule)
    Use by scheduled job checking for expired sessions and delete them from the session DB StateCache.
    void
    setReapWarnThresholdMs(int reapWarnThresholdMs)
    Expected reap cycle execution in milliseconds before we start to WARN about bad performance.
    void
    setSchemaMigration(boolean schemaMigration)
    State cache schema migration.
    void
    setTargetMaxEntries(int targetMaxEntries)
    If the session DB runs full (more than targetMaxEntries), XTB starts garbage collecting sessions, that might expire anyway soon to make room for new sessions and prevent storage issues.
    void
    setTxCommitDelay(int txCommitDelay)
    Delay before transaction commit in milliseconds.
    void
    setTxRetryCount(int txRetryCount)
    Number of retries doubling the txRetryDelayMs on every try.
    void
    setTxRetryDelayMs(int txRetryDelayMs)
    Delay before transaction retry in milliseconds (negative values indicate no retry).
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • StateCacheProperties

      public StateCacheProperties()
    • StateCacheProperties

      public StateCacheProperties(int targetMaxEntries, int minSessionLifetimeSec, String reapSchedule, int reapMaxDelaySec, int reapWarnThresholdMs, int txCommitDelay, int txRetryDelayMs, int txRetryCount, boolean schemaMigration)
      Creates a new StateCacheProperties instance.
      Parameters:
      targetMaxEntries - If the session DB runs full (more than targetMaxEntries), XTB starts garbage collecting sessions, that might expire anyway soon to make room for new sessions and prevent storage issues.
      minSessionLifetimeSec - Prevents collecting sessions related to a pending login.
      reapSchedule - Use by scheduled job checking for expired sessions and delete them from the session DB StateCache. When multiple pods are running the reapMaxDelaySec is used to randomly delay the reaping to reduce concurrent work on the same data.
      Cron expression, default is '30 * * * * *' which means run every 60sec at HH:MM:30
      reapMaxDelaySec - Delay at most 25 sec randomly to allow multiple reapers on the same session DB.
      reapWarnThresholdMs - Expected reap cycle execution in milliseconds before we start to WARN about bad performance.
      Default: 10000
      txCommitDelay - Delay before transaction commit in milliseconds. For testing race conditions only, do not set in production environments!
      Default: 0
      txRetryDelayMs - Delay before transaction retry in milliseconds (negative values indicate no retry).
      Default: -1
      txRetryCount - Number of retries doubling the txRetryDelayMs on every try.
      Default: 0
      schemaMigration - State cache schema migration. Currently unused.
      Default: true
      Since:
      1.9.0, 1.10.0
  • Method Details

    • builder

    • getTargetMaxEntries

      public int getTargetMaxEntries()
      If the session DB runs full (more than targetMaxEntries), XTB starts garbage collecting sessions, that might expire anyway soon to make room for new sessions and prevent storage issues.
    • getMinSessionLifetimeSec

      public int getMinSessionLifetimeSec()
      Prevents collecting sessions related to a pending login.
    • getReapSchedule

      public String getReapSchedule()
      Use by scheduled job checking for expired sessions and delete them from the session DB StateCache. When multiple pods are running the reapMaxDelaySec is used to randomly delay the reaping to reduce concurrent work on the same data.
      Cron expression, default is '30 * * * * *' which means run every 60sec at HH:MM:30
    • getReapMaxDelaySec

      public int getReapMaxDelaySec()
      Delay at most 25 sec randomly to allow multiple reapers on the same session DB.
    • getReapWarnThresholdMs

      public int getReapWarnThresholdMs()
      Expected reap cycle execution in milliseconds before we start to WARN about bad performance.
      Default: 10000
    • getTxCommitDelay

      public int getTxCommitDelay()
      Delay before transaction commit in milliseconds. For testing race conditions only, do not set in production environments!
      Default: 0
    • getTxRetryDelayMs

      public int getTxRetryDelayMs()
      Delay before transaction retry in milliseconds (negative values indicate no retry).
      Default: -1
      Since:
      1.9.0
    • getTxRetryCount

      public int getTxRetryCount()
      Number of retries doubling the txRetryDelayMs on every try.
      Default: 0
      Since:
      1.10.0
    • isSchemaMigration

      public boolean isSchemaMigration()
      State cache schema migration. Currently unused.
      Default: true
    • setTargetMaxEntries

      public void setTargetMaxEntries(int targetMaxEntries)
      If the session DB runs full (more than targetMaxEntries), XTB starts garbage collecting sessions, that might expire anyway soon to make room for new sessions and prevent storage issues.
    • setMinSessionLifetimeSec

      public void setMinSessionLifetimeSec(int minSessionLifetimeSec)
      Prevents collecting sessions related to a pending login.
    • setReapSchedule

      public void setReapSchedule(String reapSchedule)
      Use by scheduled job checking for expired sessions and delete them from the session DB StateCache. When multiple pods are running the reapMaxDelaySec is used to randomly delay the reaping to reduce concurrent work on the same data.
      Cron expression, default is '30 * * * * *' which means run every 60sec at HH:MM:30
    • setReapMaxDelaySec

      public void setReapMaxDelaySec(int reapMaxDelaySec)
      Delay at most 25 sec randomly to allow multiple reapers on the same session DB.
    • setReapWarnThresholdMs

      public void setReapWarnThresholdMs(int reapWarnThresholdMs)
      Expected reap cycle execution in milliseconds before we start to WARN about bad performance.
      Default: 10000
    • setTxCommitDelay

      public void setTxCommitDelay(int txCommitDelay)
      Delay before transaction commit in milliseconds. For testing race conditions only, do not set in production environments!
      Default: 0
    • setTxRetryDelayMs

      public void setTxRetryDelayMs(int txRetryDelayMs)
      Delay before transaction retry in milliseconds (negative values indicate no retry).
      Default: -1
      Since:
      1.9.0
    • setTxRetryCount

      public void setTxRetryCount(int txRetryCount)
      Number of retries doubling the txRetryDelayMs on every try.
      Default: 0
      Since:
      1.10.0
    • setSchemaMigration

      public void setSchemaMigration(boolean schemaMigration)
      State cache schema migration. Currently unused.
      Default: true
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object