You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by vo...@apache.org on 2016/09/08 14:45:45 UTC

[03/50] ignite git commit: wip

wip


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

Branch: refs/heads/ignite-3199-1
Commit: 31e36f3322e323700da6c4935051247fc21c32f3
Parents: be620f2
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 16:31:01 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 16:31:01 2016 +0300

----------------------------------------------------------------------
 .../KeyValueDirtyTrackedCollection.java         |  9 ++++
 .../platform/websession/SessionStateData.java   | 11 ++++
 .../websession/SetAndUnlockEntryProcessor.java  | 55 ++++++++++++++++++++
 3 files changed, 75 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/31e36f33/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/KeyValueDirtyTrackedCollection.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/KeyValueDirtyTrackedCollection.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/KeyValueDirtyTrackedCollection.java
index fc04b6f..e963d723 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/KeyValueDirtyTrackedCollection.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/KeyValueDirtyTrackedCollection.java
@@ -76,6 +76,15 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
         }
     }
 
+    /**
+     * Apply changes from another instance.
+     *
+     * @param items Items.
+     */
+    public void applyChanges(KeyValueDirtyTrackedCollection items) {
+
+    }
+
     /** Entry. */
     private static class Entry {
         /** */

http://git-wip-us.apache.org/repos/asf/ignite/blob/31e36f33/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateData.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateData.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateData.java
index 1f705ef..509bbb3 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateData.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateData.java
@@ -99,4 +99,15 @@ public class SessionStateData implements Binarylizable {
         items = raw.readObject();
         staticObjects = raw.readByteArray();
     }
+
+    /**
+     * Apply changes from another instance.
+     *
+     * @param data Data.
+     */
+    public void applyChanges(SessionStateData data) {
+        timeout = data.timeout;
+        staticObjects = data.staticObjects;
+        items.applyChanges(data.items);
+    }
 }

http://git-wip-us.apache.org/repos/asf/ignite/blob/31e36f33/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SetAndUnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SetAndUnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SetAndUnlockEntryProcessor.java
new file mode 100644
index 0000000..23ac0e1
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SetAndUnlockEntryProcessor.java
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.processors.platform.websession;
+
+import org.apache.ignite.cache.CacheEntryProcessor;
+
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+
+/**
+ * Entry processor that unlocks web session data.
+ */
+public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, SessionStateData, Object> {
+    /** {@inheritDoc} */
+    @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
+        throws EntryProcessorException {
+        assert entry.exists();
+
+        SessionStateData data = entry.getValue();
+
+        assert data != null;
+        assert data.getLockNodeId() != null;
+
+        SessionStateData newData = (SessionStateData)objects[0];
+
+        assert data.getLockNodeId() == newData.getLockNodeId();
+        assert data.getLockId() == newData.getLockId();
+
+        // Unlock.
+        data.setLockNodeId(null);
+
+        // Update values.
+        data.applyChanges(newData);
+
+        // Apply.
+        entry.setValue(data);
+
+        return null;
+    }
+}