http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/local/IgniteLocalReentrantLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/local/IgniteLocalReentrantLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/local/IgniteLocalReentrantLockSelfTest.java deleted file mode 100644 index 215121e..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/local/IgniteLocalReentrantLockSelfTest.java +++ /dev/null @@ -1,110 +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.internal.processors.cache.datastructures.local; - -import java.util.concurrent.Callable; -import org.apache.ignite.IgniteReentrantLock; -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.internal.IgniteInternalFuture; -import org.apache.ignite.internal.processors.cache.datastructures.IgniteReentrantLockAbstractSelfTest; -import org.apache.ignite.testframework.GridTestUtils; -import org.jetbrains.annotations.Nullable; - -import static java.util.concurrent.TimeUnit.MINUTES; -import static org.apache.ignite.cache.CacheMode.LOCAL; - -/** - * - */ -public class IgniteLocalReentrantLockSelfTest extends IgniteReentrantLockAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode atomicsCacheMode() { - return LOCAL; - } - - /** {@inheritDoc} */ - @Override protected int gridCount() { - return 1; - } - - /** {@inheritDoc} */ - @Override public void testReentrantLock() throws Exception { - // Test main functionality. - IgniteReentrantLock lock = grid(0).reentrantLock("lock", true, true); - - assertNotNull(lock); - - assertEquals(0, lock.getHoldCount()); - - lock.lock(); - - IgniteInternalFuture<?> fut = GridTestUtils.runMultiThreadedAsync( - new Callable<Object>() { - @Nullable @Override public Object call() throws Exception { - IgniteReentrantLock lock = grid(0).reentrantLock("lock", true, true); - - assert lock != null; - - info("Thread is going to wait on lock: " + Thread.currentThread().getName()); - - assert lock.tryLock(1, MINUTES); - - info("Thread is again runnable: " + Thread.currentThread().getName()); - - lock.unlock(); - - return null; - } - }, - THREADS_CNT, - "test-thread" - ); - - Thread.sleep(3000); - - assert lock.isLocked(); - - assert lock.getHoldCount() == 1; - - lock.lock(); - - assert lock.isLocked(); - - assert lock.getHoldCount() == 2; - - lock.unlock(); - - assert lock.isLocked(); - - assert lock.getHoldCount() == 1; - - lock.unlock(); - - // Ensure there are no hangs. - fut.get(); - - // Test operations on removed lock. - IgniteReentrantLock lock0 = grid(0).reentrantLock("lock", true, false); - - assertNotNull(lock0); - - lock0.close(); - - checkRemovedReentrantLock(lock0); - } -}
http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedLockSelfTest.java new file mode 100644 index 0000000..787f1e3 --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedLockSelfTest.java @@ -0,0 +1,33 @@ +/* + * 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.internal.processors.cache.datastructures.partitioned; + +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.internal.processors.cache.datastructures.IgniteLockAbstractSelfTest; + +import static org.apache.ignite.cache.CacheMode.PARTITIONED; + +/** + * + */ +public class IgnitePartitionedLockSelfTest extends IgniteLockAbstractSelfTest { + /** {@inheritDoc} */ + @Override protected CacheMode atomicsCacheMode() { + return PARTITIONED; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedReentrantLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedReentrantLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedReentrantLockSelfTest.java deleted file mode 100644 index 4b8ad68..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/partitioned/IgnitePartitionedReentrantLockSelfTest.java +++ /dev/null @@ -1,33 +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.internal.processors.cache.datastructures.partitioned; - -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.internal.processors.cache.datastructures.IgniteReentrantLockAbstractSelfTest; - -import static org.apache.ignite.cache.CacheMode.PARTITIONED; - -/** - * - */ -public class IgnitePartitionedReentrantLockSelfTest extends IgniteReentrantLockAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode atomicsCacheMode() { - return PARTITIONED; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/IgniteReplicatedLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/IgniteReplicatedLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/IgniteReplicatedLockSelfTest.java new file mode 100644 index 0000000..00bb0fa --- /dev/null +++ b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/IgniteReplicatedLockSelfTest.java @@ -0,0 +1,33 @@ +/* + * 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.internal.processors.cache.datastructures.replicated; + +import org.apache.ignite.cache.CacheMode; +import org.apache.ignite.internal.processors.cache.datastructures.IgniteLockAbstractSelfTest; + +import static org.apache.ignite.cache.CacheMode.REPLICATED; + +/** + * + */ +public class IgniteReplicatedLockSelfTest extends IgniteLockAbstractSelfTest { + /** {@inheritDoc} */ + @Override protected CacheMode atomicsCacheMode() { + return REPLICATED; + } +} http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/IgniteReplicatedReentrantLockSelfTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/IgniteReplicatedReentrantLockSelfTest.java b/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/IgniteReplicatedReentrantLockSelfTest.java deleted file mode 100644 index 697c4d6..0000000 --- a/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/datastructures/replicated/IgniteReplicatedReentrantLockSelfTest.java +++ /dev/null @@ -1,33 +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.internal.processors.cache.datastructures.replicated; - -import org.apache.ignite.cache.CacheMode; -import org.apache.ignite.internal.processors.cache.datastructures.IgniteReentrantLockAbstractSelfTest; - -import static org.apache.ignite.cache.CacheMode.REPLICATED; - -/** - * - */ -public class IgniteReplicatedReentrantLockSelfTest extends IgniteReentrantLockAbstractSelfTest { - /** {@inheritDoc} */ - @Override protected CacheMode atomicsCacheMode() { - return REPLICATED; - } -} http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java index 715a44c..ee37aec 100644 --- a/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java +++ b/modules/core/src/test/java/org/apache/ignite/loadtests/cache/GridCacheDataStructuresLoadTest.java @@ -27,8 +27,8 @@ import org.apache.ignite.IgniteAtomicStamped; import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCheckedException; import org.apache.ignite.IgniteCountDownLatch; +import org.apache.ignite.IgniteLock; import org.apache.ignite.IgniteQueue; -import org.apache.ignite.IgniteReentrantLock; import org.apache.ignite.IgniteSemaphore; import org.apache.ignite.IgniteSystemProperties; import org.apache.ignite.Ignition; @@ -359,7 +359,7 @@ public final class GridCacheDataStructuresLoadTest extends GridCacheAbstractLoad private final CIX1<Ignite> reentrantLockReadClos = new CIX1<Ignite>() { @Override public void applyx(Ignite ignite) { - IgniteReentrantLock r = ignite.reentrantLock(TEST_REENTRANT_LOCK_NAME, true, true); + IgniteLock r = ignite.reentrantLock(TEST_REENTRANT_LOCK_NAME, true, true); for (int i = 0; i < operationsPerTx; i++) { r.isLocked(); @@ -376,7 +376,7 @@ public final class GridCacheDataStructuresLoadTest extends GridCacheAbstractLoad private final CIX1<Ignite> reentrantLockWriteClos = new CIX1<Ignite>() { @Override public void applyx(Ignite ignite) { - IgniteReentrantLock r = ignite.reentrantLock(TEST_REENTRANT_LOCK_NAME, true, true); + IgniteLock r = ignite.reentrantLock(TEST_REENTRANT_LOCK_NAME, true, true); for (int i = 0; i < operationsPerTx; i++) { if ((i % 2) == 0) http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java index 0ab3d45..53f8b2e 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/IgniteMock.java @@ -30,7 +30,7 @@ import org.apache.ignite.IgniteCache; import org.apache.ignite.IgniteCluster; import org.apache.ignite.IgniteCompute; import org.apache.ignite.IgniteCountDownLatch; -import org.apache.ignite.IgniteReentrantLock; +import org.apache.ignite.IgniteLock; import org.apache.ignite.IgniteSemaphore; import org.apache.ignite.IgniteDataStreamer; import org.apache.ignite.IgniteEvents; @@ -368,7 +368,7 @@ public class IgniteMock implements Ignite { } /** {@inheritDoc} */ - @Nullable @Override public IgniteReentrantLock reentrantLock(String name, + @Nullable @Override public IgniteLock reentrantLock(String name, boolean failoverSafe, boolean create) { http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java ---------------------------------------------------------------------- diff --git a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java index d48b0c8..c2ffd3f 100644 --- a/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java +++ b/modules/core/src/test/java/org/apache/ignite/testframework/junits/multijvm/IgniteProcessProxy.java @@ -42,7 +42,7 @@ import org.apache.ignite.IgniteIllegalStateException; import org.apache.ignite.IgniteLogger; import org.apache.ignite.IgniteMessaging; import org.apache.ignite.IgniteQueue; -import org.apache.ignite.IgniteReentrantLock; +import org.apache.ignite.IgniteLock; import org.apache.ignite.IgniteScheduler; import org.apache.ignite.IgniteSemaphore; import org.apache.ignite.IgniteServices; @@ -546,7 +546,7 @@ public class IgniteProcessProxy implements IgniteEx { } /** {@inheritDoc} */ - @Override public IgniteReentrantLock reentrantLock(String name, boolean failoverSafe, + @Override public IgniteLock reentrantLock(String name, boolean failoverSafe, boolean create) throws IgniteException { throw new UnsupportedOperationException("Operation isn't supported yet."); } http://git-wip-us.apache.org/repos/asf/ignite/blob/e386558a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java ---------------------------------------------------------------------- diff --git a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java index 2406baa..b346d86 100644 --- a/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java +++ b/modules/spring/src/main/java/org/apache/ignite/IgniteSpringBean.java @@ -425,7 +425,7 @@ public class IgniteSpringBean implements Ignite, DisposableBean, InitializingBea } /** {@inheritDoc} */ - @Nullable @Override public IgniteReentrantLock reentrantLock(String name, + @Nullable @Override public IgniteLock reentrantLock(String name, boolean failoverSafe, boolean create) {
