http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java b/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java new file mode 100644 index 0000000..da2d1bd --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/Transaction.java @@ -0,0 +1,275 @@ +/* + * 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.apache.ignite.*; +import org.apache.ignite.lang.*; +import org.jetbrains.annotations.*; + +import java.util.*; + +/** + * Grid cache transaction. Cache transactions have a default 2PC (two-phase-commit) behavior and + * can be plugged into ongoing {@code JTA} transaction by properly implementing + * {@ignitelink org.apache.ignite.cache.jta.CacheTmLookup} + * interface. Cache transactions can also be started explicitly directly from {@link org.apache.ignite.cache.CacheProjection} API + * via any of the {@code 'CacheProjection.txStart(..)'} methods. + * <p> + * Cache transactions support the following isolation levels: + * <ul> + * <li> + * {@link TransactionIsolation#READ_COMMITTED} isolation level means that always a committed value + * will be provided for read operations. With this isolation level values are always read + * from cache global memory or persistent store every time a value is accessed. In other words, + * if the same key is accessed more than once within the same transaction, it may have different + * value every time since global cache memory may be updated concurrently by other threads. + * </li> + * <li> + * {@link TransactionIsolation#REPEATABLE_READ} isolation level means that if a value was read once + * within transaction, then all consecutive reads will provide the same in-transaction value. With + * this isolation level accessed values are stored within in-transaction memory, so consecutive access + * to the same key within the same transaction will always return the value that was previously read or + * updated within this transaction. If concurrency is {@link TransactionConcurrency#PESSIMISTIC}, then a lock + * on the key will be acquired prior to accessing the value. + * </li> + * <li> + * {@link TransactionIsolation#SERIALIZABLE} isolation level means that all transactions occur in a completely + * isolated fashion, as if all transactions in the system had executed serially, one after the other. + * Read access with this level happens the same way as with {@link TransactionIsolation#REPEATABLE_READ} level. + * However, in {@link TransactionConcurrency#OPTIMISTIC} mode, if some transactions cannot be serially isolated + * from each other, then one winner will be picked and the other transactions in conflict will result in + * {@link org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException} being thrown. + * </li> + * </ul> + * <p> + * Cache transactions support the following concurrency models: + * <ul> + * <li> + * {@link TransactionConcurrency#OPTIMISTIC} - in this mode all cache operations are not distributed to other + * nodes until {@link #commit()} is called. In this mode one {@code 'PREPARE'} + * message will be sent to participating cache nodes to start acquiring per-transaction locks, and once + * all nodes reply {@code 'OK'} (i.e. {@code Phase 1} completes successfully), a one-way' {@code 'COMMIT'} + * message is sent without waiting for reply. If it is necessary to know whenever remote nodes have committed + * as well, synchronous commit or synchronous rollback should be enabled via + * {@link org.apache.ignite.configuration.CacheConfiguration#setWriteSynchronizationMode} + * or by setting proper flags on cache projection, such as {@link org.apache.ignite.internal.processors.cache.CacheFlag#SYNC_COMMIT}. + * <p> + * Note that in this mode, optimistic failures are only possible in conjunction with + * {@link TransactionIsolation#SERIALIZABLE} isolation level. In all other cases, optimistic + * transactions will never fail optimistically and will always be identically ordered on all participating + * grid nodes. + * </li> + * <li> + * {@link TransactionConcurrency#PESSIMISTIC} - in this mode a lock is acquired on all cache operations + * with exception of read operations in {@link TransactionIsolation#READ_COMMITTED} mode. All optional filters + * passed into cache operations will be evaluated after successful lock acquisition. Whenever + * {@link #commit()} is called, a single one-way {@code 'COMMIT'} message + * is sent to participating cache nodes without waiting for reply. Note that there is no reason for + * distributed 'PREPARE' step, as all locks have been already acquired. Just like with optimistic mode, + * it is possible to configure synchronous commit or rollback and wait till transaction commits on + * all participating remote nodes. + * </li> + * </ul> + * <p> + * <h1 class="header">Cache Atomicity Mode</h1> + * In addition to standard {@link org.apache.ignite.cache.CacheAtomicityMode#TRANSACTIONAL} behavior, Ignite also supports + * a lighter {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC} mode as well. In this mode distributed transactions + * and distributed locking are not supported. Disabling transactions and locking allows to achieve much higher + * performance and throughput ratios. It is recommended that {@link org.apache.ignite.cache.CacheAtomicityMode#ATOMIC} mode + * is used whenever full {@code ACID}-compliant transactions are not needed. + * <p> + * <h1 class="header">Usage</h1> + * You can use cache transactions as follows: + * <pre name="code" class="java"> + * Cache<String, Integer> cache = Ignition.ignite().cache(); + * + * try (GridCacheTx tx = cache.txStart()) { + * // Perform transactional operations. + * Integer v1 = cache.get("k1"); + * + * // Check if v1 satisfies some condition before doing a put. + * if (v1 != null && v1 > 0) + * cache.putx("k1", 2); + * + * cache.removex("k2"); + * + * // Commit the transaction. + * tx.commit(); + * } + * </pre> + */ +public interface Transaction extends AutoCloseable, IgniteAsyncSupport { + /** + * Gets unique identifier for this transaction. + * + * @return Transaction UID. + */ + public IgniteUuid xid(); + + /** + * ID of the node on which this transaction started. + * + * @return Originating node ID. + */ + public UUID nodeId(); + + /** + * ID of the thread in which this transaction started. + * + * @return Thread ID. + */ + public long threadId(); + + /** + * Start time of this transaction. + * + * @return Start time of this transaction on this node. + */ + public long startTime(); + + /** + * Cache transaction isolation level. + * + * @return Isolation level. + */ + public TransactionIsolation isolation(); + + /** + * Cache transaction concurrency mode. + * + * @return Concurrency mode. + */ + public TransactionConcurrency concurrency(); + + /** + * Flag indicating whether transaction was started automatically by the + * system or not. System will start transactions implicitly whenever + * any cache {@code put(..)} or {@code remove(..)} operation is invoked + * outside of transaction. + * + * @return {@code True} if transaction was started implicitly. + */ + public boolean implicit(); + + /** + * Get invalidation flag for this transaction. If set to {@code true}, then + * remote values will be {@code invalidated} (set to {@code null}) instead + * of updated. + * <p> + * 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. + * + * @return Invalidation flag. + */ + public boolean isInvalidate(); + + /** + * Gets current transaction state value. + * + * @return Current transaction state. + */ + public TransactionState state(); + + /** + * Gets timeout value in milliseconds for this transaction. If transaction times + * out prior to it's completion, {@link org.apache.ignite.internal.transactions.IgniteTxTimeoutCheckedException} will be thrown. + * + * @return Transaction timeout value. + */ + public long timeout(); + + /** + * Sets transaction timeout value. This value can be set only before a first operation + * on transaction has been performed. + * + * @param timeout Transaction timeout value. + * @return Previous timeout. + */ + public long timeout(long timeout); + + /** + * Modify the transaction associated with the current thread such that the + * only possible outcome of the transaction is to roll back the + * transaction. + * + * @return {@code True} if rollback-only flag was set as a result of this operation, + * {@code 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. + */ + public boolean setRollbackOnly(); + + /** + * If transaction was marked as rollback-only. + * + * @return {@code True} if transaction can only be rolled back. + */ + public boolean isRollbackOnly(); + + /** + * Commits this transaction by initiating {@code two-phase-commit} process. + * + * @throws IgniteException If commit failed. + */ + @IgniteAsyncSupported + public void commit() throws IgniteException; + + /** + * Ends the transaction. Transaction will be rolled back if it has not been committed. + * + * @throws IgniteException If transaction could not be gracefully ended. + */ + @Override public void close() throws IgniteException; + + /** + * Rolls back this transaction. + * + * @throws IgniteException If rollback failed. + */ + @IgniteAsyncSupported + public void rollback() throws IgniteException; + + /** + * Removes metadata by name. + * + * @param name Name of the metadata to remove. + * @param <V> Type of the value. + * @return Value of removed metadata or {@code null}. + */ + @Nullable public <V> V removeMeta(String name); + + /** + * Gets metadata by name. + * + * @param name Metadata name. + * @param <V> Type of the value. + * @return Metadata value or {@code null}. + */ + @Nullable public <V> V meta(String name); + + /** + * Adds a new metadata. + * + * @param name Metadata name. + * @param val Metadata value. + * @param <V> Type of the value. + * @return Metadata previously associated with given name, or + * {@code null} if there was none. + */ + @Nullable public <V> V addMeta(String name, V val); +}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java new file mode 100644 index 0000000..64265a1 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionConcurrency.java @@ -0,0 +1,45 @@ +/* + * 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.*; + +/** + * Transaction concurrency control. See {@link Transaction} for more information + * on transaction concurrency controls. + */ +public enum TransactionConcurrency { + /** Optimistic concurrency control. */ + OPTIMISTIC, + + /** Pessimistic concurrency control. */ + PESSIMISTIC; + + /** Enum values. */ + private static final TransactionConcurrency[] VALS = values(); + + /** + * Efficiently gets enumerated value from its ordinal. + * + * @param ord Ordinal value. + * @return Enumerated value or {@code null} if ordinal out of range. + */ + @Nullable public static TransactionConcurrency fromOrdinal(int ord) { + return ord >= 0 && ord < VALS.length ? VALS[ord] : null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java new file mode 100644 index 0000000..fa82cf9 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionHeuristicException.java @@ -0,0 +1,51 @@ +/* + * 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.apache.ignite.*; + +/** + * Exception thrown whenever grid transaction enters an unknown state. + * This exception is usually thrown whenever commit partially succeeds. + * Cache will still resolve this situation automatically to ensure data + * integrity, by invalidating all values participating in this transaction + * on remote nodes. + */ +public class TransactionHeuristicException extends IgniteException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates new heuristic exception with given error message. + * + * @param msg Error message. + */ + public TransactionHeuristicException(String msg) { + super(msg); + } + + /** + * Creates new heuristic exception with given error message and optional nested exception. + * + * @param msg Error message. + * @param cause Optional nested exception (can be <tt>null</tt>). + */ + public TransactionHeuristicException(String msg, Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java new file mode 100644 index 0000000..1bc7f12 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionIsolation.java @@ -0,0 +1,49 @@ +/* + * 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.*; + +/** + * Defines different cache transaction isolation levels. See {@link Transaction} + * documentation for more information about cache transaction isolation levels. + */ +public enum TransactionIsolation { + /** Read committed isolation level. */ + READ_COMMITTED, + + /** Repeatable read isolation level. */ + REPEATABLE_READ, + + /** Serializable isolation level. */ + SERIALIZABLE; + + /** Enum values. */ + private static final TransactionIsolation[] VALS = values(); + + /** + * Efficiently gets enumerated value from its ordinal. + * + * @param ord Ordinal value. + * @return Enumerated value or {@code null} if ordinal out of range. + */ + @Nullable + public static TransactionIsolation fromOrdinal(int ord) { + return ord >= 0 && ord < VALS.length ? VALS[ord] : null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/TransactionMetrics.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionMetrics.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionMetrics.java new file mode 100644 index 0000000..0fd8f55 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionMetrics.java @@ -0,0 +1,53 @@ +/* + * 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 java.io.*; + +/** + * Transaction metrics, shared across all caches. + */ +public interface TransactionMetrics extends Serializable { + /** + * Gets last time transaction was committed. + * + * @return Last commit time. + */ + public long commitTime(); + + /** + * Gets last time transaction was rollback. + * + * @return Last rollback time. + */ + public long rollbackTime(); + + /** + * Gets total number of transaction commits. + * + * @return Number of transaction commits. + */ + public int txCommits(); + + /** + * Gets total number of transaction rollbacks. + * + * @return Number of transaction rollbacks. + */ + public int txRollbacks(); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java new file mode 100644 index 0000000..4dd9e12 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionOptimisticException.java @@ -0,0 +1,47 @@ +/* + * 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.apache.ignite.*; + +/** + * Exception thrown whenever grid transactions fail optimistically. + */ +public class TransactionOptimisticException extends IgniteException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates new optimistic exception with given error message. + * + * @param msg Error message. + */ + public TransactionOptimisticException(String msg) { + super(msg); + } + + /** + * Creates new optimistic exception with given error message and optional nested exception. + * + * @param msg Error message. + * @param cause Optional nested exception (can be <tt>null</tt>). + */ + public TransactionOptimisticException(String msg, Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java new file mode 100644 index 0000000..c551328 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionRollbackException.java @@ -0,0 +1,47 @@ +/* + * 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.apache.ignite.*; + +/** + * Exception thrown whenever grid transactions has been automatically rolled back. + */ +public class TransactionRollbackException extends IgniteException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates new rollback exception with given error message. + * + * @param msg Error message. + */ + public TransactionRollbackException(String msg) { + super(msg); + } + + /** + * Creates new rollback exception with given error message and optional nested exception. + * + * @param msg Error message. + * @param cause Optional nested exception (can be <tt>null</tt>). + */ + public TransactionRollbackException(String msg, Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/TransactionState.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionState.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionState.java new file mode 100644 index 0000000..5cacbf5 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionState.java @@ -0,0 +1,65 @@ +/* + * 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.*; + +/** + * Cache transaction state. + */ +public enum TransactionState { + /** Transaction started. */ + ACTIVE, + + /** Transaction validating. */ + PREPARING, + + /** Transaction validation succeeded. */ + PREPARED, + + /** Transaction is marked for rollback. */ + MARKED_ROLLBACK, + + /** Transaction commit started (validating finished). */ + COMMITTING, + + /** Transaction commit succeeded. */ + COMMITTED, + + /** Transaction rollback started (validation failed). */ + ROLLING_BACK, + + /** Transaction rollback succeeded. */ + ROLLED_BACK, + + /** Transaction rollback failed or is otherwise unknown state. */ + UNKNOWN; + + /** Enumerated values. */ + private static final TransactionState[] VALS = values(); + + /** + * Efficiently gets enumerated value from its ordinal. + * + * @param ord Ordinal value. + * @return Enumerated value or {@code null} if ordinal out of range. + */ + @Nullable public static TransactionState fromOrdinal(int ord) { + return ord >= 0 && ord < VALS.length ? VALS[ord] : null; + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/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 new file mode 100644 index 0000000..6e88876 --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionSynchronization.java @@ -0,0 +1,45 @@ +/* + * 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 via + * {@link org.apache.ignite.cache.GridCache#txSynchronize(TransactionSynchronization)} method. + */ +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); +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java ---------------------------------------------------------------------- diff --git a/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java new file mode 100644 index 0000000..019c9dc --- /dev/null +++ b/modules/core/src/main/java/org/apache/ignite/transactions/TransactionTimeoutException.java @@ -0,0 +1,47 @@ +/* + * 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.apache.ignite.*; + +/** + * Exception thrown whenever grid transactions time out. + */ +public class TransactionTimeoutException extends IgniteException { + /** */ + private static final long serialVersionUID = 0L; + + /** + * Creates new timeout exception with given error message. + * + * @param msg Error message. + */ + public TransactionTimeoutException(String msg) { + super(msg); + } + + /** + * Creates new timeout exception with given error message and optional nested exception. + * + * @param msg Error message. + * @param cause Optional nested exception (can be <tt>null</tt>). + */ + public TransactionTimeoutException(String msg, Throwable cause) { + super(msg, cause); + } +} http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java index f7dc4e1..3c04ea4 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcPojoStoreTest.java @@ -338,7 +338,7 @@ public class CacheJdbcPojoStoreTest extends GridCommonAbstractTest { */ public void testStore() throws Exception { // Create dummy transaction - IgniteTx tx = new DummyTx(); + Transaction tx = new DummyTx(); ses.newSession(tx); @@ -389,7 +389,7 @@ public class CacheJdbcPojoStoreTest extends GridCommonAbstractTest { * @throws IgniteCheckedException if failed. */ public void testRollback() throws IgniteCheckedException { - IgniteTx tx = new DummyTx(); + Transaction tx = new DummyTx(); ses.newSession(tx); @@ -506,7 +506,7 @@ public class CacheJdbcPojoStoreTest extends GridCommonAbstractTest { * @param tx Transaction. * @param commit Commit. */ - private void doTestAllOps(@Nullable IgniteTx tx, boolean commit) { + private void doTestAllOps(@Nullable Transaction tx, boolean commit) { try { ses.newSession(tx); @@ -622,7 +622,7 @@ public class CacheJdbcPojoStoreTest extends GridCommonAbstractTest { multithreaded(new Callable<Object>() { @Nullable @Override public Object call() throws Exception { for (int i = 0; i < 1000; i++) { - IgniteTx tx = rnd.nextBoolean() ? new DummyTx() : null; + Transaction tx = rnd.nextBoolean() ? new DummyTx() : null; ses.newSession(tx); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java index 780b3d3..dd9314b 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/CacheJdbcStoreAbstractMultithreadedSelfTest.java @@ -254,7 +254,7 @@ public abstract class CacheJdbcStoreAbstractMultithreadedSelfTest<T extends Cach for (int i = 0; i < TX_CNT; i++) { IgniteCache<PersonKey, Person> cache = jcache(); - try (IgniteTx tx = grid().transactions().txStart()) { + try (Transaction tx = grid().transactions().txStart()) { cache.put(new PersonKey(1), new Person(1, rnd.nextInt(), "Name" + 1)); cache.put(new PersonKey(2), new Person(2, rnd.nextInt(), "Name" + 2)); cache.put(new PersonKey(3), new Person(3, rnd.nextInt(), "Name" + 3)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java index fd526f3..0504d55 100644 --- a/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/cache/store/jdbc/GridCacheJdbcBlobStoreMultithreadedSelfTest.java @@ -185,7 +185,7 @@ public class GridCacheJdbcBlobStoreMultithreadedSelfTest extends GridCommonAbstr IgniteCache<Object, Object> cache = ignite.jcache(null); - try (IgniteTx tx = ignite.transactions().txStart()) { + try (Transaction tx = ignite.transactions().txStart()) { cache.put(1, "value"); cache.put(2, "value"); cache.put(3, "value"); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java index 05c466a..96956c8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/GridStartStopSelfTest.java @@ -29,8 +29,8 @@ import java.util.concurrent.*; import static java.util.concurrent.TimeUnit.*; import static org.apache.ignite.IgniteSystemProperties.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; /** * Checks basic node start/stop operations. @@ -103,7 +103,7 @@ public class GridStartStopSelfTest extends GridCommonAbstractTest { Thread stopper = new Thread(new Runnable() { @Override public void run() { try { - try (IgniteTx ignored = g0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction ignored = g0.transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { g0.jcache(null).get(1); latch.countDown(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java index 9e7fb21..f75d7d2 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFailoverSelfTest.java @@ -18,14 +18,11 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; -import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.cluster.*; import org.apache.ignite.internal.util.typedef.*; import org.apache.ignite.internal.util.typedef.internal.*; -import org.apache.ignite.lang.*; -import org.apache.ignite.resources.*; import org.apache.ignite.testframework.*; import org.apache.ignite.transactions.*; import org.jetbrains.annotations.*; @@ -34,8 +31,8 @@ import javax.cache.*; import java.util.*; import static org.apache.ignite.cache.CachePreloadMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; /** * Failover tests for cache. @@ -209,8 +206,8 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac * @param isolation Isolation level. * @throws Exception If failed. */ - private void testTopologyChange(@Nullable IgniteTxConcurrency concurrency, - @Nullable IgniteTxIsolation isolation) throws Exception { + private void testTopologyChange(@Nullable TransactionConcurrency concurrency, + @Nullable TransactionIsolation isolation) throws Exception { boolean tx = concurrency != null && isolation != null; if (tx) @@ -243,8 +240,8 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac * @param isolation Isolation level. * @throws Exception If failed. */ - private void testConstantTopologyChange(@Nullable final IgniteTxConcurrency concurrency, - @Nullable final IgniteTxIsolation isolation) throws Exception { + private void testConstantTopologyChange(@Nullable final TransactionConcurrency concurrency, + @Nullable final TransactionIsolation isolation) throws Exception { final boolean tx = concurrency != null && isolation != null; if (tx) @@ -322,7 +319,7 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac * @throws IgniteCheckedException If failed. */ private void put(Ignite ignite, IgniteCache<String, Integer> cache, final int cnt, - IgniteTxConcurrency concurrency, IgniteTxIsolation isolation) throws Exception { + TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception { try { info("Putting values to cache [0," + cnt + ')'); @@ -367,7 +364,7 @@ public abstract class GridCacheAbstractFailoverSelfTest extends GridCacheAbstrac * @throws IgniteCheckedException If failed. */ private void remove(Ignite g, IgniteCache<String, Integer> cache, final int cnt, - IgniteTxConcurrency concurrency, IgniteTxIsolation isolation) throws Exception { + TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception { try { info("Removing values form cache [0," + cnt + ')'); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java index 72b42cb..f36a018 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractFullApiSelfTest.java @@ -49,9 +49,9 @@ import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.events.EventType.*; import static org.apache.ignite.internal.processors.cache.GridCachePeekMode.*; import static org.apache.ignite.testframework.GridTestUtils.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; -import static org.apache.ignite.transactions.IgniteTxState.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; +import static org.apache.ignite.transactions.TransactionState.*; /** * Full API cache test. @@ -358,7 +358,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @throws Exception In case of error. */ public void testGetAll() throws Exception { - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; final IgniteCache<String, Integer> cache = jcache(); @@ -406,7 +406,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract // Now do the same checks but within transaction. if (txEnabled()) { - try (IgniteTx tx0 = transactions().txStart()) { + try (Transaction tx0 = transactions().txStart()) { assert cache.getAll(Collections.<String>emptySet()).isEmpty(); map1 = cache.getAll(ImmutableSet.of("key1", "key2", "key9999")); @@ -459,7 +459,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract */ public void testGetTxNonExistingKey() throws Exception { if (txEnabled()) { - try (IgniteTx ignored = transactions().txStart()) { + try (Transaction ignored = transactions().txStart()) { assert jcache().get("key999123") == null; } } @@ -539,7 +539,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract if (txEnabled()) { IgniteCache<String, Integer> cache = jcache(); - try (IgniteTx tx = transactions().txStart()) { + try (Transaction tx = transactions().txStart()) { assert cache.getAndPut("key1", 1) == null; assert cache.getAndPut("key2", 2) == null; @@ -604,13 +604,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @param isolation Isolation. * @throws Exception If failed. */ - private void checkTransform(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation) throws Exception { + private void checkTransform(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception { IgniteCache<String, Integer> cache = jcache(); cache.put("key2", 1); cache.put("key3", 3); - IgniteTx tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, isolation) : null; + Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, isolation) : null; try { assertEquals("null", cache.invoke("key1", INCR_PROCESSOR)); @@ -686,7 +686,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @param isolation Transaction isolation. * @throws Exception If failed. */ - private void checkTransformAll(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation) + private void checkTransformAll(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception { final IgniteCache<String, Integer> cache = jcache(); @@ -696,7 +696,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract if (txEnabled()) { Map<String, EntryProcessorResult<String>> res; - try (IgniteTx tx = ignite(0).transactions().txStart(concurrency, isolation)) { + try (Transaction tx = ignite(0).transactions().txStart(concurrency, isolation)) { res = cache.invokeAll(F.asSet("key1", "key2", "key3"), INCR_PROCESSOR); tx.commit(); @@ -843,11 +843,11 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @param concurrency Concurrency. * @throws Exception If failed. */ - private void checkTransformSequential0(boolean startVal, IgniteTxConcurrency concurrency) + private void checkTransformSequential0(boolean startVal, TransactionConcurrency concurrency) throws Exception { IgniteCache<String, Integer> cache = jcache(); - IgniteTx tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null; + Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null; try { if (startVal) @@ -903,12 +903,12 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @param concurrency Concurrency. * @throws Exception If failed. */ - private void checkTransformAfterRemove(IgniteTxConcurrency concurrency) throws Exception { + private void checkTransformAfterRemove(TransactionConcurrency concurrency) throws Exception { IgniteCache<String, Integer> cache = jcache(); cache.put("key", 4); - IgniteTx tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null; + Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, READ_COMMITTED) : null; try { cache.remove("key"); @@ -970,8 +970,8 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @throws Exception If failed. */ private void checkTransformReturnValue(boolean put, - IgniteTxConcurrency concurrency, - IgniteTxIsolation isolation) + TransactionConcurrency concurrency, + TransactionIsolation isolation) throws Exception { IgniteCache<String, Integer> cache = jcache(); @@ -979,7 +979,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract if (!put) cache.put("key", 1); - IgniteTx tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, isolation) : null; + Transaction tx = txEnabled() ? ignite(0).transactions().txStart(concurrency, isolation) : null; try { if (put) @@ -1154,7 +1154,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @throws Exception If failed. */ private void checkPut(boolean inTx) throws Exception { - IgniteTx tx = inTx ? transactions().txStart() : null; + Transaction tx = inTx ? transactions().txStart() : null; IgniteCache<String, Integer> cache = jcache(); @@ -1190,7 +1190,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @throws Exception If failed. */ public void testPutAsync() throws Exception { - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; IgniteCache<String, Integer> cacheAsync = jcache().withAsync(); @@ -1205,10 +1205,10 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract IgniteFuture<?> fut2 = cacheAsync.future(); - IgniteFuture<IgniteTx> f = null; + IgniteFuture<Transaction> f = null; if (tx != null) { - tx = (IgniteTx)tx.withAsync(); + tx = (Transaction)tx.withAsync(); tx.commit(); @@ -1275,7 +1275,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract @Override public Void call() throws Exception { IgniteTransactions txs = transactions(); - try (IgniteTx tx = txs.txStart()) { + try (Transaction tx = txs.txStart()) { cache.put(key, 1); cache.put(null, 2); @@ -1297,7 +1297,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract @Override public Void call() throws Exception { IgniteTransactions txs = transactions(); - try (IgniteTx tx = txs.txStart()) { + try (Transaction tx = txs.txStart()) { cache.put(key, 2); cache.remove(null); @@ -1325,7 +1325,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract map.put("k2", 2); map.put(null, 3); - try (IgniteTx tx = txs.txStart()) { + try (Transaction tx = txs.txStart()) { cache.put(key, 1); cache.putAll(map); @@ -1512,7 +1512,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @throws Exception In case of error. */ public void testGetAndPutIfAbsent() throws Exception { - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; IgniteCache<String, Integer> cache = jcache(); @@ -1586,7 +1586,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @throws Exception If failed. */ public void testGetAndPutIfAbsentAsync() throws Exception { - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; IgniteCache<String, Integer> cache = jcache(); @@ -1679,7 +1679,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract cache.localEvict(Collections.singleton("key2")); // Same checks inside tx. - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; try { assertFalse(cache.putIfAbsent("key2", 3)); @@ -1752,7 +1752,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract cache.localEvict(Arrays.asList("key2")); // Same checks inside tx. - IgniteTx tx = inTx ? transactions().txStart() : null; + Transaction tx = inTx ? transactions().txStart() : null; try { cacheAsync.putIfAbsent("key2", 3); @@ -1859,7 +1859,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract cache.localEvict(Collections.singleton("key")); - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; try { assert cache.replace("key", 4, 5); @@ -1905,7 +1905,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract cache.localEvict(Collections.singleton("key")); - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; try { assert cache.replace("key", 5); @@ -1981,7 +1981,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract cache.localEvict(Collections.singleton("key")); - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; try { cacheAsync.replace("key", 4, 5); @@ -2041,7 +2041,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract cache.localEvict(Collections.singleton("key")); - IgniteTx tx = txEnabled() ? transactions().txStart() : null; + Transaction tx = txEnabled() ? transactions().txStart() : null; try { cacheAsync.replace("key", 5); @@ -2368,7 +2368,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract */ public void testRemoveAllDuplicatesTx() throws Exception { if (txEnabled()) { - try (IgniteTx tx = transactions().txStart()) { + try (Transaction tx = transactions().txStart()) { jcache().removeAll(ImmutableSet.of("key1", "key1", "key1")); tx.commit(); @@ -2783,14 +2783,14 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @param concurrency Concurrency. * @throws Exception If failed. */ - private void checkPeekTxRemove(IgniteTxConcurrency concurrency) throws Exception { + private void checkPeekTxRemove(TransactionConcurrency concurrency) throws Exception { if (txEnabled()) { Ignite ignite = primaryIgnite("key"); IgniteCache<String, Integer> cache = ignite.jcache(null); cache.put("key", 1); - try (IgniteTx tx = ignite.transactions().txStart(concurrency, READ_COMMITTED)) { + try (Transaction tx = ignite.transactions().txStart(concurrency, READ_COMMITTED)) { cache.remove("key"); assertNull(cache.get("key")); // localPeek ignores transactions. @@ -2843,7 +2843,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract } if (txEnabled()) { - IgniteTx tx = cache.txStart(); + Transaction tx = cache.txStart(); cache.replace(key, 2); @@ -2977,7 +2977,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract String key = "1"; int ttl = 500; - try (IgniteTx tx = grid(0).ignite().transactions().txStart()) { + try (Transaction tx = grid(0).ignite().transactions().txStart()) { final ExpiryPolicy expiry = new TouchedExpiryPolicy(new Duration(MILLISECONDS, ttl)); grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1); @@ -3051,7 +3051,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract if (inTx) { // Rollback transaction for the first time. - IgniteTx tx = transactions().txStart(); + Transaction tx = transactions().txStart(); try { jcache().withExpiryPolicy(expiry).put(key, 1); @@ -3069,7 +3069,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract } // Now commit transaction and check that ttl and expire time have been saved. - IgniteTx tx = inTx ? transactions().txStart() : null; + Transaction tx = inTx ? transactions().txStart() : null; try { jcache().withExpiryPolicy(expiry).put(key, 1); @@ -3483,7 +3483,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract */ public void testOptimisticTxMissingKey() throws Exception { if (txEnabled()) { - try (IgniteTx tx = transactions().txStart(OPTIMISTIC, READ_COMMITTED)) { + try (Transaction tx = transactions().txStart(OPTIMISTIC, READ_COMMITTED)) { // Remove missing key. assertTrue(jcache().remove(UUID.randomUUID().toString())); @@ -3499,7 +3499,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract */ public void testOptimisticTxMissingKeyNoCommit() throws Exception { if (txEnabled()) { - try (IgniteTx tx = transactions().txStart(OPTIMISTIC, READ_COMMITTED)) { + try (Transaction tx = transactions().txStart(OPTIMISTIC, READ_COMMITTED)) { // Remove missing key. assertTrue(jcache().remove(UUID.randomUUID().toString())); @@ -3541,7 +3541,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract * @param isolation Isolation. * @throws Exception If failed. */ - private void checkRemovexInTx(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation) throws Exception { + private void checkRemovexInTx(TransactionConcurrency concurrency, TransactionIsolation isolation) throws Exception { if (txEnabled()) { final int cnt = 10; @@ -3575,7 +3575,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract */ public void testPessimisticTxMissingKey() throws Exception { if (txEnabled()) { - try (IgniteTx tx = transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { + try (Transaction tx = transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { // Remove missing key. assertFalse(jcache().remove(UUID.randomUUID().toString())); @@ -3591,7 +3591,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract */ public void testPessimisticTxMissingKeyNoCommit() throws Exception { if (txEnabled()) { - try (IgniteTx tx = transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { + try (Transaction tx = transactions().txStart(PESSIMISTIC, READ_COMMITTED)) { // Remove missing key. assertFalse(jcache().remove(UUID.randomUUID().toString())); @@ -3605,7 +3605,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract */ public void testPessimisticTxRepeatableRead() throws Exception { if (txEnabled()) { - try (IgniteTx ignored = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction ignored = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { jcache().put("key", 1); assert jcache().get("key") == 1; @@ -3618,7 +3618,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract */ public void testPessimisticTxRepeatableReadOnUpdate() throws Exception { if (txEnabled()) { - try (IgniteTx ignored = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction ignored = transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { jcache().put("key", 1); assert jcache().getAndPut("key", 2) == 1; http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java index 12c6e49..d1c5e12 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractMetricsSelfTest.java @@ -729,7 +729,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract if (inTx) { // Rollback transaction for the first time. - IgniteTx tx = grid(0).transactions().txStart(); + Transaction tx = grid(0).transactions().txStart(); try { grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1); @@ -745,7 +745,7 @@ public abstract class GridCacheAbstractMetricsSelfTest extends GridCacheAbstract } // Now commit transaction and check that ttl and expire time have been saved. - IgniteTx tx = inTx ? grid(0).transactions().txStart() : null; + Transaction tx = inTx ? grid(0).transactions().txStart() : null; try { grid(0).jcache(null).withExpiryPolicy(expiry).put(key, 1); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java index bc54967..b0ca176 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractSelfTest.java @@ -95,7 +95,7 @@ public abstract class GridCacheAbstractSelfTest extends GridCommonAbstractTest { /** {@inheritDoc} */ @Override protected void afterTest() throws Exception { - IgniteTx tx = jcache().unwrap(Ignite.class).transactions().tx(); + Transaction tx = jcache().unwrap(Ignite.class).transactions().tx(); if (tx != null) { tx.close(); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java index ce62474..cc96548 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheAbstractTxReadTest.java @@ -52,42 +52,42 @@ public abstract class GridCacheAbstractTxReadTest extends GridCacheAbstractSelfT * @throws IgniteCheckedException If failed */ public void testTxReadOptimisticReadCommitted() throws IgniteCheckedException { - checkTransactionalRead(IgniteTxConcurrency.OPTIMISTIC, IgniteTxIsolation.READ_COMMITTED); + checkTransactionalRead(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.READ_COMMITTED); } /** * @throws IgniteCheckedException If failed */ public void testTxReadOptimisticRepeatableRead() throws IgniteCheckedException { - checkTransactionalRead(IgniteTxConcurrency.OPTIMISTIC, IgniteTxIsolation.REPEATABLE_READ); + checkTransactionalRead(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.REPEATABLE_READ); } /** * @throws IgniteCheckedException If failed */ public void testTxReadOptimisticSerializable() throws IgniteCheckedException { - checkTransactionalRead(IgniteTxConcurrency.OPTIMISTIC, IgniteTxIsolation.SERIALIZABLE); + checkTransactionalRead(TransactionConcurrency.OPTIMISTIC, TransactionIsolation.SERIALIZABLE); } /** * @throws IgniteCheckedException If failed */ public void testTxReadPessimisticReadCommitted() throws IgniteCheckedException { - checkTransactionalRead(IgniteTxConcurrency.PESSIMISTIC, IgniteTxIsolation.READ_COMMITTED); + checkTransactionalRead(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED); } /** * @throws IgniteCheckedException If failed */ public void testTxReadPessimisticRepeatableRead() throws IgniteCheckedException { - checkTransactionalRead(IgniteTxConcurrency.PESSIMISTIC, IgniteTxIsolation.REPEATABLE_READ); + checkTransactionalRead(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.REPEATABLE_READ); } /** * @throws IgniteCheckedException If failed */ public void testTxReadPessimisticSerializable() throws IgniteCheckedException { - checkTransactionalRead(IgniteTxConcurrency.PESSIMISTIC, IgniteTxIsolation.SERIALIZABLE); + checkTransactionalRead(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.SERIALIZABLE); } /** @@ -96,13 +96,13 @@ public abstract class GridCacheAbstractTxReadTest extends GridCacheAbstractSelfT * @param isolation Transaction isolation. * @throws IgniteCheckedException If failed */ - protected void checkTransactionalRead(IgniteTxConcurrency concurrency, IgniteTxIsolation isolation) + protected void checkTransactionalRead(TransactionConcurrency concurrency, TransactionIsolation isolation) throws IgniteCheckedException { IgniteCache<String, Integer> cache = jcache(0); cache.clear(); - IgniteTx tx = grid(0).transactions().txStart(concurrency, isolation); + Transaction tx = grid(0).transactions().txStart(concurrency, isolation); try { cache.put("key", 1); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java index df87b5d..b80b201 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheBasicStoreAbstractTest.java @@ -36,8 +36,8 @@ import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; /** * Basic store test. @@ -150,7 +150,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract assert map.isEmpty(); if (atomicityMode() == TRANSACTIONAL) { - try (IgniteTx tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { for (int i = 1; i <= 10; i++) { cache.put(i, Integer.toString(i)); @@ -183,7 +183,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract store.resetLastMethod(); if (atomicityMode() == TRANSACTIONAL) { - try (IgniteTx tx = grid().transactions().txStart()) { + try (Transaction tx = grid().transactions().txStart()) { for (int i = 1; i <= 10; i++) { String val = cache.getAndRemove(i); @@ -221,7 +221,7 @@ public abstract class GridCacheBasicStoreAbstractTest extends GridCommonAbstract assert map.isEmpty(); if (atomicityMode() == TRANSACTIONAL) { - try (IgniteTx tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = grid().transactions().txStart(OPTIMISTIC, REPEATABLE_READ)) { for (int i = 1; i <= 10; i++) cache.put(i, Integer.toString(i)); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocalySelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocalySelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocalySelfTest.java index a33304f..33b564d 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocalySelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheClearLocalySelfTest.java @@ -297,7 +297,7 @@ public class GridCacheClearLocalySelfTest extends GridCommonAbstractTest { * @throws Exception If failed. */ private void fillCache(GridCache<Integer, Integer> cache, int keysCnt) throws Exception { - try (IgniteTx tx = cache.txStart()) { + try (Transaction tx = cache.txStart()) { for (int i = 0; i < keysCnt; i++) cache.put(i, i); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java index eeeb8cf..6c21b28 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheConcurrentTxMultiNodeTest.java @@ -49,8 +49,8 @@ import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; /** * @@ -620,7 +620,7 @@ public class GridCacheConcurrentTxMultiNodeTest extends GridCommonAbstractTest { Session ses = new Session(terminalId()); try { - try (IgniteTx tx = ignite.transactions().txStart()) { + try (Transaction tx = ignite.transactions().txStart()) { Request req = new Request(getId()); req.setMessageId(getId()); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java index a976c0e..24d23fb 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDaemonNodeAbstractSelfTest.java @@ -32,8 +32,8 @@ import java.util.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; /** * Test cache operations with daemon node. @@ -129,7 +129,7 @@ public abstract class GridCacheDaemonNodeAbstractSelfTest extends GridCommonAbst IgniteCache<Integer, Integer> cache = grid(0).jcache(null); for (int i = 0; i < 30; i++) { - try (IgniteTx tx = ignite(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = ignite(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.put(i, i); tx.commit(); @@ -141,7 +141,7 @@ public abstract class GridCacheDaemonNodeAbstractSelfTest extends GridCommonAbst for (int i = 30; i < 60; i++) batch.put(i, i); - try (IgniteTx tx = ignite(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = ignite(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { cache.putAll(batch); tx.commit(); } http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java index 645e5a7..2f1e9b0 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheDeploymentSelfTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; -import org.apache.ignite.cache.affinity.*; import org.apache.ignite.cluster.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.util.typedef.*; @@ -28,9 +27,7 @@ import org.apache.ignite.spi.discovery.tcp.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.*; import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*; import org.apache.ignite.testframework.junits.common.*; -import org.apache.ignite.transactions.*; -import java.lang.reflect.*; import java.util.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; @@ -39,8 +36,6 @@ import static org.apache.ignite.cache.CacheMode.*; import static org.apache.ignite.cache.CachePreloadMode.*; import static org.apache.ignite.cache.CacheWriteSynchronizationMode.*; import static org.apache.ignite.configuration.DeploymentMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; /** * Cache + Deployment test. http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java index be5b8b7..51182fd 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheExAbstractFullApiSelfTest.java @@ -28,8 +28,8 @@ import java.util.concurrent.atomic.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.events.EventType.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; /** * Abstract test for private cache interface. @@ -64,7 +64,7 @@ public abstract class GridCacheExAbstractFullApiSelfTest extends GridCacheAbstra GridCache<String, Integer> cache = cache(); - try (IgniteTx tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = cache.txStart(PESSIMISTIC, REPEATABLE_READ)) { int key = 0; for (int i = 0; i < 1000; i++) { http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java index cfbe44c..178ded8 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheFinishPartitionsSelfTest.java @@ -18,7 +18,6 @@ package org.apache.ignite.internal.processors.cache; import org.apache.ignite.*; -import org.apache.ignite.cache.*; import org.apache.ignite.configuration.*; import org.apache.ignite.internal.*; import org.apache.ignite.internal.util.typedef.*; @@ -33,8 +32,8 @@ import java.util.concurrent.locks.*; import static org.apache.ignite.cache.CacheAtomicityMode.*; import static org.apache.ignite.cache.CacheDistributionMode.*; import static org.apache.ignite.cache.CacheMode.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; /** * Abstract class for cache tests. @@ -129,7 +128,7 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest IgniteCache<String, String> cache = grid(0).jcache(null); - IgniteTx tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ); + Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ); cache.get(key); @@ -189,7 +188,7 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest public void testMvccFinishKeys() throws Exception { IgniteCache<String, Integer> cache = grid(0).jcache(null); - try (IgniteTx tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { + try (Transaction tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ)) { final String key = "key"; cache.get(key); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java index 8e4f055..f5b9d85 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheInterceptorAbstractSelfTest.java @@ -843,8 +843,8 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst return; if (atomicityMode() == TRANSACTIONAL) { - for (IgniteTxConcurrency txConcurrency : IgniteTxConcurrency.values()) { - for (IgniteTxIsolation txIsolation : IgniteTxIsolation.values()) { + for (TransactionConcurrency txConcurrency : TransactionConcurrency.values()) { + for (TransactionIsolation txIsolation : TransactionIsolation.values()) { for (Operation op : Operation.values()) { testNearNodeKey(txConcurrency, txIsolation, op); @@ -863,8 +863,8 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst * @param op Operation type. * @throws Exception If failed. */ - private void testNearNodeKey(@Nullable IgniteTxConcurrency txConcurrency, - @Nullable IgniteTxIsolation txIsolation, @Nullable Operation op) throws Exception { + private void testNearNodeKey(@Nullable TransactionConcurrency txConcurrency, + @Nullable TransactionIsolation txIsolation, @Nullable Operation op) throws Exception { // Interceptor returns incremented new value. interceptor.retInterceptor = new InterceptorAdapter() { @Nullable @Override public Object onBeforePut(Object key, @Nullable Object oldVal, Object newVal) { @@ -890,7 +890,7 @@ public abstract class GridCacheInterceptorAbstractSelfTest extends GridCacheAbst assertNotNull(txIsolation); assertNotNull(op); - try (IgniteTx tx = ignite(0).transactions().txStart(txConcurrency, txIsolation)) { + try (Transaction tx = ignite(0).transactions().txStart(txConcurrency, txIsolation)) { update(0, op, key1, 100, 1); update(0, op, key2, 200, 2); update(0, op, key3, 300, 3); http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/0b539033/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java index a755055..61845e5 100644 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/GridCacheMarshallerTxAbstractTest.java @@ -27,8 +27,8 @@ import org.apache.ignite.transactions.*; import java.io.*; import java.util.*; -import static org.apache.ignite.transactions.IgniteTxConcurrency.*; -import static org.apache.ignite.transactions.IgniteTxIsolation.*; +import static org.apache.ignite.transactions.TransactionConcurrency.*; +import static org.apache.ignite.transactions.TransactionIsolation.*; /** * Test transaction with wrong marshalling. @@ -91,7 +91,7 @@ public abstract class GridCacheMarshallerTxAbstractTest extends GridCommonAbstra String key2 = UUID.randomUUID().toString(); GridCacheWrongValue1 wrongValue = new GridCacheWrongValue1(); - IgniteTx tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ); + Transaction tx = grid().transactions().txStart(PESSIMISTIC, REPEATABLE_READ); try { grid().jcache(null).put(key, value);