You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by sb...@apache.org on 2015/01/19 07:42:18 UTC
[01/15] incubator-ignite git commit: # Fixed query with portables.
Repository: incubator-ignite
Updated Branches:
refs/heads/ignite-43 09df7dea8 -> 2a2eb5a3f
# Fixed query with portables.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/e4c2bc46
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/e4c2bc46
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/e4c2bc46
Branch: refs/heads/ignite-43
Commit: e4c2bc4662f69fdb05d8d99779ebdface45c7c60
Parents: 0d5ea99
Author: AKuznetsov <ak...@gridgain.com>
Authored: Thu Jan 15 14:53:04 2015 +0700
Committer: AKuznetsov <ak...@gridgain.com>
Committed: Thu Jan 15 14:53:04 2015 +0700
----------------------------------------------------------------------
.../grid/kernal/visor/query/VisorQueryTask.java | 53 ++++++++++++--------
1 file changed, 32 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/e4c2bc46/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java
index 1efc054..225eb79 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/visor/query/VisorQueryTask.java
@@ -129,6 +129,11 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
/** Flag indicating that this furure was read from last check. */
private Boolean accessed;
+ /**
+ * @param fut Future.
+ * @param next Next value.
+ * @param accessed {@code true} if query was accessed before remove timeout expired.
+ */
public VisorFutureResultSetHolder(GridCacheQueryFuture<R> fut, R next, Boolean accessed) {
this.fut = fut;
this.next = next;
@@ -188,15 +193,19 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
try {
Boolean scan = arg.queryTxt().toUpperCase().startsWith("SCAN");
- String qryId = (scan ? VisorQueryUtils.SCAN_QRY_NAME : VisorQueryUtils.SQL_QRY_NAME) + "-" + UUID.randomUUID();
+ String qryId = (scan ? VisorQueryUtils.SCAN_QRY_NAME : VisorQueryUtils.SQL_QRY_NAME) + "-" +
+ UUID.randomUUID();
GridCache<Object, Object> c = g.cachex(arg.cacheName());
if (c == null)
- return new IgniteBiTuple<>(new IgniteCheckedException("Cache not found: " + escapeName(arg.cacheName())), null);
+ return new IgniteBiTuple<>(new IgniteCheckedException("Cache not found: " +
+ escapeName(arg.cacheName())), null);
+
+ GridCacheProjection<Object, Object> cp = c.keepPortable();
if (scan) {
- GridCacheQueryFuture<Map.Entry<Object, Object>> fut = c.queries().createScanQuery(null)
+ GridCacheQueryFuture<Map.Entry<Object, Object>> fut = cp.queries().createScanQuery(null)
.pageSize(arg.pageSize())
.projection(g.forNodeIds(arg.proj()))
.execute();
@@ -221,7 +230,7 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
VisorQueryUtils.SCAN_COL_NAMES, rows.get1(), next != null, duration));
}
else {
- GridCacheQueryFuture<List<?>> fut = ((GridCacheQueriesEx<?, ?>)c.queries())
+ GridCacheQueryFuture<List<?>> fut = ((GridCacheQueriesEx<?, ?>)cp.queries())
.createSqlFieldsQuery(arg.queryTxt(), true)
.pageSize(arg.pageSize())
.projection(g.forNodeIds(arg.proj()))
@@ -245,7 +254,8 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
long start = U.currentTimeMillis();
- IgniteBiTuple<List<Object[]>, List<?>> rows = VisorQueryUtils.fetchSqlQueryRows(fut, firstRow, arg.pageSize());
+ IgniteBiTuple<List<Object[]>, List<?>> rows =
+ VisorQueryUtils.fetchSqlQueryRows(fut, firstRow, arg.pageSize());
long fetchDuration = U.currentTimeMillis() - start;
@@ -271,24 +281,25 @@ public class VisorQueryTask extends VisorOneNodeTask<VisorQueryTask.VisorQueryAr
* @param id Uniq query result id.
*/
private void scheduleResultSetHolderRemoval(final String id) {
- ((GridKernal)g).context().timeout().addTimeoutObject(new GridTimeoutObjectAdapter(VisorQueryUtils.RMV_DELAY) {
- @Override public void onTimeout() {
- ClusterNodeLocalMap<String, VisorFutureResultSetHolder> storage = g.nodeLocalMap();
-
- VisorFutureResultSetHolder<?> t = storage.get(id);
-
- if (t != null) {
- // If future was accessed since last scheduling, set access flag to false and reschedule.
- if (t.accessed()) {
- t.accessed(false);
-
- scheduleResultSetHolderRemoval(id);
+ ((GridKernal)g).context().timeout()
+ .addTimeoutObject(new GridTimeoutObjectAdapter(VisorQueryUtils.RMV_DELAY) {
+ @Override public void onTimeout() {
+ ClusterNodeLocalMap<String, VisorFutureResultSetHolder> storage = g.nodeLocalMap();
+
+ VisorFutureResultSetHolder<?> t = storage.get(id);
+
+ if (t != null) {
+ // If future was accessed since last scheduling, set access flag to false and reschedule.
+ if (t.accessed()) {
+ t.accessed(false);
+
+ scheduleResultSetHolderRemoval(id);
+ }
+ else
+ storage.remove(id); // Remove stored future otherwise.
}
- else
- storage.remove(id); // Remove stored future otherwise.
}
- }
- });
+ });
}
/** {@inheritDoc} */
[04/15] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/master' into ignite-1
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/master' into ignite-1
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/fb0b20a0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/fb0b20a0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/fb0b20a0
Branch: refs/heads/ignite-43
Commit: fb0b20a0af910afbafb3baef16692b2c224f87e8
Parents: da0235b 725d79f
Author: avinogradov <av...@gridgain.com>
Authored: Thu Jan 15 19:22:01 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Thu Jan 15 19:22:01 2015 +0300
----------------------------------------------------------------------
.../grid/kernal/visor/query/VisorQueryTask.java | 53 ++++++++++++--------
.../java/org/gridgain/grid/p2p/p2p.properties | 17 -------
2 files changed, 32 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
[11/15] incubator-ignite git commit: IGNITE-59 Support lock,
lockAll: Fix tests.
Posted by sb...@apache.org.
IGNITE-59 Support lock, lockAll: Fix tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/7737e759
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/7737e759
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/7737e759
Branch: refs/heads/ignite-43
Commit: 7737e759a4aa651fa95abb263e87045c4c551208
Parents: 26d7964
Author: sevdokimov <se...@gridgain.com>
Authored: Thu Jan 15 18:43:28 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jan 16 15:45:41 2015 +0300
----------------------------------------------------------------------
.../tcp/GridCacheDhtLockBackupSelfTest.java | 18 +--
.../cache/GridCacheAbstractFullApiSelfTest.java | 156 ++++---------------
.../cache/GridCacheBasicApiAbstractTest.java | 79 +++++-----
.../GridCacheFinishPartitionsSelfTest.java | 22 +--
.../GridCacheGroupLockAbstractSelfTest.java | 24 +--
.../cache/GridCacheNestedTxAbstractTest.java | 28 ++--
.../GridCacheOffHeapTieredAbstractSelfTest.java | 38 +----
.../distributed/GridCacheLockAbstractTest.java | 25 ++-
.../GridCacheMultiNodeLockAbstractTest.java | 144 ++++++++++++-----
.../dht/GridCacheColocatedDebugTest.java | 26 ++--
...dCachePartitionedTopologyChangeSelfTest.java | 8 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 14 +-
.../near/GridCacheNearOneNodeSelfTest.java | 35 +++--
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 42 -----
.../near/GridCacheNearReadersSelfTest.java | 14 +-
...titionedExplicitLockNodeFailureSelfTest.java | 1 +
.../near/GridCachePartitionedLockSelfTest.java | 2 +-
.../GridCacheEvictionLockUnlockSelfTest.java | 7 +-
.../cache/local/GridCacheLocalLockSelfTest.java | 34 ++--
.../GridCacheLocalMultithreadedSelfTest.java | 14 +-
20 files changed, 322 insertions(+), 409 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java
index 5d9c289..54157c2 100644
--- a/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java
+++ b/modules/core/src/test/java/org/apache/ignite/spi/communication/tcp/GridCacheDhtLockBackupSelfTest.java
@@ -113,8 +113,8 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest {
}
// Now, grid1 is always primary node for key 1.
- final GridCache<Integer, String> cache1 = ignite1.cache(null);
- final GridCache<Integer, String> cache2 = ignite2.cache(null);
+ final IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
+ final IgniteCache<Integer, String> cache2 = ignite2.jcache(null);
info(">>> Primary: " + ignite1.cluster().localNode().id());
info(">>> Backup: " + ignite2.cluster().localNode().id());
@@ -125,7 +125,7 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest {
@Nullable @Override public Object call() throws Exception {
info("Before lock for key: " + kv);
- assert cache1.lock(kv, 0L);
+ cache1.lock(kv).lock();
info("After lock for key: " + kv);
@@ -144,7 +144,7 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest {
finally {
Thread.sleep(1000);
- cache1.unlockAll(Collections.singleton(kv));
+ cache1.lockAll(Collections.singleton(kv)).unlock();
info("Unlocked key in thread 1: " + kv);
}
@@ -161,7 +161,7 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest {
l1.await();
- assert cache2.lock(kv, 0L);
+ cache2.lock(kv).lock();
try {
String v = cache2.get(kv);
@@ -170,7 +170,7 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest {
assertEquals(Integer.toString(kv), v);
}
finally {
- cache2.unlockAll(Collections.singleton(kv));
+ cache2.lockAll(Collections.singleton(kv)).unlock();
info("Unlocked key in thread 2: " + kv);
}
@@ -193,12 +193,12 @@ public class GridCacheDhtLockBackupSelfTest extends GridCommonAbstractTest {
info("Remove all completed");
- if (!cache2.isEmpty()) {
- String failMsg = cache2.entrySet().toString();
+ if (cache2.size() > 0) {
+ String failMsg = cache2.toString();
long start = System.currentTimeMillis();
- while (!cache2.isEmpty())
+ while (cache2.size() > 0)
U.sleep(100);
long clearDuration = System.currentTimeMillis() - start;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 870da16..4447383 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -37,6 +37,7 @@ import javax.cache.processor.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
+import java.util.concurrent.locks.*;
import static java.util.concurrent.TimeUnit.*;
import static org.gridgain.grid.cache.GridCacheMode.*;
@@ -3308,7 +3309,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
}
}, EVT_CACHE_OBJECT_LOCKED, EVT_CACHE_OBJECT_UNLOCKED);
- GridCache<String, Integer> cache = cache();
+ IgniteCache<String, Integer> cache = jcache();
String key = primaryKeysForCache(cache, 1).get(0);
@@ -3316,13 +3317,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
assert !cache.isLocked(key);
- cache.lock(key, 0);
+ cache.lock(key).lock();
lockCnt.await();
assert cache.isLocked(key);
- cache.unlock(key);
+ cache.lock(key).unlock();
unlockCnt.await();
@@ -3397,22 +3398,24 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
*/
public void testLockWithTimeout() throws Exception {
if (lockingEnabled()) {
- cache().put("key", 1);
+ jcache().put("key", 1);
- assert !cache().isLocked("key");
+ assert !jcache().isLocked("key");
- cache().lock("key", 2000);
+ final Lock lock = jcache().lock("key");
- assert cache().isLocked("key");
- assert cache().isLockedByThread("key");
+ lock.tryLock(2000, MILLISECONDS);
+
+ assert jcache().isLocked("key");
+ assert jcache().isLockedByThread("key");
assert !forLocal(dfltIgnite).call(new Callable<Boolean>() {
- @Override public Boolean call() throws IgniteCheckedException {
- return cache().lock("key", 100);
+ @Override public Boolean call() throws InterruptedException {
+ return lock.tryLock(100, MILLISECONDS);
}
});
- cache().unlock("key");
+ lock.unlock();
}
}
@@ -3594,61 +3597,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
@SuppressWarnings("BusyWait")
- public void testLockFiltered() throws Exception {
- if (lockingEnabled()) {
- cache().put("key1", 1);
- cache().put("key2", 100);
-
- for (int i = 0; i < gridCount(); i++) {
- assert !cache(i).isLocked("key1");
- assert !cache(i).isLocked("key2");
- }
-
- cache().projection(F.<GridCacheEntry<String, Integer>>alwaysFalse()).lock("key1", 0);
- cache().projection(F.<GridCacheEntry<String, Integer>>alwaysTrue()).lock("key2", 0);
-
- boolean passed = false;
-
- for (int i = 0; i < gridCount(); i++) {
- assertFalse("key1 is locked for cache: " + i, cache(i).isLocked("key1"));
-
- if (cache(i).isLocked("key2"))
- passed = true;
- }
-
- assert passed;
-
- // Must pass keys as lock() was called with keys.
- cache().unlockAll(F.asList("key2"), F.<GridCacheEntry<String, Integer>>alwaysTrue());
-
- for (int i = 0; i < 100; i++) {
- boolean sleep = false;
-
- for (int j = 0; j < gridCount(); j++) {
- if (cache(j).isLocked("key1") || cache(j).isLocked("key2")) {
- sleep = true;
-
- break;
- }
- }
-
- if (sleep)
- Thread.sleep(10);
- else
- break;
- }
-
- for (int i = 0; i < gridCount(); i++) {
- assert !cache(i).isLocked("key1");
- assert !cache(i).isLocked("key2");
- }
- }
- }
-
- /**
- * @throws Exception In case of error.
- */
- @SuppressWarnings("BusyWait")
public void testLockFilteredEntry() throws Exception {
if (lockingEnabled()) {
cache().put("key1", 1);
@@ -3703,69 +3651,6 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
* @throws Exception In case of error.
*/
@SuppressWarnings("BusyWait")
- public void testUnlockFiltered() throws Exception {
- if (lockingEnabled()) {
- List<String> keys = primaryKeysForCache(cache(), 2);
-
- info("Keys: " + keys);
-
- final String key1 = keys.get(0);
- final String key2 = keys.get(1);
-
- cache().put(key1, 1);
- cache().put(key2, 100);
-
- assert !cache().isLocked(key1);
- assert !cache().isLocked(key2);
-
- cache().lock(key1, 0);
- cache().lock(key2, 0);
-
- assert cache().isLocked(key1);
- assert cache().isLocked(key2);
-
- cache().unlock(key1, gte100);
- cache().unlock(key2, gte100);
-
- GridTestUtils.waitForCondition(new PA() {
- @Override public boolean apply() {
- for (int g = 0; g < gridCount(); g++) {
- if (cache(g).isLocked(key2)) {
- info(key2 + " is locked on grid: " + g);
-
- return false;
- }
- }
-
- return true;
- }
- }, 2000);
-
- assert cache().isLocked(key1);
- assert !cache().isLocked(key2);
-
- cache().unlockAll(F.asList(key1, key2));
-
- GridTestUtils.waitForCondition(new PA() {
- @Override public boolean apply() {
- for (int g = 0; g < gridCount(); g++) {
- if (cache(g).isLocked(key1))
- info(key1 + " is locked on grid: " + g);
-
- if (cache(g).isLocked(key2))
- info(key2 + " is locked on grid: " + g);
- }
-
- return true;
- }
- }, 2000);
- }
- }
-
- /**
- * @throws Exception In case of error.
- */
- @SuppressWarnings("BusyWait")
public void testUnlockFilteredEntry() throws Exception {
if (lockingEnabled()) {
cache().put("key1", 1);
@@ -5248,4 +5133,17 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
throw new IgniteCheckedException("Unable to find " + cnt + " keys as primary for cache.");
}
+
+ /**
+ * @param cache Cache.
+ * @param cnt Keys count.
+ * @return Collection of keys for which given cache is primary.
+ * @throws IgniteCheckedException If failed.
+ */
+ protected List<String> primaryKeysForCache(IgniteCache<String, Integer> cache, int cnt)
+ throws IgniteCheckedException {
+ GridCacheProjection<String, Integer> prj = GridTestUtils.getFieldValue(cache, "delegate");
+
+ return primaryKeysForCache(prj, cnt);
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
index 1eae0a3..54c141e 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
@@ -21,10 +21,9 @@ import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.events.*;
import org.apache.ignite.lang.*;
-import org.gridgain.grid.*;
-import org.gridgain.grid.cache.*;
import org.apache.ignite.spi.discovery.tcp.*;
import org.apache.ignite.spi.discovery.tcp.ipfinder.vm.*;
+import org.gridgain.grid.cache.*;
import org.gridgain.grid.util.typedef.*;
import org.gridgain.grid.util.typedef.internal.*;
import org.gridgain.testframework.*;
@@ -34,6 +33,7 @@ import org.jetbrains.annotations.*;
import javax.cache.expiry.*;
import java.util.*;
import java.util.concurrent.*;
+import java.util.concurrent.locks.*;
import static java.util.concurrent.TimeUnit.*;
import static org.apache.ignite.events.IgniteEventType.*;
@@ -80,13 +80,15 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
* @throws Exception If test failed.
*/
public void testBasicLock() throws Exception {
- GridCache<Integer, String> cache = ignite.cache(null);
+ IgniteCache<Integer, String> cache = ignite.jcache(null);
- assert cache.lock(1, 0);
+ Lock lock = cache.lock(1);
+
+ assert lock.tryLock();
assert cache.isLocked(1);
- cache.unlock(1);
+ lock.unlock();
assert !cache.isLocked(1);
}
@@ -95,21 +97,23 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
* @throws IgniteCheckedException If test failed.
*/
public void testSingleLockReentry() throws IgniteCheckedException {
- GridCache<Integer, String> cache = ignite.cache(null);
+ IgniteCache<Integer, String> cache = ignite.jcache(null);
+
+ Lock lock = cache.lock(1);
- assert cache.lock(1, 0);
+ lock.lock();
try {
assert cache.isLockedByThread(1);
- assert cache.lock(1, 0);
+ lock.lock();
- cache.unlock(1);
+ lock.unlock();
assert cache.isLockedByThread(1);
}
finally {
- cache.unlock(1);
+ lock.unlock();
}
assert !cache.isLockedByThread(1);
@@ -121,34 +125,34 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
* @throws Exception If test failed.
*/
public void testReentry() throws Exception {
- GridCache<Integer, String> cache = ignite.cache(null);
+ IgniteCache<Integer, String> cache = ignite.jcache(null);
- assert cache.lock(1, 0);
+ Lock lock = cache.lock(1);
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
- assert cache.lock(1, 0);
+ lock.lock();
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
- assert cache.lock(1, 0);
+ lock.lock();
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
- cache.unlock(1);
+ lock.unlock();
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
- cache.unlock(1);
+ lock.unlock();
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
- cache.unlock(1);
+ lock.unlock();
assert !cache.isLocked(1);
assert !cache.isLockedByThread(1);
@@ -158,21 +162,21 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
* @throws IgniteCheckedException If test failed.
*/
public void testManyLockReentries() throws IgniteCheckedException {
- GridCache<Integer, String> cache = ignite.cache(null);
+ IgniteCache<Integer, String> cache = ignite.jcache(null);
Integer key = 1;
- assert cache.lock(key, 0);
+ cache.lock(key).lock();
try {
assert cache.get(key) == null;
- assert cache.put(key, "1") == null;
+ assert cache.getAndPut(key, "1") == null;
assert "1".equals(cache.get(key));
assert cache.isLocked(key);
assert cache.isLockedByThread(key);
- assert cache.lock(key, 0);
+ cache.lock(key).lock();
assert cache.isLocked(key);
assert cache.isLockedByThread(key);
@@ -181,14 +185,14 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
assert "1".equals(cache.remove(key));
}
finally {
- cache.unlock(key);
+ cache.lock(key).unlock();
}
assert cache.isLocked(key);
assert cache.isLockedByThread(key);
}
finally {
- cache.unlock(key);
+ cache.lock(key).unlock();
assert !cache.isLocked(key);
assert !cache.isLockedByThread(key);
@@ -199,7 +203,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
* @throws Exception If test failed.
*/
public void testLockMultithreaded() throws Exception {
- final GridCache<Integer, String> cache = ignite.cache(null);
+ final IgniteCache<Integer, String> cache = ignite.jcache(null);
final CountDownLatch l1 = new CountDownLatch(1);
final CountDownLatch l2 = new CountDownLatch(1);
@@ -210,7 +214,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
@Nullable @Override public Object call() throws Exception {
info("Before lock for.key 1");
- assert cache.lock(1, 0);
+ cache.lock(1).lock();
info("After lock for key 1");
@@ -223,22 +227,22 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
info("Let thread2 proceed.");
// Reentry.
- assert cache.lock(1, -1L);
+ assert cache.lock(1).tryLock();
// Nested lock.
- assert cache.lock(2, -1L);
+ assert cache.lock(2).tryLock();
l2.await();
- cache.unlock(1);
+ cache.lock(1).unlock();
// Unlock in reverse order.
- cache.unlock(2);
+ cache.lock(2).unlock();
info("Waited for latch 2");
}
finally {
- cache.unlock(1);
+ cache.lock(1).unlock();
info("Unlocked entry for key 1.");
}
@@ -258,7 +262,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
info("Latch1 released.");
- assert !cache.lock(1, -1L);
+ assert !cache.lock(1).tryLock();
if (!cache.isLocked(1))
throw new IllegalArgumentException();
@@ -273,7 +277,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
l3.await();
- assert cache.lock(1, -1L);
+ assert cache.lock(1).tryLock();
try {
info("Locked cache for key 1");
@@ -284,7 +288,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
info("Checked that cache is locked for key 1");
}
finally {
- cache.unlock(1);
+ cache.lock(1).unlock();
info("Unlocked cache for key 1");
}
@@ -374,13 +378,13 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
* @throws Exception If error occur.
*/
public void testBasicOpsWithReentry() throws Exception {
- GridCache<Integer, String> cache = ignite.cache(null);
+ IgniteCache<Integer, String> cache = ignite.jcache(null);
int key = (int)System.currentTimeMillis();
assert !cache.containsKey(key);
- assert cache.lock(key, 0);
+ cache.lock(key).lock();
CountDownLatch latch = new CountDownLatch(1);
@@ -428,17 +432,16 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
info("Stop latch wait 3");
- assert cache.keySet().contains(key);
+ assert cache.containsKey(key);
assert cache.isLocked(key);
}
finally {
- cache.unlock(key);
+ cache.lock(key).unlock();
ignite.events().stopLocalListen(lsnr, EVTS_CACHE);
}
// Entry should be evicted since allowEmptyEntries is false.
- assert !cache.keySet().contains(key) : "Key set: " + cache.keySet();
assert !cache.isLocked(key);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheFinishPartitionsSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheFinishPartitionsSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheFinishPartitionsSelfTest.java
index 8ddeb5e..b3796be 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheFinishPartitionsSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheFinishPartitionsSelfTest.java
@@ -17,6 +17,7 @@
package org.gridgain.grid.kernal.processors.cache;
+import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.transactions.*;
@@ -28,6 +29,7 @@ import org.gridgain.testframework.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
+import java.util.concurrent.locks.*;
import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
import static org.gridgain.grid.cache.GridCacheMode.*;
@@ -221,9 +223,9 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
final CountDownLatch latch = new CountDownLatch(1);
- GridCache<Integer, String> cache = grid.cache(null);
+ IgniteCache<Integer, String> cache = grid.jcache(null);
- assert cache.lock(key, 0);
+ cache.lock(key).lock();
long start = System.currentTimeMillis();
@@ -243,17 +245,17 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
}
});
- assert cache.lock(key + 1, 0);
+ cache.lock(key + 1).lock();
- cache.unlock(key);
+ cache.lock(key).unlock();
- assert cache.lock(key + 2, 0);
+ cache.lock(key + 2).lock();
- cache.unlock(key + 1);
+ cache.lock(key + 1).unlock();
assert !fut.isDone() : "Failed waiting for locks";
- cache.unlock(key + 2);
+ cache.lock(key + 2).unlock();
latch.await();
}
@@ -273,9 +275,9 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
final CountDownLatch latch = new CountDownLatch(1);
- GridCache<String, String> cache = grid.cache(null);
+ IgniteCache<String, String> cache = grid.jcache(null);
- assert cache.lock(key, 0);
+ cache.lock(key).lock();
long start;
try {
@@ -301,7 +303,7 @@ public class GridCacheFinishPartitionsSelfTest extends GridCacheAbstractSelfTest
+ fut.isDone() + ']';
}
finally {
- cache.unlock(key);
+ cache.lock(key).unlock();
}
latch.await();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheGroupLockAbstractSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
index c4a7471..f0abccb 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheGroupLockAbstractSelfTest.java
@@ -37,6 +37,7 @@ import org.gridgain.testframework.junits.common.*;
import org.jdk8.backport.*;
import org.jetbrains.annotations.*;
+import javax.cache.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
@@ -355,7 +356,7 @@ public abstract class GridCacheGroupLockAbstractSelfTest extends GridCommonAbstr
final GridCacheAffinityKey<String> key1 = new GridCacheAffinityKey<>("key1", affinityKey);
- final GridCache<GridCacheAffinityKey<String>, String> cache = grid(0).cache(null);
+ final IgniteCache<GridCacheAffinityKey<String>, String> cache = grid(0).jcache(null);
// Populate cache.
cache.put(key1, "val1");
@@ -375,17 +376,17 @@ public abstract class GridCacheGroupLockAbstractSelfTest extends GridCommonAbstr
IgniteFuture<?> fut = multithreadedAsync(new Runnable() {
@Override public void run() {
try {
- assertTrue(cache.lock(key1, 0));
+ cache.lock(key1).lock();
try {
lockLatch.countDown();
unlockLatch.await();
}
finally {
- cache.unlock(key1);
+ cache.lock(key1).unlock();
}
}
- catch (IgniteCheckedException e) {
+ catch (CacheException e) {
fail(e.getMessage());
}
catch (InterruptedException ignored) {
@@ -399,7 +400,8 @@ public abstract class GridCacheGroupLockAbstractSelfTest extends GridCommonAbstr
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
- try (IgniteTx tx = cache.txStartAffinity(affinityKey, concurrency, READ_COMMITTED, 0, 1)) {
+ try (IgniteTx tx = grid(0).transactions().txStartAffinity(null, affinityKey, concurrency,
+ READ_COMMITTED, 0, 1)) {
cache.put(key1, "val01");
tx.commit();
@@ -436,11 +438,13 @@ public abstract class GridCacheGroupLockAbstractSelfTest extends GridCommonAbstr
private void checkSanityCheckDisabled(final IgniteTxConcurrency concurrency) throws Exception {
assert !sanityCheckEnabled();
- final UUID affinityKey = primaryKeyForCache(grid(0));
+ GridEx grid = grid(0);
+
+ final UUID affinityKey = primaryKeyForCache(grid);
final GridCacheAffinityKey<String> key1 = new GridCacheAffinityKey<>("key1", affinityKey);
- final GridCache<GridCacheAffinityKey<String>, String> cache = grid(0).cache(null);
+ final IgniteCache<GridCacheAffinityKey<String>, String> cache = grid.jcache(null);
// Populate cache.
cache.put(key1, "val1");
@@ -454,10 +458,10 @@ public abstract class GridCacheGroupLockAbstractSelfTest extends GridCommonAbstr
assertEquals("For index: " + i, "val1", gCache.peek(key1));
}
- assertTrue(cache.lock(key1, 0));
+ cache.lock(key1).lock();
try {
- try (IgniteTx tx = cache.txStartAffinity(affinityKey, concurrency, READ_COMMITTED, 0, 1)) {
+ try (IgniteTx tx = grid.transactions().txStartAffinity(null, affinityKey, concurrency, READ_COMMITTED, 0, 1)) {
cache.put(key1, "val01");
tx.commit();
@@ -473,7 +477,7 @@ public abstract class GridCacheGroupLockAbstractSelfTest extends GridCommonAbstr
}
}
finally {
- cache.unlock(key1);
+ cache.lock(key1).unlock();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheNestedTxAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheNestedTxAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheNestedTxAbstractTest.java
index 7918c45..ad3048c 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheNestedTxAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheNestedTxAbstractTest.java
@@ -136,7 +136,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLockAndTx() throws Exception {
- final GridCache<String, Integer> c = grid(0).cache(null);
+ final IgniteCache<String, Integer> c = grid(0).jcache(null);
Collection<Thread> threads = new LinkedList<>();
@@ -147,7 +147,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
threads.add(new Thread(new Runnable() {
@Override public void run() {
- IgniteTx tx = c.txStart(PESSIMISTIC, REPEATABLE_READ);
+ IgniteTx tx = grid(0).transactions().txStart(PESSIMISTIC, REPEATABLE_READ);
try {
int cntr = c.get(CNTR_KEY);
@@ -172,7 +172,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
@Override public void run() {
try {
- c.lock(CNTR_KEY, 0);
+ c.lock(CNTR_KEY).lock();
int cntr = c.get(CNTR_KEY);
@@ -184,12 +184,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
error("Failed lock thread", e);
}
finally {
- try {
- c.unlock(CNTR_KEY);
- }
- catch (IgniteCheckedException e) {
- error("Failed unlock", e);
- }
+ c.lock(CNTR_KEY).unlock();
}
}
}));
@@ -215,9 +210,9 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
* @throws Exception If failed.
*/
public void testLockAndTx1() throws Exception {
- final GridCache<String, Integer> c = grid(0).cache(null);
+ final IgniteCache<String, Integer> c = grid(0).jcache(null);
- final GridCache<Integer, Integer> c1 = grid(0).cache(null);
+ final IgniteCache<Integer, Integer> c1 = grid(0).jcache(null);
Collection<Thread> threads = new LinkedList<>();
@@ -230,13 +225,13 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
@Override public void run() {
try {
- c.lock(CNTR_KEY, 0);
+ c.lock(CNTR_KEY).lock();
int cntr = c.get(CNTR_KEY);
info("*** Cntr in lock thread: " + cntr);
- IgniteTx tx = c.txStart(OPTIMISTIC, READ_COMMITTED);
+ IgniteTx tx = grid(0).transactions().txStart(OPTIMISTIC, READ_COMMITTED);
try {
@@ -262,12 +257,7 @@ public class GridCacheNestedTxAbstractTest extends GridCommonAbstractTest {
error("Failed lock thread", e);
}
finally {
- try {
- c.unlock(CNTR_KEY);
- }
- catch (IgniteCheckedException e) {
- error("Failed unlock", e);
- }
+ c.lock(CNTR_KEY).unlock();
}
}
}));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
index 30564ca..1a6b6ce 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheOffHeapTieredAbstractSelfTest.java
@@ -524,51 +524,23 @@ public abstract class GridCacheOffHeapTieredAbstractSelfTest extends GridCacheAb
*/
@SuppressWarnings("UnnecessaryLocalVariable")
private void checkLockUnlock(Integer key) throws Exception {
- GridCache<Integer, Integer> c = grid(0).cache(null);
+ IgniteCache<Integer, Integer> c = grid(0).jcache(null);
Integer val = key;
c.put(key, val);
- assertNull(c.peek(key));
-
- assertTrue(c.lock(key, 0));
-
- assertTrue(c.isLocked(key));
-
- c.unlock(key);
-
- assertFalse(c.isLocked(key));
-
- assertNull(c.peek(key));
-
- checkValue(key, val);
- }
-
- /**
- * @throws Exception If failed.
- */
- @SuppressWarnings("UnnecessaryLocalVariable")
- public void _testLockUnlockFiltered() throws Exception { // TODO: 9288, enable when fixed.
- if (atomicityMode() == ATOMIC)
- return;
-
- GridCache<Integer, Integer> c = grid(0).cache(null);
+ assertNull(c.localPeek(key));
- Integer key = primaryKey(c);
- Integer val = key;
-
- c.put(key, val);
-
- assertTrue(c.lock(key, 0, new TestEntryPredicate(val)));
+ c.lock(key).lock();
assertTrue(c.isLocked(key));
- c.unlock(key);
+ c.lock(key).unlock();
assertFalse(c.isLocked(key));
- assertNull(c.peek(key));
+ assertNull(c.localPeek(key));
checkValue(key, val);
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
index f8a1636..fd77a1d 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
@@ -172,12 +172,15 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
*/
@SuppressWarnings({"TooBroadScope"})
public void testLockSingleThread() throws Exception {
+ final IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
+ final IgniteCache<Integer, String> cache2 = ignite1.jcache(null);
+
int k = 1;
String v = String.valueOf(k);
info("Before lock for key: " + k);
- assert cache1.lock(k, 0L);
+ cache1.lock(k).lock();
info("After lock for key: " + k);
@@ -191,7 +194,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
info("Put " + k + '=' + k + " key pair into cache.");
}
finally {
- cache1.unlock(k);
+ cache1.lock(k).unlock();
info("Unlocked key: " + k);
}
@@ -205,6 +208,9 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
*/
@SuppressWarnings({"TooBroadScope"})
public void testLock() throws Exception {
+ final IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
+ final IgniteCache<Integer, String> cache2 = ignite1.jcache(null);
+
final int kv = 1;
final CountDownLatch l1 = new CountDownLatch(1);
@@ -214,7 +220,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
@Nullable @Override public Object call() throws Exception {
info("Before lock for key: " + kv);
- assert cache1.lock(kv, 0L);
+ cache1.lock(kv).lock();
info("After lock for key: " + kv);
@@ -233,7 +239,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
finally {
Thread.sleep(1000);
- cache1.unlockAll(F.asList(kv));
+ cache1.lockAll(Collections.singleton(kv)).unlock();
info("Unlocked key in thread 1: " + kv);
}
@@ -253,7 +259,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
l1.await();
- assert cache2.lock(kv, 0L);
+ cache2.lock(kv).lock();
try {
String v = cache2.get(kv);
@@ -263,7 +269,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
assertEquals(Integer.toString(kv), v);
}
finally {
- cache2.unlockAll(F.asList(kv));
+ cache2.lockAll(Collections.singleton(kv)).unlock();
info("Unlocked key in thread 2: " + kv);
}
@@ -293,12 +299,15 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
* @throws Exception If test failed.
*/
public void testLockAndPut() throws Exception {
+ final IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
+ final IgniteCache<Integer, String> cache2 = ignite1.jcache(null);
+
final CountDownLatch l1 = new CountDownLatch(1);
final CountDownLatch l2 = new CountDownLatch(1);
GridTestThread t1 = new GridTestThread(new Callable<Object>() {
@Nullable @Override public Object call() throws Exception {
- assert cache1.lock(1, 0L);
+ cache1.lock(1).lock();
info("Locked cache key: 1");
@@ -322,7 +331,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
info("Woke up from sleep.");
}
finally {
- cache1.unlockAll(F.asList(1));
+ cache1.lockAll(Collections.singleton(1)).unlock();
info("Unlocked cache key: 1");
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
index 2336fb5..1374be2 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheMultiNodeLockAbstractTest.java
@@ -148,6 +148,15 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
* @param cache Cache.
* @param key Key.
*/
+ private void checkLocked(IgniteCache<Integer,String> cache, Integer key) {
+ assert cache.isLocked(key);
+ assert cache.isLockedByThread(key);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param key Key.
+ */
private void checkRemoteLocked(GridCacheProjection<Integer,String> cache, Integer key) {
assert cache.isLocked(key);
assert !cache.isLockedByThread(key);
@@ -157,6 +166,15 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
* @param cache Cache.
* @param key Key.
*/
+ private void checkRemoteLocked(IgniteCache<Integer,String> cache, Integer key) {
+ assert cache.isLocked(key);
+ assert !cache.isLockedByThread(key);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param key Key.
+ */
@SuppressWarnings({"BusyWait"})
private void checkUnlocked(GridCacheProjection<Integer,String> cache, Integer key) {
assert !cache.isLockedByThread(key);
@@ -177,6 +195,30 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
assertFalse("Key locked [key=" + key + ", entries=" + entries(key) + "]", cache.isLocked(key));
}
+ /**
+ * @param cache Cache.
+ * @param key Key.
+ */
+ @SuppressWarnings({"BusyWait"})
+ private void checkUnlocked(IgniteCache<Integer,String> cache, Integer key) {
+ assert !cache.isLockedByThread(key);
+
+ if (partitioned()) {
+ for(int i = 0; i < 200; i++)
+ if (cache.isLocked(key)) {
+ try {
+ Thread.sleep(10);
+ }
+ catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ else
+ return;
+ }
+
+ assertFalse("Key locked [key=" + key + ", entries=" + entries(key) + "]", cache.isLocked(key));
+ }
/**
* @param cache Cache.
@@ -192,6 +234,15 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
* @param cache Cache.
* @param keys Keys.
*/
+ private void checkLocked(IgniteCache<Integer,String> cache, Iterable<Integer> keys) {
+ for (Integer key : keys)
+ checkLocked(cache, key);
+ }
+
+ /**
+ * @param cache Cache.
+ * @param keys Keys.
+ */
private void checkRemoteLocked(GridCacheProjection<Integer,String> cache, Iterable<Integer> keys) {
for (Integer key : keys) {
checkRemoteLocked(cache, key);
@@ -199,6 +250,15 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
}
/**
+ * @param cache Cache.
+ * @param keys Keys.
+ */
+ private void checkRemoteLocked(IgniteCache<Integer,String> cache, Iterable<Integer> keys) {
+ for (Integer key : keys)
+ checkRemoteLocked(cache, key);
+ }
+
+ /**
*
* @param cache Cache.
* @param keys Keys.
@@ -210,17 +270,27 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
/**
*
+ * @param cache Cache.
+ * @param keys Keys.
+ */
+ private void checkUnlocked(IgniteCache<Integer,String> cache, Iterable<Integer> keys) {
+ for (Integer key : keys)
+ checkUnlocked(cache, key);
+ }
+
+ /**
+ *
* @throws Exception If test failed.
*/
public void testBasicLock() throws Exception {
- GridCache<Integer, String> cache = ignite1.cache(null);
+ IgniteCache<Integer, String> cache = ignite1.jcache(null);
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
- cache.unlockAll(F.asList(1));
+ cache.lockAll(Collections.singleton(1)).unlock();
checkUnlocked(cache, 1);
}
@@ -250,10 +320,10 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
* @throws Exception If test fails.
*/
public void testMultiNodeLock() throws Exception {
- GridCache<Integer, String> cache1 = ignite1.cache(null);
- GridCache<Integer, String> cache2 = ignite2.cache(null);
+ IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
+ IgniteCache<Integer, String> cache2 = ignite2.jcache(null);
- assert cache1.lock(1, 0L);
+ cache1.lock(1).lock();
assert cache1.isLocked(1) : entries(1);
assert cache1.isLockedByThread(1);
@@ -262,18 +332,18 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
assert !cache2.isLockedByThread(1);
try {
- assert !cache2.lock(1, -1L);
+ assert !cache2.lock(1).tryLock();
assert cache2.isLocked(1) : entries(1);
assert !cache2.isLockedByThread(1);
}
finally {
- cache1.unlock(1);
+ cache1.lock(1).unlock();
checkUnlocked(cache1, 1);
}
- assert cache2.lock(1, 0L);
+ cache2.lock(1).lock();
assert cache2.isLocked(1) : entries(1);
assert cache2.isLockedByThread(1);
@@ -286,13 +356,13 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
addListener(ignite1, new UnlockListener(latch, 1));
try {
- assert !cache1.lock(1, -1L);
+ assert !cache1.lock(1).tryLock();
assert cache1.isLocked(1) : entries(1);
assert !cache1.isLockedByThread(1);
}
finally {
- cache2.unlockAll(F.asList(1));
+ cache2.lockAll(Collections.singleton(1)).unlock();
}
latch.await();
@@ -357,21 +427,21 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
* @throws Exception If test fails.
*/
public void testMultiNodeLockWithKeyLists() throws Exception {
- GridCache<Integer, String> cache1 = ignite1.cache(null);
- GridCache<Integer, String> cache2 = ignite2.cache(null);
+ IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
+ IgniteCache<Integer, String> cache2 = ignite2.jcache(null);
- Collection<Integer> keys1 = new ArrayList<>();
- Collection<Integer> keys2 = new ArrayList<>();
+ Set<Integer> keys1 = new HashSet<>();
+ Set<Integer> keys2 = new HashSet<>();
Collections.addAll(keys1, 1, 2, 3);
Collections.addAll(keys2, 2, 3, 4);
- assert cache1.lockAll(keys1, 0);
+ cache1.lockAll(keys1).lock();
checkLocked(cache1, keys1);
try {
- assert !cache2.lockAll(keys2, -1);
+ assert !cache2.lockAll(keys2).tryLock();
assert cache2.isLocked(2);
assert cache2.isLocked(3);
@@ -384,7 +454,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
assert !cache2.isLockedByThread(4);
}
finally {
- cache1.unlockAll(keys1);
+ cache1.lockAll(keys1).unlock();
}
checkUnlocked(cache1, keys1);
@@ -392,7 +462,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
checkUnlocked(cache1, keys2);
checkUnlocked(cache2, 4);
- assert cache2.lockAll(keys2, 0);
+ cache2.lockAll(keys2).lock();
CountDownLatch latch1 = new CountDownLatch(keys2.size());
CountDownLatch latch2 = new CountDownLatch(1);
@@ -405,7 +475,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
checkUnlocked(cache2, 1);
- assert cache1.lock(1, -1L);
+ assert cache1.lock(1).tryLock();
checkLocked(cache1, 1);
@@ -414,9 +484,9 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
checkRemoteLocked(cache2, 1);
}
finally {
- cache2.unlockAll(keys2);
+ cache2.lockAll(keys2).unlock();
- cache1.unlockAll(F.asList(1));
+ cache1.lockAll(Collections.singleton(1)).unlock();
}
latch1.await();
@@ -509,23 +579,23 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
* @throws IgniteCheckedException If test failed.
*/
public void testLockReentry() throws IgniteCheckedException {
- GridCache<Integer, String> cache = ignite1.cache(null);
+ IgniteCache<Integer, String> cache = ignite1.jcache(null);
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
try {
checkLocked(cache, 1);
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
checkLocked(cache, 1);
- cache.unlockAll(F.asList(1));
+ cache.lockAll(Collections.singleton(1)).unlock();
checkLocked(cache, 1);
}
finally {
- cache.unlockAll(F.asList(1));
+ cache.lockAll(Collections.singleton(1)).unlock();
}
checkUnlocked(cache, 1);
@@ -535,7 +605,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
* @throws Exception If test failed.
*/
public void testLockMultithreaded() throws Exception {
- final GridCache<Integer, String> cache = ignite1.cache(null);
+ final IgniteCache<Integer, String> cache = ignite1.jcache(null);
final CountDownLatch l1 = new CountDownLatch(1);
final CountDownLatch l2 = new CountDownLatch(1);
@@ -545,7 +615,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
@Nullable @Override public Object call() throws Exception {
info("Before lock for.key 1");
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
info("After lock for key 1");
@@ -557,23 +627,23 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
info("Let thread2 proceed.");
// Reentry.
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
checkLocked(cache, 1);
// Nested lock.
- assert cache.lock(2, -1L);
+ assert cache.lock(2).tryLock();
checkLocked(cache, 2);
// Unlock reentry.
- cache.unlockAll(F.asList(1));
+ cache.lockAll(Collections.singleton(1)).unlock();
// Outer should still be owned.
checkLocked(cache, 1);
// Unlock in reverse order.
- cache.unlockAll(F.asList(2));
+ cache.lockAll(Collections.singleton(2)).unlock();
checkUnlocked(cache, 2);
@@ -582,7 +652,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
info("Waited for latch 2");
}
finally {
- cache.unlockAll(F.asList(1));
+ cache.lockAll(Collections.singleton(1)).unlock();
info("Unlocked entry for key 1.");
}
@@ -603,7 +673,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
info("Latch1 released.");
- assert !cache.lock(1, -1L);
+ assert !cache.lock(1).tryLock();
info("Tried to lock cache for key1");
@@ -611,7 +681,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
info("Released latch2");
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
try {
info("Locked cache for key 1");
@@ -621,7 +691,7 @@ public abstract class GridCacheMultiNodeLockAbstractTest extends GridCommonAbstr
info("Checked that cache is locked for key 1");
}
finally {
- cache.unlockAll(F.asList(1));
+ cache.lockAll(Collections.singleton(1)).unlock();
info("Unlocked cache for key 1");
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
index 6f81490..acc565c 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCacheColocatedDebugTest.java
@@ -877,13 +877,15 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
startGrid();
try {
- assert cache().lock(1, 0);
+ IgniteCache<Object, Object> cache = jcache();
- assertNull(cache().put(1, "key1"));
- assertEquals("key1", cache().put(1, "key2"));
- assertEquals("key2", cache().get(1));
+ cache.lock(1).lock();
- cache().unlock(1);
+ assertNull(cache.getAndPut(1, "key1"));
+ assertEquals("key1", cache.getAndPut(1, "key2"));
+ assertEquals("key2", cache.get(1));
+
+ cache.lock(1).unlock();
}
finally {
stopAllGrids();
@@ -907,11 +909,11 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
Integer k1 = forPrimary(g1);
Integer k2 = forPrimary(g2);
- GridCache<Object, Object> cache = cache(0);
+ IgniteCache<Object, Object> cache = jcache(0);
- assert cache.lock(k0, 0);
- assert cache.lock(k1, 0);
- assert cache.lock(k2, 0);
+ cache.lock(k0).lock();
+ cache.lock(k1).lock();
+ cache.lock(k2).lock();
cache.put(k0, "val0");
@@ -921,9 +923,9 @@ public class GridCacheColocatedDebugTest extends GridCommonAbstractTest {
assertEquals("val1", cache.get(k1));
assertEquals("val2", cache.get(k2));
- cache.unlock(k0);
- cache.unlock(k1);
- cache.unlock(k2);
+ cache.lock(k0).unlock();
+ cache.lock(k1).unlock();
+ cache.lock(k2).unlock();
}
finally {
stopAllGrids();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
index 92acdd8..24521a0 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/dht/GridCachePartitionedTopologyChangeSelfTest.java
@@ -150,9 +150,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
@Override public void run() {
try {
try {
- boolean locked = node.cache(null).lock(key, 0);
-
- assert locked;
+ node.jcache(null).lock(key).lock();
info(">>> Acquired explicit lock for key: " + key);
@@ -160,9 +158,7 @@ public class GridCachePartitionedTopologyChangeSelfTest extends GridCommonAbstra
info(">>> Acquiring explicit lock for key: " + key * 10);
- locked = node.cache(null).lock(key * 10, 0);
-
- assert locked;
+ node.jcache(null).lock(key * 10).lock();
info(">>> Releasing locks [key1=" + key + ", key2=" + key * 10 + ']');
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index 2145a30..f63d2d7 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -742,35 +742,35 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
if (!transactional())
return;
- GridCache<Integer, String> near = cache(0);
+ IgniteCache<Integer, String> near = jcache(0);
String val = Integer.toString(key);
- near.lock(key, 0);
+ near.lock(key).lock();
try {
near.put(key, val);
- assertEquals(val, near.peek(key));
+ assertEquals(val, near.localPeek(key));
assertEquals(val, dht(primaryGrid(key)).peek(key));
assertTrue(near.isLocked(key));
assertTrue(near.isLockedByThread(key));
- near.lock(key, 0); // Reentry.
+ near.lock(key).lock(); // Reentry.
try {
assertEquals(val, near.get(key));
assertEquals(val, near.remove(key));
- assertNull(near.peek(key));
+ assertNull(near.localPeek(key));
assertNull(dht(primaryGrid(key)).peek(key));
assertTrue(near.isLocked(key));
assertTrue(near.isLockedByThread(key));
}
finally {
- near.unlock(key);
+ near.lock(key).unlock();
}
assertTrue(near.isLocked(key));
@@ -782,7 +782,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
throw t;
}
finally {
- near.unlock(key);
+ near.lock(key).unlock();
}
assertFalse(near(0).isLockedNearOnly(key));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
index be64e75..25adeea 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
@@ -29,6 +29,7 @@ import org.gridgain.testframework.junits.common.*;
import org.jetbrains.annotations.*;
import java.util.concurrent.*;
+import java.util.concurrent.locks.*;
import static org.gridgain.grid.cache.GridCacheAtomicityMode.*;
import static org.gridgain.grid.cache.GridCacheDistributionMode.*;
@@ -179,47 +180,49 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
/** @throws Exception If failed. */
public void testSingleLockPut() throws Exception {
- GridCache<Integer, String> near = cache();
+ IgniteCache<Integer, String> near = jcache();
- near.lock(1, 0);
+ near.lock(1).lock();
try {
near.put(1, "1");
near.put(2, "2");
- String one = near.put(1, "3");
+ String one = near.getAndPut(1, "3");
assertNotNull(one);
assertEquals("1", one);
}
finally {
- near.unlock(1);
+ near.lock(1).unlock();
}
}
/** @throws Exception If failed. */
public void testSingleLock() throws Exception {
- GridCache<Integer, String> near = cache();
+ IgniteCache<Integer, String> near = jcache();
- near.lock(1, 0);
+ Lock lock = near.lock(1);
+
+ lock.lock();
try {
near.put(1, "1");
- assertEquals("1", near.peek(1));
+ assertEquals("1", near.localPeek(1));
assertEquals("1", dht().peek(1));
assertEquals("1", near.get(1));
assertEquals("1", near.remove(1));
- assertNull(near.peek(1));
+ assertNull(near.localPeek(1));
assertNull(dht().peek(1));
assertTrue(near.isLocked(1));
assertTrue(near.isLockedByThread(1));
}
finally {
- near.unlock(1);
+ near.lock(1).unlock();
}
assertFalse(near.isLocked(1));
@@ -228,40 +231,40 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
/** @throws Exception If failed. */
public void testSingleLockReentry() throws Exception {
- GridCache<Integer, String> near = cache();
+ IgniteCache<Integer, String> near = jcache();
- near.lock(1, 0);
+ near.lock(1).lock();
try {
near.put(1, "1");
- assertEquals("1", near.peek(1));
+ assertEquals("1", near.localPeek(1));
assertEquals("1", dht().peek(1));
assertTrue(near.isLocked(1));
assertTrue(near.isLockedByThread(1));
- near.lock(1, 0); // Reentry.
+ near.lock(1).lock(); // Reentry.
try {
assertEquals("1", near.get(1));
assertEquals("1", near.remove(1));
- assertNull(near.peek(1));
+ assertNull(near.localPeek(1));
assertNull(dht().peek(1));
assertTrue(near.isLocked(1));
assertTrue(near.isLockedByThread(1));
}
finally {
- near.unlock(1);
+ near.lock(1).unlock();
}
assertTrue(near.isLocked(1));
assertTrue(near.isLockedByThread(1));
}
finally {
- near.unlock(1);
+ near.lock(1).unlock();
}
assertFalse(near.isLocked(1));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
index 61ba20e..7cb1a5b 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOnlyMultiNodeFullApiSelfTest.java
@@ -417,48 +417,6 @@ public class GridCacheNearOnlyMultiNodeFullApiSelfTest extends GridCachePartitio
}
/** {@inheritDoc} */
- @SuppressWarnings("BusyWait")
- @Override public void testUnlockFiltered() throws Exception {
- if (lockingEnabled()) {
- List<String> keys = primaryKeysForCache(fullCache(), 2);
-
- String key1 = keys.get(0);
- String key2 = keys.get(1);
-
- cache().put(key1, 1);
- cache().put(key2, 100);
-
- assert !cache().isLocked(key1);
- assert !cache().isLocked(key2);
- assert !fullCache().isLocked(key1);
- assert !fullCache().isLocked(key2);
-
- cache().lock(key1, 0L);
- cache().lock(key2, 0L);
-
- assert cache().isLocked(key1);
- assert cache().isLocked(key2);
-
- cache().unlock(key1, gte100);
- cache().unlock(key2, gte100);
-
- for (int i = 0; i < 100; i++) {
- if (fullCache().isLocked(key2))
- Thread.sleep(10);
- else
- break;
- }
-
- assert cache().isLocked(key1);
- assert fullCache().isLocked(key1);
- assert !cache().isLocked(key2);
- assert !fullCache().isLocked(key2);
-
- cache().unlockAll(F.asList(key1, key2));
- }
- }
-
- /** {@inheritDoc} */
@Override public void testPrimaryData() throws Exception {
// Not needed for near-only cache.
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
index 88b27f3..ffc83e5 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearReadersSelfTest.java
@@ -515,16 +515,16 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertEquals(grid(1).localNode(), F.first(aff.nodes(aff.partition(key2), grid(1).nodes())));
- GridCache<Integer, String> cache = cache(0);
+ IgniteCache<Integer, String> cache = jcache(0);
- assertTrue(cache.lock(key1, 0L));
+ cache.lock(key1).lock();
try {
// Nested lock.
- assertTrue(cache.lock(key2, 0L));
+ cache.lock(key2).lock();
try {
- assertNull(cache.put(key1, val1));
+ assertNull(cache.getAndPut(key1, val1));
assertEquals(val1, dht(0).peek(key1));
assertEquals(val1, dht(1).peek(key1));
@@ -537,7 +537,7 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertNull(near(1).peekNearOnly(key1));
assertNull(near(2).peekNearOnly(key1));
- assertTrue(cache.putx(key2, val2));
+ cache.put(key2, val2);
assertNull(dht(0).peek(key2));
assertEquals(val2, dht(1).peek(key2));
@@ -574,11 +574,11 @@ public class GridCacheNearReadersSelfTest extends GridCommonAbstractTest {
assertNull(near(2).peekEx(key2));
}
finally {
- cache.unlock(key2);
+ cache.lock(key2).lock();
}
}
finally {
- cache.unlock(key1);
+ cache.lock(key1).unlock();
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
index f3e3e8c0..94a13b0 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedExplicitLockNodeFailureSelfTest.java
@@ -17,6 +17,7 @@
package org.gridgain.grid.kernal.processors.cache.distributed.near;
+import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.events.*;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
index 3b94d87..26edf39 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
@@ -72,7 +72,7 @@ public class GridCachePartitionedLockSelfTest extends GridCacheLockAbstractTest
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
- return g0.cache(null).lock(1, Long.MAX_VALUE);
+ return g0.jcache(null).lock(1).tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
}, IgniteCheckedException.class, "Locks are not supported");
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
index 2e772da..88d4f87 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/eviction/GridCacheEvictionLockUnlockSelfTest.java
@@ -17,6 +17,7 @@
package org.gridgain.grid.kernal.processors.cache.eviction;
+import org.apache.ignite.*;
import org.apache.ignite.configuration.*;
import org.apache.ignite.events.*;
import org.apache.ignite.lang.*;
@@ -121,10 +122,10 @@ public class GridCacheEvictionLockUnlockSelfTest extends GridCommonAbstractTest
for (int i = 0; i < gridCnt; i++) {
reset();
- GridCache<Object, Object> cache = cache(i);
+ IgniteCache<Object, Object> cache = jcache(i);
- cache.lock("key", 0L);
- cache.unlock("key");
+ cache.lock("key").lock();
+ cache.lock("key").unlock();
assertTrue(evictLatch.await(3, SECONDS));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java
index 5ad1475..49a83ac 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java
@@ -79,39 +79,39 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
* @throws IgniteCheckedException If test failed.
*/
public void testLockReentry() throws IgniteCheckedException {
- GridCache<Integer, String> cache = ignite.cache(null);
+ IgniteCache<Integer, String> cache = ignite.jcache(null);
assert !cache.isLocked(1);
assert !cache.isLockedByThread(1);
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
try {
assert cache.get(1) == null;
- assert cache.put(1, "1") == null;
+ assert cache.getAndPut(1, "1") == null;
assert "1".equals(cache.get(1));
// Reentry.
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
try {
- assert "1".equals(cache.remove(1));
+ assert "1".equals(cache.getAndRemove(1));
}
finally {
- cache.unlock(1);
+ cache.lock(1).unlock();
}
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
}
finally {
- cache.unlock(1);
+ cache.lock(1).unlock();
}
assert !cache.isLocked(1);
@@ -122,7 +122,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
* @throws Exception If test failed.
*/
public void testLock() throws Throwable {
- final GridCache<Integer, String> cache = ignite.cache(null);
+ final IgniteCache<Integer, String> cache = ignite.jcache(null);
final CountDownLatch latch1 = new CountDownLatch(1);
final CountDownLatch latch2 = new CountDownLatch(1);
@@ -133,7 +133,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
@Nullable @Override public Object call() throws Exception {
info("Before lock for.key 1");
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
info("After lock for key 1");
@@ -154,7 +154,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
info("Waited for latch 2");
}
finally {
- cache.unlock(1);
+ cache.lock(1).unlock();
info("Unlocked entry for key 1.");
@@ -174,7 +174,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
info("Latch1 released.");
- assert !cache.lock(1, -1L);
+ assert !cache.lock(1).tryLock();
assert cache.isLocked(1);
assert !cache.isLockedByThread(1);
@@ -187,7 +187,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
latch3.await();
- assert cache.lock(1, -1L);
+ assert cache.lock(1).tryLock();
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
@@ -199,7 +199,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
info("Read value for key 1");
- assert "1".equals(cache.remove(1));
+ assert "1".equals(cache.getAndRemove(1));
info("Removed value for key 1");
@@ -209,7 +209,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
info("Checked that cache is locked for key 1");
}
finally {
- cache.unlock(1);
+ cache.lock(1).unlock();
info("Unlocked cache for key 1");
}
@@ -238,13 +238,13 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
* @throws Exception If test failed.
*/
public void testLockAndPut() throws Throwable {
- final GridCache<Integer, String> cache = ignite.cache(null);
+ final IgniteCache<Integer, String> cache = ignite.jcache(null);
final CountDownLatch latch1 = new CountDownLatch(1);
GridTestThread t1 = new GridTestThread(new Callable<Object>() {
@Nullable @Override public Object call() throws Exception {
- assert cache.lock(1, 0L);
+ cache.lock(1).lock();
info("Locked cache key: 1");
@@ -268,7 +268,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
info("Woke up from sleep.");
}
finally {
- cache.unlock(1);
+ cache.lock(1).unlock();
info("Unlocked cache key: 1");
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/7737e759/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
index ce1ebfe..1a42c15 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
@@ -83,10 +83,12 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
* @throws Exception If test fails.
*/
public void testBasicLocks() throws Throwable {
+ final IgniteCache<Object, Object> cache = grid().jcache(null);
+
GridTestUtils.runMultiThreaded(new Callable<Object>() {
/** {@inheritDoc} */
@Override public Object call() throws Exception {
- assert cache.lock(1, 1000L);
+ assert cache.lock(1).tryLock(1000L, TimeUnit.MILLISECONDS);
info("Locked key from thread: " + thread());
@@ -94,7 +96,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
info("Unlocking key from thread: " + thread());
- cache.unlock(1);
+ cache.lock(1).unlock();
info("Unlocked key from thread: " + thread());
@@ -167,6 +169,8 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
* @throws Exception If test fails.
*/
public void testSingleLockTimeout() throws Exception {
+ final IgniteCache<Object, Object> cache = grid().jcache(null);
+
final CountDownLatch l1 = new CountDownLatch(1);
final CountDownLatch l2 = new CountDownLatch(1);
@@ -175,7 +179,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
@Override public Object call() throws Exception {
assert !cache.isLocked(1);
- assert cache.lock(1, 0);
+ cache.lock(1).lock();
assert cache.isLockedByThread(1);
assert cache.isLocked(1);
@@ -184,7 +188,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
l2.await();
- cache.unlock(1);
+ cache.lock(1).unlock();
assert !cache.isLockedByThread(1);
assert !cache.isLocked(1);
@@ -201,7 +205,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
assert cache.isLocked(1);
assert !cache.isLockedByThread(1);
- assert !cache.lock(1, 100L);
+ assert !cache.lock(1).tryLock(100L, TimeUnit.MILLISECONDS);
assert cache.isLocked(1);
assert !cache.isLockedByThread(1);
[13/15] incubator-ignite git commit: Renamed license file according
to Apache standards.
Posted by sb...@apache.org.
Renamed license file according to Apache standards.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/062b899d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/062b899d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/062b899d
Branch: refs/heads/ignite-43
Commit: 062b899d449404732aa8b55d07ea594fd2a754a2
Parents: da0235b
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Fri Jan 16 12:02:36 2015 -0800
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Fri Jan 16 12:02:36 2015 -0800
----------------------------------------------------------------------
LICENSE.txt | 202 ++++++++++++++++++++++++++++++++++++++++++++++++++++
apache-2.0.txt | 202 ----------------------------------------------------
2 files changed, 202 insertions(+), 202 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/062b899d/LICENSE.txt
----------------------------------------------------------------------
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100755
index 0000000..d645695
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/062b899d/apache-2.0.txt
----------------------------------------------------------------------
diff --git a/apache-2.0.txt b/apache-2.0.txt
deleted file mode 100755
index d645695..0000000
--- a/apache-2.0.txt
+++ /dev/null
@@ -1,202 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
[07/15] incubator-ignite git commit: IGNITE-59 Support lock,
lockAll: Fix tests.
Posted by sb...@apache.org.
IGNITE-59 Support lock, lockAll: Fix tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/c5fae8e1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/c5fae8e1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/c5fae8e1
Branch: refs/heads/ignite-43
Commit: c5fae8e18683f612320ad2628e0b22d05cd0e26a
Parents: eec3b6c
Author: sevdokimov <se...@gridgain.com>
Authored: Fri Jan 16 13:13:02 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jan 16 15:45:41 2015 +0300
----------------------------------------------------------------------
.../cache/distributed/GridCacheLockAbstractTest.java | 2 +-
.../cache/distributed/near/GridCacheNearMultiNodeSelfTest.java | 2 +-
.../cache/distributed/near/GridCacheNearOneNodeSelfTest.java | 4 ++--
.../kernal/processors/ggfs/GridGgfsMetaManagerSelfTest.java | 6 ++++--
4 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5fae8e1/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
index 639534b..44c86e5 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
@@ -352,7 +352,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
info("Put key-value pair into cache: 1='2'");
- assertEquals("2", cache1.remove(1));
+ assertEquals("2", cache1.getAndRemove(1));
l2.countDown();
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5fae8e1/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
index f63d2d7..56549e9 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearMultiNodeSelfTest.java
@@ -761,7 +761,7 @@ public class GridCacheNearMultiNodeSelfTest extends GridCommonAbstractTest {
try {
assertEquals(val, near.get(key));
- assertEquals(val, near.remove(key));
+ assertEquals(val, near.getAndRemove(key));
assertNull(near.localPeek(key));
assertNull(dht(primaryGrid(key)).peek(key));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5fae8e1/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
index 25adeea..0e583e5 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCacheNearOneNodeSelfTest.java
@@ -213,7 +213,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
assertEquals("1", dht().peek(1));
assertEquals("1", near.get(1));
- assertEquals("1", near.remove(1));
+ assertEquals("1", near.getAndRemove(1));
assertNull(near.localPeek(1));
assertNull(dht().peek(1));
@@ -248,7 +248,7 @@ public class GridCacheNearOneNodeSelfTest extends GridCommonAbstractTest {
try {
assertEquals("1", near.get(1));
- assertEquals("1", near.remove(1));
+ assertEquals("1", near.getAndRemove(1));
assertNull(near.localPeek(1));
assertNull(dht().peek(1));
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/c5fae8e1/modules/core/src/test/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsMetaManagerSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsMetaManagerSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsMetaManagerSelfTest.java
index 7e932ed..41030e6 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsMetaManagerSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/ggfs/GridGgfsMetaManagerSelfTest.java
@@ -161,7 +161,8 @@ public class GridGgfsMetaManagerSelfTest extends GridGgfsCommonAbstractTest {
GridGgfsFileInfo info = mgr.info(fileId);
assertNull("Expects empty properties are not stored: " + info, getFieldValue(info, "props"));
- assertEquals("Expects empty properties are not stored: " + info, Collections.emptyMap(), info.properties());
+ assertEquals("Expects empty properties are not stored: " + info, Collections.<String, String>emptyMap(),
+ info.properties());
info = mgr.updateProperties(ROOT_ID, fileId, fileName, F.asMap(key1, "1"));
@@ -178,7 +179,8 @@ public class GridGgfsMetaManagerSelfTest extends GridGgfsCommonAbstractTest {
info = mgr.updateProperties(ROOT_ID, fileId, fileName, F.<String, String>asMap(key2, null));
assertNull("Expects empty properties are not stored: " + info, getFieldValue(info, "props"));
- assertEquals("Expects empty properties are not stored: " + info, Collections.emptyMap(), info.properties());
+ assertEquals("Expects empty properties are not stored: " + info, Collections.<String, String>emptyMap(),
+ info.properties());
assertNull(mgr.updateProperties(ROOT_ID, fileId, "not_exists", F.<String, String>asMap(key2, null)));
}
[03/15] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-64'
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-64'
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/725d79ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/725d79ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/725d79ff
Branch: refs/heads/ignite-43
Commit: 725d79ff46b280ab967b6988845240a5bd0022b0
Parents: e4c2bc4 779e5d5
Author: avinogradov <av...@gridgain.com>
Authored: Thu Jan 15 19:18:28 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Thu Jan 15 19:18:28 2015 +0300
----------------------------------------------------------------------
.../test/java/org/gridgain/grid/p2p/p2p.properties | 17 -----------------
1 file changed, 17 deletions(-)
----------------------------------------------------------------------
[12/15] incubator-ignite git commit: # Cleanup code: remove
unnecessary null-checking.
Posted by sb...@apache.org.
# Cleanup code: remove unnecessary null-checking.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/80b986f4
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/80b986f4
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/80b986f4
Branch: refs/heads/ignite-43
Commit: 80b986f46340a811cd6d991218249a30f5a7ada3
Parents: 785bf10
Author: sevdokimov <se...@gridgain.com>
Authored: Fri Jan 16 16:49:13 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jan 16 16:49:13 2015 +0300
----------------------------------------------------------------------
.../gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/80b986f4/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
index 9b8945a..7b2b2a7 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
@@ -238,7 +238,7 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
assert mem != null;
if (val != null || valBytes != null) {
- boolean valIsByteArr = val != null && val instanceof byte[];
+ boolean valIsByteArr = val instanceof byte[];
if (valBytes == null && !valIsByteArr)
valBytes = CU.marshal(cctx.shared(), val);
[15/15] incubator-ignite git commit: Merge remote-tracking branch
'remotes/origin/ignite-1' into ignite-43
Posted by sb...@apache.org.
Merge remote-tracking branch 'remotes/origin/ignite-1' into ignite-43
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2a2eb5a3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2a2eb5a3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2a2eb5a3
Branch: refs/heads/ignite-43
Commit: 2a2eb5a3f2c162378067d398391413abcaf87ac1
Parents: 09df7de 6dd8b40
Author: sboikov <sb...@gridgain.com>
Authored: Mon Jan 19 10:41:09 2015 +0400
Committer: sboikov <sb...@gridgain.com>
Committed: Mon Jan 19 10:41:09 2015 +0400
----------------------------------------------------------------------
LICENSE.txt | 202 ++++++++++++++
apache-2.0.txt | 202 --------------
.../java/org/apache/ignite/IgniteCache.java | 4 +-
.../processors/cache/IgniteCacheProxy.java | 76 +++++-
.../processors/cache/GridCacheMapEntry.java | 2 +-
.../grid/kernal/visor/query/VisorQueryTask.java | 53 ++--
.../tcp/GridCacheDhtLockBackupSelfTest.java | 18 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 271 ++++---------------
.../cache/GridCacheBasicApiAbstractTest.java | 91 ++++---
.../GridCacheFinishPartitionsSelfTest.java | 22 +-
.../GridCacheGroupLockAbstractSelfTest.java | 24 +-
.../cache/GridCacheNestedTxAbstractTest.java | 28 +-
.../GridCacheOffHeapTieredAbstractSelfTest.java | 38 +--
.../distributed/GridCacheLockAbstractTest.java | 40 +--
.../GridCacheMultiNodeLockAbstractTest.java | 144 +++++++---
.../dht/GridCacheColocatedDebugTest.java | 26 +-
...dCachePartitionedTopologyChangeSelfTest.java | 8 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 16 +-
.../near/GridCacheNearOneNodeSelfTest.java | 39 +--
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 42 ---
.../near/GridCacheNearReadersSelfTest.java | 14 +-
...titionedExplicitLockNodeFailureSelfTest.java | 1 +
.../near/GridCachePartitionedLockSelfTest.java | 11 +-
.../GridCacheEvictionLockUnlockSelfTest.java | 7 +-
.../cache/local/GridCacheLocalLockSelfTest.java | 36 +--
.../GridCacheLocalMultithreadedSelfTest.java | 42 +--
.../ggfs/GridGgfsMetaManagerSelfTest.java | 6 +-
.../java/org/gridgain/grid/p2p/p2p.properties | 17 --
28 files changed, 699 insertions(+), 781 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2a2eb5a3/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2a2eb5a3/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
[02/15] incubator-ignite git commit: Properties hotfix for
GridP2PDoubleDeploymentSelfTest
Posted by sb...@apache.org.
Properties hotfix for GridP2PDoubleDeploymentSelfTest
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/779e5d5e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/779e5d5e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/779e5d5e
Branch: refs/heads/ignite-43
Commit: 779e5d5e98df232f8003cd1724270184239a7b8e
Parents: 31d6342
Author: avinogradov <av...@gridgain.com>
Authored: Thu Jan 15 11:30:51 2015 +0300
Committer: avinogradov <av...@gridgain.com>
Committed: Thu Jan 15 11:30:51 2015 +0300
----------------------------------------------------------------------
.../test/java/org/gridgain/grid/p2p/p2p.properties | 17 -----------------
1 file changed, 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/779e5d5e/modules/core/src/test/java/org/gridgain/grid/p2p/p2p.properties
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/p2p/p2p.properties b/modules/core/src/test/java/org/gridgain/grid/p2p/p2p.properties
index 0927c53..f1b49d6 100644
--- a/modules/core/src/test/java/org/gridgain/grid/p2p/p2p.properties
+++ b/modules/core/src/test/java/org/gridgain/grid/p2p/p2p.properties
@@ -1,18 +1 @@
-#
-# 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.
-#
-
resource=loaded
[08/15] incubator-ignite git commit: # IGNITE-59 Support lock,
lockAll.
Posted by sb...@apache.org.
# IGNITE-59 Support lock, lockAll.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/26d79649
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/26d79649
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/26d79649
Branch: refs/heads/ignite-43
Commit: 26d796492972453198fbf5e68130fc2f54385b81
Parents: 9e7f696
Author: sevdokimov <se...@gridgain.com>
Authored: Wed Jan 14 18:58:35 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jan 16 15:45:41 2015 +0300
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteCache.java | 4 +-
.../processors/cache/IgniteCacheProxy.java | 76 ++++++++++++++++++--
2 files changed, 73 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/26d79649/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
index 2988005..f4aa3d5 100644
--- a/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/IgniteCache.java
@@ -180,9 +180,9 @@ public interface IgniteCache<K, V> extends javax.cache.Cache<K, V>, IgniteAsyncS
*/
public void removeAll(IgnitePredicate<Entry<K, V>> filter) throws CacheException;
- public Lock lock(K key) throws CacheException;
+ public Lock lock(K key);
- public Lock lockAll(Set<? extends K> keys) throws CacheException;
+ public Lock lockAll(Set<? extends K> keys);
/**
* Checks if any node owns a lock for this key.
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/26d79649/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index f95cd2a..055827b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -23,6 +23,7 @@ import org.apache.ignite.cache.query.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.lang.*;
import org.apache.ignite.resources.*;
+import org.gridgain.grid.*;
import org.gridgain.grid.cache.*;
import org.gridgain.grid.kernal.*;
import org.gridgain.grid.kernal.processors.cache.*;
@@ -258,14 +259,79 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements
/** {@inheritDoc} */
@Override public Lock lock(K key) throws CacheException {
- // TODO IGNITE-1.
- throw new UnsupportedOperationException();
+ return lockAll(Collections.<K>singleton(key));
}
/** {@inheritDoc} */
- @Override public Lock lockAll(Set<? extends K> keys) throws CacheException {
- // TODO IGNITE-1.
- throw new UnsupportedOperationException();
+ @Override public Lock lockAll(final Set<? extends K> keys) {
+ return new Lock() {
+ @Override public void lock() {
+ try {
+ delegate.lockAll(keys, 0);
+ }
+ catch (GridInterruptedException ignored) {
+
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException(e);
+ }
+ }
+
+ @Override public void lockInterruptibly() throws InterruptedException {
+ if (Thread.interrupted())
+ throw new InterruptedException();
+
+ try {
+ delegate.lockAll(keys, 0);
+ }
+ catch (GridInterruptedException e) {
+ if (e.getCause() instanceof InterruptedException)
+ throw (InterruptedException)e.getCause();
+
+ throw new InterruptedException();
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException(e);
+ }
+ }
+
+ @Override public boolean tryLock() {
+ try {
+ return delegate.lockAll(keys, -1);
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException(e);
+ }
+ }
+
+ @Override public boolean tryLock(long time, TimeUnit unit) throws InterruptedException {
+ try {
+ return delegate.lockAll(keys, unit.toMillis(time));
+ }
+ catch (GridInterruptedException e) {
+ if (e.getCause() instanceof InterruptedException)
+ throw (InterruptedException)e.getCause();
+
+ throw new InterruptedException();
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException(e);
+ }
+ }
+
+ @Override public void unlock() {
+ try {
+ delegate.unlockAll(keys);
+ }
+ catch (IgniteCheckedException e) {
+ throw new CacheException(e);
+ }
+ }
+
+ @NotNull @Override public Condition newCondition() {
+ throw new UnsupportedOperationException();
+ }
+ };
}
/** {@inheritDoc} */
[14/15] incubator-ignite git commit: Merge remote-tracking branch
'origin/ignite-1' into ignite-1
Posted by sb...@apache.org.
Merge remote-tracking branch 'origin/ignite-1' into ignite-1
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/6dd8b40f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/6dd8b40f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/6dd8b40f
Branch: refs/heads/ignite-43
Commit: 6dd8b40f36411c41870adb20e6d6f6c26d4f7c33
Parents: 062b899 80b986f
Author: Dmitiry Setrakyan <ds...@gridgain.com>
Authored: Fri Jan 16 12:03:21 2015 -0800
Committer: Dmitiry Setrakyan <ds...@gridgain.com>
Committed: Fri Jan 16 12:03:21 2015 -0800
----------------------------------------------------------------------
.../java/org/apache/ignite/IgniteCache.java | 4 +-
.../processors/cache/IgniteCacheProxy.java | 76 +++++-
.../processors/cache/CacheInvokeEntry.java | 14 +
.../processors/cache/GridCacheMapEntry.java | 17 +-
.../cache/transactions/IgniteTxAdapter.java | 22 +-
.../grid/kernal/visor/query/VisorQueryTask.java | 53 ++--
.../tcp/GridCacheDhtLockBackupSelfTest.java | 18 +-
.../cache/GridCacheAbstractFullApiSelfTest.java | 271 ++++---------------
.../cache/GridCacheBasicApiAbstractTest.java | 91 ++++---
.../GridCacheFinishPartitionsSelfTest.java | 22 +-
.../GridCacheGroupLockAbstractSelfTest.java | 24 +-
.../cache/GridCacheNestedTxAbstractTest.java | 28 +-
.../GridCacheOffHeapTieredAbstractSelfTest.java | 38 +--
.../distributed/GridCacheLockAbstractTest.java | 40 +--
.../GridCacheMultiNodeLockAbstractTest.java | 144 +++++++---
.../dht/GridCacheColocatedDebugTest.java | 26 +-
...dCachePartitionedTopologyChangeSelfTest.java | 8 +-
.../near/GridCacheNearMultiNodeSelfTest.java | 16 +-
.../near/GridCacheNearOneNodeSelfTest.java | 39 +--
...idCacheNearOnlyMultiNodeFullApiSelfTest.java | 42 ---
.../near/GridCacheNearReadersSelfTest.java | 14 +-
...titionedExplicitLockNodeFailureSelfTest.java | 1 +
.../near/GridCachePartitionedLockSelfTest.java | 11 +-
.../GridCacheEvictionLockUnlockSelfTest.java | 7 +-
.../cache/local/GridCacheLocalLockSelfTest.java | 36 +--
.../GridCacheLocalMultithreadedSelfTest.java | 42 +--
.../ggfs/GridGgfsMetaManagerSelfTest.java | 6 +-
.../java/org/gridgain/grid/p2p/p2p.properties | 17 --
28 files changed, 546 insertions(+), 581 deletions(-)
----------------------------------------------------------------------
[09/15] incubator-ignite git commit: IGNITE-59 Support lock,
lockAll: Fix tests.
Posted by sb...@apache.org.
IGNITE-59 Support lock, lockAll: Fix tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/785bf106
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/785bf106
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/785bf106
Branch: refs/heads/ignite-43
Commit: 785bf106568963b2cd52706cb3654f8de76f4e89
Parents: c5fae8e
Author: sevdokimov <se...@gridgain.com>
Authored: Fri Jan 16 13:35:34 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jan 16 15:45:41 2015 +0300
----------------------------------------------------------------------
.../internal/processors/cache/IgniteCacheProxy.java | 10 +++++-----
.../processors/cache/GridCacheBasicApiAbstractTest.java | 6 ++++--
.../near/GridCachePartitionedLockSelfTest.java | 5 +++--
.../cache/local/GridCacheLocalLockSelfTest.java | 2 +-
4 files changed, 13 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785bf106/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
index 055827b..0c98124 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/IgniteCacheProxy.java
@@ -273,7 +273,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements
}
catch (IgniteCheckedException e) {
- throw new CacheException(e);
+ throw new CacheException(e.getMessage(), e);
}
}
@@ -291,7 +291,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements
throw new InterruptedException();
}
catch (IgniteCheckedException e) {
- throw new CacheException(e);
+ throw new CacheException(e.getMessage(), e);
}
}
@@ -300,7 +300,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements
return delegate.lockAll(keys, -1);
}
catch (IgniteCheckedException e) {
- throw new CacheException(e);
+ throw new CacheException(e.getMessage(), e);
}
}
@@ -315,7 +315,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements
throw new InterruptedException();
}
catch (IgniteCheckedException e) {
- throw new CacheException(e);
+ throw new CacheException(e.getMessage(), e);
}
}
@@ -324,7 +324,7 @@ public class IgniteCacheProxy<K, V> extends IgniteAsyncSupportAdapter implements
delegate.unlockAll(keys);
}
catch (IgniteCheckedException e) {
- throw new CacheException(e);
+ throw new CacheException(e.getMessage(), e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785bf106/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
index 2e5d00e..62f64ca 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
@@ -41,6 +41,7 @@ import static org.apache.ignite.events.IgniteEventType.*;
/**
* Test cases for multi-threaded tests.
*/
+@SuppressWarnings("LockAcquiredButNotSafelyReleased")
public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTest {
/** Grid. */
private Ignite ignite;
@@ -129,6 +130,8 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
Lock lock = cache.lock(1);
+ lock.lock();
+
assert cache.isLocked(1);
assert cache.isLockedByThread(1);
@@ -182,7 +185,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
assert cache.isLockedByThread(key);
try {
- assert "1".equals(cache.remove(key));
+ assert "1".equals(cache.getAndRemove(key));
}
finally {
cache.lock(key).unlock();
@@ -432,7 +435,6 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
info("Stop latch wait 3");
- assert cache.containsKey(key);
assert cache.isLocked(key);
}
finally {
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785bf106/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
index 24d84ea..a0be693 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
@@ -28,6 +28,7 @@ import org.gridgain.grid.kernal.processors.cache.distributed.*;
import org.gridgain.grid.util.typedef.*;
import org.gridgain.testframework.*;
+import javax.cache.*;
import java.util.*;
import java.util.concurrent.*;
@@ -76,13 +77,13 @@ public class GridCachePartitionedLockSelfTest extends GridCacheLockAbstractTest
@Override public Object call() throws Exception {
return cache.lock(1).tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
- }, IgniteCheckedException.class, "Locks are not supported");
+ }, CacheException.class, "Locks are not supported");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
return cache.lockAll(Collections.singleton(1)).tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
- }, IgniteCheckedException.class, "Locks are not supported");
+ }, CacheException.class, "Locks are not supported");
final IgniteFuture<Boolean> lockFut1 = g0.cache(null).lockAsync(1, Long.MAX_VALUE);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/785bf106/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java
index 49a83ac..de1da2b 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalLockSelfTest.java
@@ -293,7 +293,7 @@ public class GridCacheLocalLockSelfTest extends GridCommonAbstractTest {
info("Put key-value pair into cache: 1='2'");
- assert "2".equals(cache.remove(1));
+ assert "2".equals(cache.getAndRemove(1));
info("Removed key from cache: 1");
[06/15] incubator-ignite git commit: IGNITE-59 Support lock,
lockAll: Fix tests.
Posted by sb...@apache.org.
IGNITE-59 Support lock, lockAll: Fix tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/eec3b6c7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/eec3b6c7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/eec3b6c7
Branch: refs/heads/ignite-43
Commit: eec3b6c71c7bc285440422b13b6d5a44a6fd3d24
Parents: 2d69d23
Author: sevdokimov <se...@gridgain.com>
Authored: Thu Jan 15 19:09:14 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jan 16 15:45:41 2015 +0300
----------------------------------------------------------------------
.../distributed/GridCacheLockAbstractTest.java | 31 +++++++-------------
.../near/GridCachePartitionedLockSelfTest.java | 6 ++--
2 files changed, 15 insertions(+), 22 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eec3b6c7/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
index fd77a1d..639534b 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/GridCacheLockAbstractTest.java
@@ -49,10 +49,10 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
private static Ignite ignite2;
/** (for convenience). */
- private static GridCache<Integer, String> cache1;
+ private static IgniteCache<Integer, String> cache1;
/** (for convenience). */
- private static GridCache<Integer, String> cache2;
+ private static IgniteCache<Integer, String> cache2;
/** Ip-finder. */
private static TcpDiscoveryIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
@@ -104,8 +104,8 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
ignite1 = startGrid(1);
ignite2 = startGrid(2);
- cache1 = ignite1.cache(null);
- cache2 = ignite2.cache(null);
+ cache1 = ignite1.jcache(null);
+ cache2 = ignite2.jcache(null);
}
/** {@inheritDoc} */
@@ -127,8 +127,8 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
cache2.flagsOn(GridCacheFlag.SYNC_COMMIT).removeAll();
- assert cache1.isEmpty() : "Cache is not empty: " + cache1.entrySet();
- assert cache2.isEmpty() : "Cache is not empty: " + cache2.entrySet();
+ assert cache1.size() == 0 : "Cache is not empty: " + cache1;
+ assert cache2.size() == 0 : "Cache is not empty: " + cache2;
}
/**
@@ -172,9 +172,6 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
*/
@SuppressWarnings({"TooBroadScope"})
public void testLockSingleThread() throws Exception {
- final IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
- final IgniteCache<Integer, String> cache2 = ignite1.jcache(null);
-
int k = 1;
String v = String.valueOf(k);
@@ -208,9 +205,6 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
*/
@SuppressWarnings({"TooBroadScope"})
public void testLock() throws Exception {
- final IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
- final IgniteCache<Integer, String> cache2 = ignite1.jcache(null);
-
final int kv = 1;
final CountDownLatch l1 = new CountDownLatch(1);
@@ -299,9 +293,6 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
* @throws Exception If test failed.
*/
public void testLockAndPut() throws Exception {
- final IgniteCache<Integer, String> cache1 = ignite1.jcache(null);
- final IgniteCache<Integer, String> cache2 = ignite1.jcache(null);
-
final CountDownLatch l1 = new CountDownLatch(1);
final CountDownLatch l2 = new CountDownLatch(1);
@@ -388,7 +379,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
public void testLockTimeoutTwoThreads() throws Exception {
int keyCnt = 1;
- final Collection<Integer> keys = new ArrayList<>(keyCnt);
+ final Set<Integer> keys = new HashSet<>();
for (int i = 1; i <= keyCnt; i++)
keys.add(i);
@@ -400,7 +391,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
@Nullable @Override public Object call() throws Exception {
info("Before lock for keys.");
- assert cache1.lockAll(keys, 0);
+ cache1.lockAll(keys).lock();
info("After lock for keys.");
@@ -428,7 +419,7 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
info("Before unlock keys in thread 1: " + keys);
- cache1.unlockAll(keys);
+ cache1.lockAll(keys).unlock();
info("Unlocked entry for keys.");
}
@@ -448,11 +439,11 @@ public abstract class GridCacheLockAbstractTest extends GridCommonAbstractTest {
// This call should not acquire the lock since
// other thread is holding it.
- assert !cache1.lockAll(keys, -1);
+ assert !cache1.lockAll(keys).tryLock();
info("Before unlock keys in thread 2: " + keys);
- cache1.unlockAll(keys);
+ cache1.lockAll(keys).unlock();
// The keys should still be locked.
for (Integer key : keys)
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/eec3b6c7/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
index 26edf39..24d84ea 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/distributed/near/GridCachePartitionedLockSelfTest.java
@@ -70,15 +70,17 @@ public class GridCachePartitionedLockSelfTest extends GridCacheLockAbstractTest
final Ignite g0 = G.start(cfg);
+ final IgniteCache<Object, Object> cache = g0.jcache(null);
+
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
- return g0.jcache(null).lock(1).tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
+ return cache.lock(1).tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
}, IgniteCheckedException.class, "Locks are not supported");
GridTestUtils.assertThrows(log, new Callable<Object>() {
@Override public Object call() throws Exception {
- return g0.cache(null).lockAll(Arrays.asList(1), Long.MAX_VALUE);
+ return cache.lockAll(Collections.singleton(1)).tryLock(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
}
}, IgniteCheckedException.class, "Locks are not supported");
[10/15] incubator-ignite git commit: IGNITE-59 Support lock,
lockAll: Fix tests.
Posted by sb...@apache.org.
IGNITE-59 Support lock, lockAll: Fix tests.
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/2d69d237
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/2d69d237
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/2d69d237
Branch: refs/heads/ignite-43
Commit: 2d69d23746f834ea1a4442f01fe4f1fe4e0f90c7
Parents: 7737e75
Author: sevdokimov <se...@gridgain.com>
Authored: Thu Jan 15 19:02:31 2015 +0300
Committer: sevdokimov <se...@gridgain.com>
Committed: Fri Jan 16 15:45:41 2015 +0300
----------------------------------------------------------------------
.../cache/GridCacheAbstractFullApiSelfTest.java | 115 +++++--------------
.../cache/GridCacheBasicApiAbstractTest.java | 8 +-
.../GridCacheLocalMultithreadedSelfTest.java | 28 +++--
3 files changed, 49 insertions(+), 102 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2d69d237/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
index 4447383..2fb802b 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheAbstractFullApiSelfTest.java
@@ -17,6 +17,7 @@
package org.gridgain.grid.kernal.processors.cache;
+import com.google.common.collect.*;
import org.apache.ignite.*;
import org.apache.ignite.cluster.*;
import org.apache.ignite.configuration.*;
@@ -278,11 +279,13 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
*/
public void testRemoveInExplicitLocks() throws Exception {
if (lockingEnabled()) {
- GridCache<String, Integer> cache = cache();
+ IgniteCache<String, Integer> cache = jcache();
cache.put("a", 1);
- cache.lockAll(F.asList("a", "b", "c", "d"), 0);
+ Lock lock = cache.lockAll(ImmutableSet.of("a", "b", "c", "d"));
+
+ lock.lock();
try {
cache.remove("a");
@@ -291,7 +294,7 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
cache.putAll(F.asMap("b", 2, "c", 3, "d", 4));
}
finally {
- cache.unlockAll(F.asList("a", "b", "c", "d"));
+ lock.unlock();
}
}
}
@@ -3693,109 +3696,47 @@ public abstract class GridCacheAbstractFullApiSelfTest extends GridCacheAbstract
@SuppressWarnings("BusyWait")
public void testLockUnlockAll() throws Exception {
if (lockingEnabled()) {
- cache().put("key1", 1);
- cache().put("key2", 2);
+ IgniteCache<String, Integer> cache = jcache();
- assert !cache().isLocked("key1");
- assert !cache().isLocked("key2");
+ cache.put("key1", 1);
+ cache.put("key2", 2);
+
+ assert !cache.isLocked("key1");
+ assert !cache.isLocked("key2");
- cache().lockAll(F.asList("key1", "key2"), 0);
+ cache.lockAll(ImmutableSet.of("key1", "key2")).lock();
- assert cache().isLocked("key1");
- assert cache().isLocked("key2");
+ assert cache.isLocked("key1");
+ assert cache.isLocked("key2");
- cache().unlockAll(F.asList("key1", "key2"));
+ cache.lockAll(ImmutableSet.of("key1", "key2")).unlock();
for (int i = 0; i < 100; i++)
- if (cache().isLocked("key1") || cache().isLocked("key2"))
+ if (cache.isLocked("key1") || cache.isLocked("key2"))
Thread.sleep(10);
else
break;
- assert !cache().isLocked("key1");
- assert !cache().isLocked("key2");
+ assert !cache.isLocked("key1");
+ assert !cache.isLocked("key2");
- cache().lockAll(F.asList("key1", "key2"), 0);
+ Lock lock = cache.lockAll(ImmutableSet.of("key1", "key2"));
- assert cache().isLocked("key1");
- assert cache().isLocked("key2");
+ lock.lock();
- cache().unlockAll(F.asList("key1", "key2"));
+ assert cache.isLocked("key1");
+ assert cache.isLocked("key2");
+
+ lock.unlock();
for (int i = 0; i < 100; i++)
- if (cache().isLocked("key1") || cache().isLocked("key2"))
+ if (cache.isLocked("key1") || cache.isLocked("key2"))
Thread.sleep(10);
else
break;
- assert !cache().isLocked("key1");
- assert !cache().isLocked("key2");
- }
- }
-
- /**
- * @throws Exception In case of error.
- */
- @SuppressWarnings("BusyWait")
- public void testLockAllFiltered() throws Exception {
- if (lockingEnabled()) {
- cache().put("key1", 1);
- cache().put("key2", 2);
- cache().put("key3", 100);
- cache().put("key4", 101);
-
- assert !cache().isLocked("key1");
- assert !cache().isLocked("key2");
- assert !cache().isLocked("key3");
- assert !cache().isLocked("key4");
-
- assert !cache().isLockedByThread("key1");
- assert !cache().isLockedByThread("key2");
- assert !cache().isLockedByThread("key3");
- assert !cache().isLockedByThread("key4");
-
- assert !cache().projection(gte100).lockAll(F.asList("key2", "key3"), 0);
-
- assert !cache().isLocked("key1");
- assert !cache().isLocked("key2");
- assert !cache().isLocked("key3");
- assert !cache().isLocked("key4");
-
- assert !cache().isLockedByThread("key1");
- assert !cache().isLockedByThread("key2");
- assert !cache().isLockedByThread("key3");
- assert !cache().isLockedByThread("key4");
-
- assert cache().projection(F.<GridCacheEntry<String, Integer>>alwaysTrue()).lockAll(
- F.asList("key1", "key2", "key3", "key4"), 0);
-
- assert cache().isLocked("key1");
- assert cache().isLocked("key2");
- assert cache().isLocked("key3");
- assert cache().isLocked("key4");
-
- assert cache().isLockedByThread("key1");
- assert cache().isLockedByThread("key2");
- assert cache().isLockedByThread("key3");
- assert cache().isLockedByThread("key4");
-
- cache().unlockAll(F.asList("key1", "key2", "key3", "key4"),
- F.<GridCacheEntry<String, Integer>>alwaysTrue());
-
- for (String key : cache().primaryKeySet()) {
- for (int i = 0; i < 100; i++)
- if (cache().isLocked(key))
- Thread.sleep(10);
- else
- break;
-
- assert !cache().isLocked(key);
- }
-
- assert !cache().isLockedByThread("key1");
- assert !cache().isLockedByThread("key2");
- assert !cache().isLockedByThread("key3");
- assert !cache().isLockedByThread("key4");
+ assert !cache.isLocked("key1");
+ assert !cache.isLocked("key2");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2d69d237/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
index 54c141e..2e5d00e 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/GridCacheBasicApiAbstractTest.java
@@ -449,13 +449,13 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
* @throws Exception If test failed.
*/
public void testMultiLocks() throws Exception {
- GridCache<Integer, String> cache = ignite.cache(null);
+ IgniteCache<Integer, String> cache = ignite.jcache(null);
- Collection<Integer> keys = new ArrayList<>(3);
+ Set<Integer> keys = new HashSet<>();
Collections.addAll(keys, 1, 2, 3);
- assert cache.lockAll(keys, 0);
+ cache.lockAll(keys).lock();
assert cache.isLocked(1);
assert cache.isLocked(2);
@@ -465,7 +465,7 @@ public abstract class GridCacheBasicApiAbstractTest extends GridCommonAbstractTe
assert cache.isLockedByThread(2);
assert cache.isLockedByThread(3);
- cache.unlockAll(keys);
+ cache.lockAll(keys).unlock();
assert !cache.isLocked(1);
assert !cache.isLocked(2);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/2d69d237/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
----------------------------------------------------------------------
diff --git a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
index 1a42c15..624c5be 100644
--- a/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
+++ b/modules/core/src/test/java/org/gridgain/grid/kernal/processors/cache/local/GridCacheLocalMultithreadedSelfTest.java
@@ -109,14 +109,16 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
* @throws Exception If test fails.
*/
public void testMultiLocks() throws Throwable {
+ final IgniteCache<Integer, String> cache = grid().jcache(null);
+
GridTestUtils.runMultiThreaded(new Callable<Object>() {
/** {@inheritDoc} */
@Override public Object call() throws Exception {
- Collection<Integer> keys = new ArrayList<>();
+ Set<Integer> keys = new HashSet<Integer>();
Collections.addAll(keys, 1, 2, 3);
- assert cache.lockAll(keys, 0);
+ cache.lockAll(keys).lock();
info("Locked keys from thread [keys=" + keys + ", thread=" + thread() + ']');
@@ -124,7 +126,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
info("Unlocking key from thread: " + thread());
- cache.unlockAll(keys);
+ cache.lockAll(keys).unlock();
info("Unlocked keys from thread: " + thread());
@@ -137,6 +139,8 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
* @throws Exception If test fails.
*/
public void testSlidingKeysLocks() throws Throwable {
+ final IgniteCache<Integer, String> cache = grid().jcache(null);
+
final AtomicInteger cnt = new AtomicInteger();
GridTestUtils.runMultiThreaded(new Callable<Object>() {
@@ -144,11 +148,11 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
@Override public Object call() throws Exception {
int idx = cnt.incrementAndGet();
- Collection<Integer> keys = new ArrayList<>();
+ Set<Integer> keys = new HashSet<>();
Collections.addAll(keys, idx, idx + 1, idx + 2, idx + 3);
- assert cache.lockAll(keys, 0);
+ cache.lockAll(keys).lock();
info("Locked keys from thread [keys=" + keys + ", thread=" + thread() + ']');
@@ -156,7 +160,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
info("Unlocking key from thread [keys=" + keys + ", thread=" + thread() + ']');
- cache.unlockAll(keys);
+ cache.lockAll(keys).unlock();
info("Unlocked keys from thread [keys=" + keys + ", thread=" + thread() + ']');
@@ -235,14 +239,16 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
* @throws Exception If test fails.
*/
public void testMultiLockTimeout() throws Exception {
+ final IgniteCache<Integer, String> cache = grid().jcache(null);
+
final CountDownLatch l1 = new CountDownLatch(1);
final CountDownLatch l2 = new CountDownLatch(1);
final CountDownLatch l3 = new CountDownLatch(1);
final AtomicInteger cnt = new AtomicInteger();
- final Collection<Integer> keys1 = new ArrayList<>();
- final Collection<Integer> keys2 = new ArrayList<>();
+ final Set<Integer> keys1 = new HashSet<>();
+ final Set<Integer> keys2 = new HashSet<>();
GridTestThread t1 = new GridTestThread(new Callable<Object>() {
/** {@inheritDoc} */
@@ -253,7 +259,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
Collections.addAll(keys1, idx, idx + 1, idx + 2, idx + 3);
- assert cache.lockAll(keys1, 0);
+ cache.lockAll(keys1).lock();
for (Integer key : keys1) {
assert cache.isLocked(key) : "Failed to acquire lock for key: " + key;
@@ -264,7 +270,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
l2.await();
- cache.unlockAll(keys1);
+ cache.lockAll(keys1).unlock();
for (Integer key : keys1) {
assert !cache.isLocked(key);
@@ -292,7 +298,7 @@ public class GridCacheLocalMultithreadedSelfTest extends GridCommonAbstractTest
}
// Lock won't be acquired due to timeout.
- assert !cache.lockAll(keys2, 100);
+ assert !cache.lockAll(keys2).tryLock(100, TimeUnit.MILLISECONDS);
for (Integer key : keys2) {
boolean locked = cache.isLocked(key);
[05/15] incubator-ignite git commit: # ignite-1 Skip update if entry
processor did not modify entry
Posted by sb...@apache.org.
# ignite-1 Skip update if entry processor did not modify entry
Project: http://git-wip-us.apache.org/repos/asf/incubator-ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ignite/commit/9e7f6962
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ignite/tree/9e7f6962
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ignite/diff/9e7f6962
Branch: refs/heads/ignite-43
Commit: 9e7f69625463409ab9a41349f1805e38fdc32f92
Parents: fb0b20a
Author: sboikov <sb...@gridgain.com>
Authored: Fri Jan 16 14:10:12 2015 +0300
Committer: sboikov <sb...@gridgain.com>
Committed: Fri Jan 16 14:10:12 2015 +0300
----------------------------------------------------------------------
.../processors/cache/CacheInvokeEntry.java | 14 +++++++++++++
.../processors/cache/GridCacheMapEntry.java | 15 +++++++++++++
.../cache/transactions/IgniteTxAdapter.java | 22 ++++++++++++++++++--
3 files changed, 49 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e7f6962/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java
index c9ca244..ab7dfc4 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/CacheInvokeEntry.java
@@ -26,6 +26,9 @@ public class CacheInvokeEntry<K, V> implements MutableEntry<K, V> {
@GridToStringInclude
private V val;
+ /** */
+ private boolean modified;
+
/**
* @param key Key.
* @param val Value.
@@ -43,6 +46,8 @@ public class CacheInvokeEntry<K, V> implements MutableEntry<K, V> {
/** {@inheritDoc} */
@Override public void remove() {
val = null;
+
+ modified = true;
}
/** {@inheritDoc} */
@@ -51,6 +56,8 @@ public class CacheInvokeEntry<K, V> implements MutableEntry<K, V> {
throw new NullPointerException();
this.val = val;
+
+ modified = true;
}
/** {@inheritDoc} */
@@ -68,6 +75,13 @@ public class CacheInvokeEntry<K, V> implements MutableEntry<K, V> {
throw new IllegalArgumentException();
}
+ /**
+ * @return {@code True} if {@link #setValue} or {@link #remove was called}.
+ */
+ public boolean modified() {
+ return modified;
+ }
+
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(CacheInvokeEntry.class, this);
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e7f6962/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
index d4987e3..9b8945a 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/GridCacheMapEntry.java
@@ -1473,6 +1473,9 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
invokeRes = new CacheInvokeResult<>(e);
}
+
+ if (!entry.modified())
+ return new GridTuple3<>(false, null, invokeRes);
}
else
updated = (V)writeObj;
@@ -1826,6 +1829,18 @@ public abstract class GridCacheMapEntry<K, V> implements GridCacheEntryEx<K, V>
valBytes = oldBytes.getIfMarshaled();
}
+
+ if (!entry.modified()) {
+ return new GridCacheUpdateAtomicResult<>(false,
+ retval ? old : null,
+ null,
+ invokeRes,
+ -1L,
+ -1L,
+ null,
+ null,
+ false);
+ }
}
else
updated = (V)writeObj;
http://git-wip-us.apache.org/repos/asf/incubator-ignite/blob/9e7f6962/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
index d9b4d5c..6ab424a 100644
--- a/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
+++ b/modules/core/src/main/java/org/gridgain/grid/kernal/processors/cache/transactions/IgniteTxAdapter.java
@@ -31,6 +31,7 @@ import org.gridgain.grid.util.lang.*;
import org.gridgain.grid.util.tostring.*;
import org.jetbrains.annotations.*;
+import javax.cache.processor.*;
import java.io.*;
import java.util.*;
import java.util.concurrent.atomic.*;
@@ -1207,9 +1208,26 @@ public abstract class IgniteTxAdapter<K, V> extends GridMetadataAwareAdapter
CU.<K, V>empty(),
null);
- val = txEntry.applyEntryProcessors(val);
+ boolean modified = false;
- GridCacheOperation op = val == null ? DELETE : UPDATE;
+ for (T2<EntryProcessor<K, V, ?>, Object[]> t : txEntry.entryProcessors()) {
+ CacheInvokeEntry<K, V> invokeEntry = new CacheInvokeEntry<>(txEntry.key(), val);
+
+ try {
+ EntryProcessor processor = t.get1();
+
+ processor.process(invokeEntry, t.get2());
+
+ val = invokeEntry.getValue();
+ }
+ catch (Exception ignore) {
+ // No-op.
+ }
+
+ modified |= invokeEntry.modified();
+ }
+
+ GridCacheOperation op = modified ? (val == null ? DELETE : UPDATE) : NOOP;
return F.t(op, (V)cacheCtx.<V>unwrapTemporary(val), null);
}