#ignite-758: remove TransactionSynchronization.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c4b87088 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c4b87088 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c4b87088 Branch: refs/heads/ignite-478 Commit: c4b870882bfdf5d7a451f5b1a86d767a5f76f669 Parents: 7430e01 Author: ivasilinets <ivasilin...@gridgain.com> Authored: Fri Apr 17 17:36:42 2015 +0300 Committer: ivasilinets <ivasilin...@gridgain.com> Committed: Fri Apr 17 17:36:42 2015 +0300 ---------------------------------------------------------------------- .../cache/transactions/IgniteTxAdapter.java | 2 - .../cache/transactions/IgniteTxManager.java | 44 -------------------- .../TransactionSynchronization.java | 44 -------------------- 3 files changed, 90 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c4b87088/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java index 735e373..bc09f9e 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxAdapter.java @@ -1118,8 +1118,6 @@ public abstract class IgniteTxAdapter extends GridMetadataAwareAdapter // Seal transactions maps. if (state != ACTIVE) seal(); - - cctx.tm().onTxStateChange(prev, state, this); } return valid; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c4b87088/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java index 3216ec3..c05e559 100644 --- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java +++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/transactions/IgniteTxManager.java @@ -98,10 +98,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter { private final GridBoundedConcurrentOrderedMap<GridCacheVersion, Boolean> completedVers = new GridBoundedConcurrentOrderedMap<>(Integer.getInteger(IGNITE_MAX_COMPLETED_TX_COUNT, DFLT_MAX_COMPLETED_TX_CNT)); - /** Transaction synchronizations. */ - private final Collection<TransactionSynchronization> syncs = - new GridConcurrentHashSet<>(); - /** Transaction finish synchronizer. */ private GridCacheTxFinishSync txFinishSync; @@ -567,8 +563,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter { return false; } - onTxStateChange(null, ACTIVE, tx); - if (log.isDebugEnabled()) log.debug("Transaction started: " + tx); @@ -1708,44 +1702,6 @@ public class IgniteTxManager extends GridCacheSharedManagerAdapter { } /** - * @param sync Transaction synchronizations to add. - */ - public void addSynchronizations(TransactionSynchronization... sync) { - if (F.isEmpty(sync)) - return; - - F.copy(syncs, sync); - } - - /** - * @param sync Transaction synchronizations to remove. - */ - public void removeSynchronizations(TransactionSynchronization... sync) { - if (F.isEmpty(sync)) - return; - - F.lose(syncs, false, Arrays.asList(sync)); - } - - /** - * @return Registered transaction synchronizations - */ - public Collection<TransactionSynchronization> synchronizations() { - return Collections.unmodifiableList(new LinkedList<>(syncs)); - } - - /** - * @param prevState Previous state. - * @param newState New state. - * @param tx Cache transaction. - */ - public void onTxStateChange(@Nullable TransactionState prevState, TransactionState newState, IgniteInternalTx tx) { - // Notify synchronizations. - for (TransactionSynchronization s : syncs) - s.onStateChanged(prevState, newState, tx.proxy()); - } - - /** * @param tx Committing transaction. */ public void txContext(IgniteInternalTx tx) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c4b87088/modules/core/src/main/java/org/apache/ignite/transactions/TransactionSynchronization.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionSynchronization.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionSynchronization.java deleted file mode 100644 index 9766bdc..0000000 --- a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionSynchronization.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.ignite.transactions; - -import org.jetbrains.annotations.*; - -/** - * Synchronization callback for transaction. You can subscribe to receive transaction - * state change callbacks by registering transaction synchronization. - */ -public interface TransactionSynchronization { - /** - * State change callback for transaction. Note that unless transaction has been - * completed, it is possible to mark it for <tt>rollbackOnly</tt> by calling - * {@link Transaction#setRollbackOnly()} on the passed in transaction. - * You can check the return value of {@link Transaction#setRollbackOnly() setRollbackOnly()} - * method to see if transaction was indeed marked for rollback or not. - * - * @param prevState Previous state of the transaction. If transaction has just been - * started, then previous state is {@code null}. - * @param newState New state of the transaction. In majority of the cases this will be the - * same as {@link Transaction#state() tx.state()}, but it is also possible - * that transaction may be marked for rollback concurrently with this method - * invocation, and in that case <tt>newState</tt> reflects the actual state of the - * transition this callback is associated with. - * @param tx Transaction whose state has changed. - */ - public void onStateChanged(@Nullable TransactionState prevState, TransactionState newState, Transaction tx); -}