Class ReadReplicaAwareTransactionRoutingDataSource

java.lang.Object
org.springframework.jdbc.datasource.AbstractDataSource
org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource
ch.admin.bit.jeap.db.tx.ReadReplicaAwareTransactionRoutingDataSource
All Implemented Interfaces:
Wrapper, CommonDataSource, DataSource, org.springframework.beans.factory.InitializingBean

public class ReadReplicaAwareTransactionRoutingDataSource extends org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource
This DataSource implementation resolves a target DataSource depending on the read-only value of the top-level transaction.

The method determineCurrentLookupKey is only called when the top-level transaction is started in a thread.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
     

    Fields inherited from class org.springframework.jdbc.datasource.AbstractDataSource

    logger
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected Object
     

    Methods inherited from class org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource

    afterPropertiesSet, createConnectionBuilder, createShardingKeyBuilder, determineTargetDataSource, getConnection, getConnection, getResolvedDataSources, getResolvedDefaultDataSource, initialize, isWrapperFor, resolveSpecifiedDataSource, resolveSpecifiedLookupKey, setDataSourceLookup, setDefaultTargetDataSource, setLenientFallback, setTargetDataSources, unwrap

    Methods inherited from class org.springframework.jdbc.datasource.AbstractDataSource

    getLoginTimeout, getLogWriter, getParentLogger, setLoginTimeout, setLogWriter

    Methods inherited from class java.lang.Object

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

  • Constructor Details

    • ReadReplicaAwareTransactionRoutingDataSource

      public ReadReplicaAwareTransactionRoutingDataSource()
  • Method Details

    • determineCurrentLookupKey

      protected Object determineCurrentLookupKey()
      Specified by:
      determineCurrentLookupKey in class org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource