Class TransactionDataImpl<T extends TransactionData>

  • All Implemented Interfaces:
    TransactionData

    public class TransactionDataImpl<T extends TransactionData>
    extends java.lang.Object
    implements TransactionData
    Hold data accumulated during a transaction which we want to persist just prior to commit. Because multiple datasources could be involved in a distributed transaction, we need to hold TransactionData for each. Note that because all of this relates to a single transaction, this also means that it's a single thread, so there are no concurrency issues.
    • Constructor Summary

      Constructors 
      Constructor Description
      TransactionDataImpl​(java.util.function.Function<java.lang.String,​T> mappingFunction)
      Public constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      T findOrCreate​(java.lang.String datasourceName)
      Get the TransactionData for the given datasourceName, creating a new instance one currently doesn't exist
      void persist()
      Persist the data.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TransactionDataImpl

        public TransactionDataImpl​(java.util.function.Function<java.lang.String,​T> mappingFunction)
        Public constructor
        Parameters:
        mappingFunction - Function to create new TransactionData instances if they don't yet exist
    • Method Detail

      • persist

        public void persist()
        Description copied from interface: TransactionData
        Persist the data. Don't propagate any exceptions. If an exception occurs, log the error and mark the transaction for rollback.
        Specified by:
        persist in interface TransactionData
      • findOrCreate

        public T findOrCreate​(java.lang.String datasourceName)
        Get the TransactionData for the given datasourceName, creating a new instance one currently doesn't exist
        Parameters:
        datasourceName -
        Returns: