ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject ignite git commit: ignite-4285
Date Wed, 30 Nov 2016 10:20:34 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-4285 e7df145ce -> ed32c839e


ignite-4285


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ed32c839
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ed32c839
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ed32c839

Branch: refs/heads/ignite-4285
Commit: ed32c839eac6b7e9c2f7fe48277eb166eb6f501e
Parents: e7df145
Author: sboikov <sboikov@gridgain.com>
Authored: Wed Nov 30 13:20:28 2016 +0300
Committer: sboikov <sboikov@gridgain.com>
Committed: Wed Nov 30 13:20:28 2016 +0300

----------------------------------------------------------------------
 .../processors/cache/GridCacheMapEntry.java     |  4 +-
 .../processors/cache/GridCacheMvcc.java         | 45 +++++++++----------
 .../distributed/GridDistributedCacheEntry.java  |  2 +-
 .../cache/local/GridLocalCacheEntry.java        | 47 +++++++++++++++++---
 4 files changed, 65 insertions(+), 33 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/ed32c839/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
index eef4bfc..0c30174 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMapEntry.java
@@ -3389,14 +3389,14 @@ public abstract class GridCacheMapEntry extends GridMetadataAwareAdapter
impleme
     }
 
     /** {@inheritDoc} */
-    @Override public synchronized boolean hasValue() {
+    @Override public final synchronized boolean hasValue() {
         return hasValueUnlocked();
     }
 
     /**
      * @return {@code True} if this entry has value.
      */
-    protected boolean hasValueUnlocked() {
+    protected final boolean hasValueUnlocked() {
         assert Thread.holdsLock(this);
 
         return val != null || hasOffHeapPointer();

http://git-wip-us.apache.org/repos/asf/ignite/blob/ed32c839/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
index be7fd75..0ef3f6f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/GridCacheMvcc.java
@@ -150,15 +150,14 @@ public final class GridCacheMvcc {
     @Nullable public CacheLockCandidates localOwners() {
         if (locs != null) {
             assert !locs.isEmpty();
-
             CacheLockCandidates owners = null;
 
             GridCacheMvccCandidate first = locs.getFirst();
 
-            if (first.serializable() && first.read()) {
+            if (first.read()) {
                 for (GridCacheMvccCandidate cand : locs) {
                     if (cand.owner()) {
-                        assert cand.serializable() && cand.read() : cand;
+                        assert cand.read() : this;
 
                         if (owners != null) {
                             if (owners.size() == 1) {
@@ -175,7 +174,7 @@ public final class GridCacheMvcc {
                             owners = cand;
                     }
 
-                    if (!cand.serializable() || !cand.read())
+                    if (!cand.read())
                         break;
                 }
             }
@@ -876,18 +875,16 @@ public final class GridCacheMvcc {
                     if (c.owner())
                         continue;
 
-                    assert !c.ready() || (cand.read() && c.read()):
+                    assert !c.ready() || (c.read() && cand.read()):
                         "Cannot have more then one ready near-local candidate [c=" + c +
", cand=" + cand +
                             ", mvcc=" + this + ']';
 
-                    if (!c.ready()) {
-                        it.remove();
+                    it.remove();
 
-                        if (mvAfter == null)
-                            mvAfter = new LinkedList<>();
+                    if (mvAfter == null)
+                        mvAfter = new LinkedList<>();
 
-                        mvAfter.add(c);
-                    }
+                    mvAfter.add(c);
                 }
             }
 
@@ -1040,16 +1037,8 @@ public final class GridCacheMvcc {
             while (it.hasNext()) {
                 GridCacheMvccCandidate cand = it.next();
 
-                if (first && cand.serializable()) {
-                    if (!cand.read()) {
-                        if (cand.owner() || !cand.ready())
-                            return;
-
-                        cand.setOwner();
-                    }
-                    else {
-                        assert cand.serializable() : cand;
-
+                if (first) {
+                    if (cand.read()) {
                         if (cand.ready() && !cand.owner())
                             cand.setOwner();
 
@@ -1059,14 +1048,20 @@ public final class GridCacheMvcc {
                             if (!cand.read())
                                 break;
 
-                            assert cand.serializable() : cand;
-
                             if (cand.ready() && !cand.owner())
                                 cand.setOwner();
                         }
+
+                        return;
                     }
+                    else if (cand.serializable()) {
+                        if (cand.owner() || !cand.ready())
+                            return;
 
-                    return;
+                        cand.setOwner();
+
+                        return;
+                    }
                 }
 
                 first = false;
@@ -1151,7 +1146,7 @@ public final class GridCacheMvcc {
                     }
 
                     if (assigned) {
-                        assert !cand.serializable() && !cand.read() : cand;
+                        assert !cand.serializable() : cand;
 
                         it.remove();
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ed32c839/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
index 91a3e75..2a11c01 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/distributed/GridDistributedCacheEntry.java
@@ -668,7 +668,7 @@ public class GridDistributedCacheEntry extends GridCacheMapEntry {
     }
 
     /** {@inheritDoc} */
-    @Override public void txUnlock(IgniteInternalTx tx) throws GridCacheEntryRemovedException
{
+    @Override public final void txUnlock(IgniteInternalTx tx) throws GridCacheEntryRemovedException
{
         removeLock(tx.xidVersion());
     }
 

http://git-wip-us.apache.org/repos/asf/ignite/blob/ed32c839/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
index 156e3e3..9d45084 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/local/GridLocalCacheEntry.java
@@ -230,6 +230,24 @@ public class GridLocalCacheEntry extends GridCacheMapEntry {
                 if (unlocked) {
                     cctx.mvcc().callback().onOwnerChanged(this, null);
 
+                    if (cctx.events().isRecordable(EVT_CACHE_OBJECT_UNLOCKED)) {
+                        boolean hasVal = hasValue();
+
+                        cctx.events().addEvent(partition(),
+                            key,
+                            cand.nodeId(),
+                            cand,
+                            EVT_CACHE_OBJECT_UNLOCKED,
+                            val,
+                            hasVal,
+                            val,
+                            hasVal,
+                            null,
+                            null,
+                            null,
+                            true);
+                    }
+
                     break;
                 }
             }
@@ -237,14 +255,33 @@ public class GridLocalCacheEntry extends GridCacheMapEntry {
 
         if (owners != null) {
             for (int i = 0; i < owners.size(); i++) {
-                GridCacheMvccCandidate cand = owners.candidate(i);
+                GridCacheMvccCandidate owner = owners.candidate(i);
 
-                boolean locked = prevOwners == null || !prevOwners.hasCandidate(cand.version());
+                boolean locked = prevOwners == null || !prevOwners.hasCandidate(owner.version());
 
                 if (locked) {
-                    cctx.mvcc().callback().onOwnerChanged(this, cand);
-
-                    checkThreadChain(cand);
+                    cctx.mvcc().callback().onOwnerChanged(this, owner);
+
+                    checkThreadChain(owner);
+
+                    if (cctx.events().isRecordable(EVT_CACHE_OBJECT_LOCKED)) {
+                        boolean hasVal = hasValue();
+
+                        // Event notification.
+                        cctx.events().addEvent(partition(),
+                            key,
+                            owner.nodeId(),
+                            owner,
+                            EVT_CACHE_OBJECT_LOCKED,
+                            val,
+                            hasVal,
+                            val,
+                            hasVal,
+                            null,
+                            null,
+                            null,
+                            true);
+                    }
                 }
             }
         }


Mime
View raw message