Interface IgniteInternalTx

    • Method Detail

      • localResult

        boolean localResult()
        Returns:
        True if transaction started on the node initiated cache operation.
      • xid

        IgniteUuid xid()
        Gets unique identifier for this transaction.
        Returns:
        Transaction UID.
      • nodeId

        UUID nodeId()
        ID of the node on which this transaction started.
        Returns:
        Originating node ID.
      • threadId

        long threadId()
        ID of the thread in which this transaction started.
        Returns:
        Thread ID.
      • startTime

        long startTime()
        Start time of this transaction.
        Returns:
        Start time of this transaction on this node.
      • startTimeNanos

        long startTimeNanos()
        Start time of this transaction in nanoseconds to measure duration.
        Returns:
        Start time of this transaction in nanoseconds.
      • isolation

        TransactionIsolation isolation()
        Cache transaction isolation level.
        Returns:
        Isolation level.
      • concurrency

        TransactionConcurrency concurrency()
        Cache transaction concurrency mode.
        Returns:
        Concurrency mode.
      • implicit

        boolean implicit()
        Flag indicating whether transaction was started automatically by the system or not. System will start transactions implicitly whenever any cache put(..) or remove(..) operation is invoked outside of transaction.
        Returns:
        True if transaction was started implicitly.
      • isInvalidate

        boolean isInvalidate()
        Get invalidation flag for this transaction. If set to true, then remote values will be invalidated (set to null) instead of updated.

        Invalidation messages don't carry new values, so they are a lot lighter than update messages. However, when a value is accessed on a node after it's been invalidated, it must be loaded from persistent store.

        Returns:
        Invalidation flag.
      • state

        TransactionState state()
        Gets current transaction state value.
        Returns:
        Current transaction state.
      • timeout

        long timeout()
        Gets timeout value in milliseconds for this transaction. If transaction times out prior to it's completion, IgniteTxTimeoutCheckedException will be thrown.
        Returns:
        Transaction timeout value.
      • timeout

        long timeout​(long timeout)
        Sets transaction timeout value. This value can be set only before a first operation on transaction has been performed.
        Parameters:
        timeout - Transaction timeout value.
        Returns:
        Previous timeout.
      • errorWhenCommitting

        void errorWhenCommitting()
        Changes transaction state from COMMITTING to MARKED_ROLLBACK. Must be called only from thread committing transaction.
      • setRollbackOnly

        boolean setRollbackOnly()
        Modify the transaction associated with the current thread such that the only possible outcome of the transaction is to roll back the transaction.
        Returns:
        True if rollback-only flag was set as a result of this operation, false if it was already set prior to this call or could not be set because transaction is already finishing up committing or rolling back.
      • isRollbackOnly

        boolean isRollbackOnly()
        If transaction was marked as rollback-only.
        Returns:
        True if transaction can only be rolled back.
      • removeMeta

        @Nullable
        <T> T removeMeta​(int key)
        Removes metadata by key.
        Type Parameters:
        T - Type of the value.
        Parameters:
        key - Key of the metadata to remove.
        Returns:
        Value of removed metadata or null.
      • meta

        @Nullable
        <T> T meta​(int key)
        Gets metadata by key.
        Type Parameters:
        T - Type of the value.
        Parameters:
        key - Metadata key.
        Returns:
        Metadata value or null.
      • addMeta

        @Nullable
        <T> T addMeta​(int key,
                      T val)
        Adds a new metadata.
        Type Parameters:
        T - Type of the value.
        Parameters:
        key - Metadata key.
        val - Metadata value.
        Returns:
        Metadata previously associated with given name, or null if there was none.
      • size

        int size()
        Returns:
        Size of the transaction.
      • storeEnabled

        boolean storeEnabled()
        Returns:
        True if transaction is allowed to use store.
      • storeWriteThrough

        boolean storeWriteThrough()
        Returns:
        True if transaction is allowed to use store and transactions spans one or more caches with store enabled.
      • system

        boolean system()
        Checks if this is system cache transaction. System transactions are isolated from user transactions because some of the public API methods may be invoked inside user transactions and internally start system cache transactions.
        Returns:
        True if transaction is started for system cache.
      • ioPolicy

        byte ioPolicy()
        Returns:
        Pool where message for the given transaction must be processed.
      • implicitSingle

        boolean implicitSingle()
        Returns:
        Flag indicating whether transaction is implicit with only one key.
      • activeCachesDeploymentEnabled

        boolean activeCachesDeploymentEnabled()
        Returns:
        true or false if the deployment is enabled or disabled for all active caches involved in this transaction.
      • activeCachesDeploymentEnabled

        void activeCachesDeploymentEnabled​(boolean depEnabled)
        Parameters:
        depEnabled - Flag indicating whether deployment is enabled for caches from this transaction or not.
      • topologyVersion

        AffinityTopologyVersion topologyVersion​(AffinityTopologyVersion topVer)
        Attempts to set topology version and returns the current value. If topology version was previously set, then it's value will be returned (but not updated).
        Parameters:
        topVer - Topology version.
        Returns:
        Recorded topology version.
      • empty

        boolean empty()
        Returns:
        True if transaction is empty.
      • addInvalidPartition

        void addInvalidPartition​(int cacheId,
                                 int part)
        Parameters:
        cacheId - Cache id.
        part - Invalid partition.
      • ownedVersion

        @Nullable
        @Nullable GridCacheVersion ownedVersion​(IgniteTxKey key)
        Gets owned version for near remote transaction.
        Parameters:
        key - Key to get version for.
        Returns:
        Owned version, if any.
      • otherNodeId

        @Nullable
        @Nullable UUID otherNodeId()
        Gets ID of additional node involved. For example, in DHT case, other node is near node ID.
        Returns:
        Parent node IDs.
      • eventNodeId

        UUID eventNodeId()
        Returns:
        Event node ID.
      • originatingNodeId

        UUID originatingNodeId()
        Gets node ID which directly started this transaction. In case of DHT local transaction it will be near node ID, in case of DHT remote transaction it will be primary node ID.
        Returns:
        Originating node ID.
      • masterNodeIds

        Collection<UUID> masterNodeIds()
        Returns:
        Master node IDs.
      • nearXidVersion

        @Nullable
        @Nullable GridCacheVersion nearXidVersion()
        Returns:
        Near transaction ID.
      • transactionNodes

        @Nullable
        @Nullable Map<UUID,​Collection<UUID>> transactionNodes()
        Returns:
        Transaction nodes mapping (primary node -> related backup nodes).
      • ownsLockUnsafe

        boolean ownsLockUnsafe​(GridCacheEntryEx entry)
        Parameters:
        entry - Entry to check.
        Returns:
        True if lock is owned.
      • near

        boolean near()
        Returns:
        True if near transaction.
      • dht

        boolean dht()
        Returns:
        True if DHT transaction.
      • colocated

        boolean colocated()
        Returns:
        True if dht colocated transaction.
      • local

        boolean local()
        Returns:
        True if transaction is local, false if it's remote.
      • subjectId

        UUID subjectId()
        Returns:
        Subject ID initiated this transaction.
      • taskNameHash

        int taskNameHash()
        Task name hash in case if transaction was initiated within task execution.
        Returns:
        Task name hash.
      • user

        boolean user()
        Returns:
        True if transaction is user transaction, which means:
        • Explicit
        • Local
        • Not DHT
      • hasWriteKey

        boolean hasWriteKey​(IgniteTxKey key)
        Parameters:
        key - Key to check.
        Returns:
        True if key is present.
      • optimisticLockEntries

        Collection<IgniteTxEntry> optimisticLockEntries()
        Gets a list of entries that needs to be locked on the next step of prepare stage of optimistic transaction.
        Returns:
        List of tx entries for optimistic locking.
      • seal

        void seal()
        Seals transaction for updates.
      • entry

        @Nullable
        @Nullable IgniteTxEntry entry​(IgniteTxKey key)
        Parameters:
        key - Key for the entry.
        Returns:
        Entry for the key (either from write set or read set).
      • commitVersion

        GridCacheVersion commitVersion()
        Returns:
        Version created at commit time.
      • commitVersion

        void commitVersion​(GridCacheVersion commitVer)
        Parameters:
        commitVer - Commit version.
      • writeVersion

        GridCacheVersion writeVersion()
        Returns:
        Transaction write version. For all transactions except DHT transactions, will be equal to xidVersion().
      • writeVersion

        void writeVersion​(GridCacheVersion ver)
        Sets write version.
        Parameters:
        ver - Write version.
      • currentPrepareFuture

        @Nullable
        @Nullable IgniteInternalFuture<?> currentPrepareFuture()
        Returns:
        Future for transaction prepare if prepare is in progress.
      • state

        boolean state​(TransactionState state)
        Parameters:
        state - Transaction state.
        Returns:
        True if transition was valid, false otherwise.
      • invalidate

        void invalidate​(boolean invalidate)
        Parameters:
        invalidate - Invalidate flag.
      • systemInvalidate

        void systemInvalidate​(boolean sysInvalidate)
        Parameters:
        sysInvalidate - System invalidate flag.
      • isSystemInvalidate

        boolean isSystemInvalidate()
        Returns:
        System invalidate flag.
      • commitAsync

        IgniteInternalFuture<IgniteInternalTx> commitAsync()
        Asynchronously commits this transaction by initiating two-phase-commit process.
        Returns:
        Future for commit operation.
      • onOwnerChanged

        boolean onOwnerChanged​(GridCacheEntryEx entry,
                               GridCacheMvccCandidate owner)
        Callback invoked whenever there is a lock that has been acquired by this transaction for any of the participating entries.
        Parameters:
        entry - Cache entry.
        owner - Lock candidate that won ownership of the lock.
        Returns:
        True if transaction cared about notification.
      • timedOut

        boolean timedOut()
        Returns:
        True if transaction timed out.
      • done

        boolean done()
        Returns:
        True if transaction had completed successfully or unsuccessfully.
      • optimistic

        boolean optimistic()
        Returns:
        True for OPTIMISTIC transactions.
      • pessimistic

        boolean pessimistic()
        Returns:
        True for PESSIMISTIC transactions.
      • readCommitted

        boolean readCommitted()
        Returns:
        True if read-committed.
      • repeatableRead

        boolean repeatableRead()
        Returns:
        True if repeatable-read.
      • serializable

        boolean serializable()
        Returns:
        True if serializable.
      • needsCompletedVersions

        boolean needsCompletedVersions()
        Returns:
        True if transaction needs completed versions for processing.
      • internal

        boolean internal()
        Returns:
        True if transaction has at least one internal entry.
      • onePhaseCommit

        boolean onePhaseCommit()
        Returns:
        True if transaction is a one-phase-commit transaction.
      • commitError

        void commitError​(Throwable e)
        Parameters:
        e - Commit error.
      • label

        @Nullable
        @Nullable String label()
        Returns label of transactions.
        Returns:
        Label of transaction or null if there was not set.
      • incrementalSnapshotId

        @Nullable
        @Nullable UUID incrementalSnapshotId()
        Returns:
        ID of incremental snapshot after which this transaction commits, null if snapshot isn't running.
      • incrementalSnapshotId

        void incrementalSnapshotId​(@Nullable
                                   @Nullable UUID id)
        Parameters:
        id - ID of incremental snapshot after which this transaction commits, null if snapshot isn't running.
      • txCounters

        @Nullable
        @Contract("true -> !null;")
        @Nullable TxCounters txCounters​(boolean createIfAbsent)
        Parameters:
        createIfAbsent - True if non-null instance is needed.
        Returns:
        Transaction counters.