Package org.gridgain.grid.cache

Examples of org.gridgain.grid.cache.GridCacheTxState


    }

    /** {@inheritDoc} */
    @Override public void prepare() throws GridException {
        if (!state(PREPARING)) {
            GridCacheTxState state = state();

            // If other thread is doing "prepare", then no-op.
            if (state == PREPARING || state == PREPARED || state == COMMITTING || state == COMMITTED)
                return;

View Full Code Here


    /**
     *
     */
    @Override public void close() throws GridException {
        GridCacheTxState state = state();

        if (state != ROLLING_BACK && state != ROLLED_BACK && state != COMMITTING && state != COMMITTED)
            rollback();

        awaitCompletion();
View Full Code Here

     */
    @SuppressWarnings({"TooBroadScope"})
    private boolean state(GridCacheTxState state, boolean timedOut) {
        boolean valid = false;

        GridCacheTxState prev;

        boolean notify = false;

        lock();

View Full Code Here

    /**
     *
     * @return {@code true} if jta was already committed or rolled back.
     */
    public boolean isFinished() {
        GridCacheTxState state = cacheTx.state();

        return state == COMMITTED || state == ROLLED_BACK;
    }
View Full Code Here

    @Override public void commit() throws GridException {
        if (optimistic())
            state(PREPARED);

        if (!state(COMMITTING)) {
            GridCacheTxState state = state();

            // If other thread is doing commit, then no-op.
            if (state == COMMITTING || state == COMMITTED)
                return;
View Full Code Here

    }

    /** {@inheritDoc} */
    @SuppressWarnings({"CatchGenericClass"})
    @Override public void userCommit() throws GridException {
        GridCacheTxState state = state();

        if (state != COMMITTING) {
            if (timedOut())
                throw new GridCacheTxTimeoutException("Transaction timed out: " + this);

View Full Code Here

        return rolledbackVers;
    }

    /** {@inheritDoc} */
    @Override public void userRollback() throws GridException {
        GridCacheTxState state = state();

        if (state != ROLLING_BACK && state != ROLLED_BACK) {
            setRollbackOnly();

            throw new GridException("Invalid transaction state for rollback [state=" + state + ", tx=" + this + ']',
View Full Code Here

        if (isRollbackOnly()) {
            if (timedOut())
                throw new GridCacheTxTimeoutException("Cache transaction timed out: " + this);

            GridCacheTxState state = state();

            if (state == ROLLING_BACK || state == ROLLED_BACK)
                throw new GridCacheTxRollbackException("Cache transaction is marked as rollback-only " +
                    "(will be rolled back automatically): " + this);
View Full Code Here

        long drExpireTime, @Nullable GridCacheVersion drVer) {
        K key = entry.key();

        checkInternal(key);

        GridCacheTxState state = state();

        assert state == GridCacheTxState.ACTIVE || timedOut() :
            "Invalid tx state for adding entry [op=" + op + ", val=" + val + ", entry=" + entry + ", filter=" +
                Arrays.toString(filter) + ", txCtx=" + cctx.tm().txContextVersion() + ", tx=" + this + ']';
View Full Code Here

     * @throws GridException If failed.
     */
    @Nullable public GridFuture<Boolean> addEntry(long msgId, GridCacheTxEntry<K, V> e) throws GridException {
        init();

        GridCacheTxState state = state();

        assert state == ACTIVE || (state == PREPARING && optimistic()) : "Invalid tx state for " +
            "adding entry [msgId=" + msgId + ", e=" + e + ", tx=" + this + ']';

        e.unmarshal(cctx, cctx.deploy().globalLoader());
View Full Code Here

TOP

Related Classes of org.gridgain.grid.cache.GridCacheTxState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.