Class TransactionalCollectionImpl<T,C extends Collection<T>>

java.lang.Object
java.util.AbstractCollection<T>
org.aksw.jenax.arq.dataset.diff.TransactionalCollectionImpl<T,C>
Type Parameters:
T -
C -
All Implemented Interfaces:
Iterable<T>, Collection<T>, TransactionalCollection<T>, org.apache.jena.sparql.core.Transactional
Direct Known Subclasses:
TransactionalSetImpl

public class TransactionalCollectionImpl<T,C extends Collection<T>> extends AbstractCollection<T> implements TransactionalCollection<T>
A wrapper for a collection that provides transactions using MRSW locking. Also uses copy-on-write; i.e. the thread with the write transaction creates a full copy of the underlying collection - which is far from optimal.
Author:
raven
  • Field Details

  • Constructor Details

    • TransactionalCollectionImpl

      public TransactionalCollectionImpl(C baseCollection, Function<? super C,? extends C> cloner)
  • Method Details

    • commit

      public void commit()
      Specified by:
      commit in interface org.apache.jena.sparql.core.Transactional
    • abort

      public void abort()
      Specified by:
      abort in interface org.apache.jena.sparql.core.Transactional
    • end

      public void end()
      Specified by:
      end in interface org.apache.jena.sparql.core.Transactional
    • begin

      public void begin(org.apache.jena.query.ReadWrite readWrite)
      Specified by:
      begin in interface org.apache.jena.sparql.core.Transactional
    • begin

      public void begin(org.apache.jena.query.TxnType txnType)
      Specified by:
      begin in interface org.apache.jena.sparql.core.Transactional
    • promote

      public boolean promote(org.apache.jena.sparql.core.Transactional.Promote promoteMode)
      Specified by:
      promote in interface org.apache.jena.sparql.core.Transactional
    • transactionMode

      public org.apache.jena.query.ReadWrite transactionMode()
      Specified by:
      transactionMode in interface org.apache.jena.sparql.core.Transactional
    • transactionType

      public org.apache.jena.query.TxnType transactionType()
      Specified by:
      transactionType in interface org.apache.jena.sparql.core.Transactional
    • isInTransaction

      public boolean isInTransaction()
      Specified by:
      isInTransaction in interface org.apache.jena.sparql.core.Transactional
    • mutate

      protected <X, R> R mutate(Function<C,R> action)
    • add

      public boolean add(T e)
      Specified by:
      add in interface Collection<T>
      Overrides:
      add in class AbstractCollection<T>
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface Collection<T>
      Specified by:
      iterator in interface Iterable<T>
      Specified by:
      iterator in class AbstractCollection<T>
    • contains

      public boolean contains(Object o)
      Specified by:
      contains in interface Collection<T>
      Overrides:
      contains in class AbstractCollection<T>
    • size

      public int size()
      Specified by:
      size in interface Collection<T>
      Specified by:
      size in class AbstractCollection<T>