Class TransactionProxyImpl<K,​V>

    • Constructor Detail

      • TransactionProxyImpl

        public TransactionProxyImpl()
        Empty constructor required for Externalizable.
      • TransactionProxyImpl

        public TransactionProxyImpl​(GridNearTxLocal tx,
                                    GridCacheSharedContext<K,​V> cctx,
                                    boolean async)
        Parameters:
        tx - Transaction.
        cctx - Shared context.
        async - Async flag.
    • Method Detail

      • xid

        public IgniteUuid xid()
        Gets unique identifier for this transaction.
        Specified by:
        xid in interface Transaction
        Returns:
        Transaction UID.
      • nodeId

        public UUID nodeId()
        ID of the node on which this transaction started.
        Specified by:
        nodeId in interface Transaction
        Returns:
        Originating node ID.
      • threadId

        public long threadId()
        ID of the thread in which this transaction started.
        Specified by:
        threadId in interface Transaction
        Returns:
        Thread ID.
      • startTime

        public long startTime()
        Start time of this transaction.
        Specified by:
        startTime in interface Transaction
        Returns:
        Start time of this transaction on this node.
      • isInvalidate

        public 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.

        Specified by:
        isInvalidate in interface Transaction
        Returns:
        Invalidation flag.
      • implicit

        public 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.
        Specified by:
        implicit in interface Transaction
        Returns:
        True if transaction was started implicitly.
      • timeout

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

        public TransactionState state()
        Gets current transaction state value.
        Specified by:
        state in interface Transaction
        Returns:
        Current transaction state.
      • timeout

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

        public IgniteAsyncSupport withAsync()
        Gets instance of this component with asynchronous mode enabled.
        Specified by:
        withAsync in interface IgniteAsyncSupport
        Returns:
        Instance of this component with asynchronous mode enabled.
      • isAsync

        public boolean isAsync()
        Specified by:
        isAsync in interface IgniteAsyncSupport
        Returns:
        True if asynchronous mode is enabled.
      • future

        public <R> IgniteFuture<R> future()
        Gets and resets future for previous asynchronous operation.
        Specified by:
        future in interface IgniteAsyncSupport
        Type Parameters:
        R - Type of the future result.
        Returns:
        Future for previous asynchronous operation.
      • setRollbackOnly

        public 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.
        Specified by:
        setRollbackOnly in interface 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

        public boolean isRollbackOnly()
        If transaction was marked as rollback-only.
        Specified by:
        isRollbackOnly in interface Transaction
        Returns:
        True if transaction can only be rolled back.
      • commit

        public void commit()
        Commits this transaction by initiating two-phase-commit process.
        Specified by:
        commit in interface Transaction
      • close

        public void close()
        Ends the transaction. Transaction will be rolled back if it has not been committed.
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface Transaction
      • rollback

        public void rollback()
        Rolls back this transaction. Note, that it's allowed to roll back transaction from any thread at any time.
        Specified by:
        rollback in interface Transaction
      • rollbackAsync

        public IgniteFuture<Void> rollbackAsync()
                                         throws IgniteException
        Asynchronously rolls back this transaction. Note, that it's allowed to roll back transaction from any thread at any time.
        Specified by:
        rollbackAsync in interface Transaction
        Returns:
        a Future representing pending completion of the rollback.
        Throws:
        IgniteException - If rollback failed.