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:43 UTC
[01/50] ignite git commit: wip
Repository: ignite
Updated Branches:
refs/heads/ignite-3199-1 [created] 8359c220f
wip
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4c12e74f
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4c12e74f
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4c12e74f
Branch: refs/heads/ignite-3199-1
Commit: 4c12e74f79c22456732a1d2a04c11b23bccafb3f
Parents: d38813a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 16:16:58 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 16:16:58 2016 +0300
----------------------------------------------------------------------
.../processors/platform/websession/LockEntryProcessor.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4c12e74f/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 65badae..9629f9d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -36,7 +36,8 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
// Arg contains lock info: node id + thread id
// Return result is either BinarizableSessionStateStoreData (when not locked) or lockAge (when locked)
- assert entry.exists();
+ if (!entry.exists())
+ return null;
SessionStateData data = entry.getValue();
[38/50] ignite git commit: Return LockEntryResult from
LockEntryProcessor
Posted by vo...@apache.org.
Return LockEntryResult from LockEntryProcessor
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/0a9f577c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/0a9f577c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/0a9f577c
Branch: refs/heads/ignite-3199-1
Commit: 0a9f577c92934ba251db2a2b5303f390d54d6f37
Parents: 5c947bc
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 13:09:20 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 13:09:20 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryProcessor.java | 4 +-
.../platform/websession/LockEntryResult.java | 100 +++++++++++++++++++
2 files changed, 102 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9f577c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index ff5107a..2df0ab2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -44,7 +44,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
assert data != null;
if (data.isLocked())
- return data.lockTime();
+ return new LockEntryResult(false, null, data.lockTime());
SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[0];
@@ -54,7 +54,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
// Apply.
entry.setValue(data);
- return data;
+ return new LockEntryResult(true, data, null);
}
/** {@inheritDoc */
http://git-wip-us.apache.org/repos/asf/ignite/blob/0a9f577c/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryResult.java
new file mode 100644
index 0000000..27512c5
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryResult.java
@@ -0,0 +1,100 @@
+/*
+ * 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.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import java.sql.Timestamp;
+
+/**
+ * Result of the {@link LockEntryProcessor} execution.
+ */
+@SuppressWarnings({"AssignmentToDateFieldFromParameter", "ReturnOfDateField"})
+public class LockEntryResult implements Binarylizable {
+ /** Success flag. */
+ private boolean success;
+
+ /** Data. */
+ private SessionStateData data;
+
+ /** Lock time. */
+ private Timestamp lockTime;
+
+ /**
+ * Ctor.
+ *
+ * @param success Success flag.
+ * @param data Session data.
+ * @param lockTime Lock time.
+ */
+ public LockEntryResult(boolean success, SessionStateData data, Timestamp lockTime) {
+ this.success = success;
+ this.data = data;
+ this.lockTime = lockTime;
+ }
+
+ /**
+ * @return Success flag.
+ */
+ public boolean success() {
+ return success;
+ }
+
+ /**
+ * @return Session state data.
+ */
+ public SessionStateData data() {
+ return data;
+ }
+
+ /**
+ * @return Lock time.
+ */
+ public Timestamp lockTime() {
+ return lockTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ BinaryRawWriter raw = writer.rawWriter();
+
+ raw.writeBoolean(success);
+ raw.writeObject(data);
+ raw.writeTimestamp(lockTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ BinaryRawReader raw = reader.rawReader();
+
+ success = raw.readBoolean();
+ data = raw.readObject();
+ lockTime = raw.readTimestamp();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(LockEntryResult.class, this);
+ }
+}
[20/50] ignite git commit: wip
Posted by vo...@apache.org.
wip
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6221aed4
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6221aed4
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6221aed4
Branch: refs/heads/ignite-3199-1
Commit: 6221aed4f23c6ac269801e1bfc70d92565e54469
Parents: 3141a80
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 18:54:48 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 18:54:48 2016 +0300
----------------------------------------------------------------------
.../Impl/IgniteSessionStateItemCollection.cs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6221aed4/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
index 5f46248..5609961 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
@@ -136,9 +136,12 @@ namespace Apache.Ignite.AspNet.Impl
/// </summary>
private class NameObjectCollection : NameObjectCollectionBase
{
- public NameObjectCollection(IgniteSessionStateItemCollection col)
+ /// <summary>
+ /// Initializes a new instance of the <see cref="NameObjectCollection"/> class.
+ /// </summary>
+ public NameObjectCollection(IEnumerable keys)
{
- foreach (string key in col)
+ foreach (string key in keys)
BaseAdd(key, null);
}
}
[14/50] ignite git commit: fix checks
Posted by vo...@apache.org.
fix checks
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4d767696
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4d767696
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4d767696
Branch: refs/heads/ignite-3199-1
Commit: 4d7676964342239fc51760967077aedab257d9f2
Parents: 4a4ab88
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 18:25:57 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 18:25:57 2016 +0300
----------------------------------------------------------------------
.../processors/platform/websession/UnlockEntryProcessor.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d767696/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index d9be048..79b9c3b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -38,8 +38,11 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
LockInfo lockInfo = (LockInfo)objects[0];
- assert data.getLockNodeId().equals(lockInfo.getLockNodeId());
- assert data.getLockId() == lockInfo.getLockId();
+ if (!data.getLockNodeId().equals(lockInfo.getLockNodeId()))
+ throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
+
+ if (data.getLockId() != lockInfo.getLockId())
+ throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
data.setLockNodeId(null);
[06/50] ignite git commit: fix bin obj
Posted by vo...@apache.org.
fix bin obj
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b8e92999
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b8e92999
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b8e92999
Branch: refs/heads/ignite-3199-1
Commit: b8e9299935fb9f1ef6a2abf42d30ef3449490823
Parents: fdae22b
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 16:38:56 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 16:38:56 2016 +0300
----------------------------------------------------------------------
.../internal/processors/platform/cache/PlatformCache.java | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b8e92999/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index e4bf9ab..3550e8a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.platform.cache;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheEntryProcessor;
import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CachePartialUpdateException;
@@ -488,7 +489,9 @@ public class PlatformCache extends PlatformAbstractTarget {
}
case OP_INVOKE_INTERNAL_SESSION_SET_AND_UNLOCK:
- SessionStateData data = (SessionStateData)args[1];
+ BinaryObject binData = (BinaryObject)args[1]; // Cache is in binary mode.
+
+ SessionStateData data = binData.deserialize();
cache.invoke(key, new SetAndUnlockEntryProcessor(), data);
[46/50] ignite git commit: Extract custom processors to a separate
class
Posted by vo...@apache.org.
Extract custom processors to a separate class
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ae7b1b2b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ae7b1b2b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ae7b1b2b
Branch: refs/heads/ignite-3199-1
Commit: ae7b1b2bf76284b714a27f8c62eb9750d5648f2a
Parents: a304542
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 14:53:07 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 14:53:07 2016 +0300
----------------------------------------------------------------------
.../platform/cache/PlatformCache.java | 68 +++-------------
.../platform/cache/PlatformCacheInvoker.java | 83 ++++++++++++++++++++
2 files changed, 96 insertions(+), 55 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ae7b1b2b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 276867f..3a0b51a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -19,6 +19,7 @@ package org.apache.ignite.internal.processors.platform.cache;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
+import org.apache.ignite.binary.BinaryRawReader;
import org.apache.ignite.cache.CacheEntryProcessor;
import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CachePartialUpdateException;
@@ -49,11 +50,6 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformFutureUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformListenable;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformWriterClosure;
-import org.apache.ignite.internal.processors.platform.websession.LockEntryProcessor;
-import org.apache.ignite.internal.processors.platform.websession.SessionStateLockInfo;
-import org.apache.ignite.internal.processors.platform.websession.SessionStateData;
-import org.apache.ignite.internal.processors.platform.websession.SetAndUnlockEntryProcessor;
-import org.apache.ignite.internal.processors.platform.websession.UnlockEntryProcessor;
import org.apache.ignite.internal.util.GridConcurrentFactory;
import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.C1;
@@ -63,6 +59,7 @@ import org.apache.ignite.lang.IgniteFuture;
import org.jetbrains.annotations.Nullable;
import javax.cache.Cache;
+import javax.cache.CacheException;
import javax.cache.expiry.Duration;
import javax.cache.expiry.ExpiryPolicy;
import javax.cache.integration.CompletionListener;
@@ -201,15 +198,6 @@ public class PlatformCache extends PlatformAbstractTarget {
/** */
public static final int OP_INVOKE_INTERNAL = 41;
- /** */
- public static final int OP_INVOKE_INTERNAL_SESSION_LOCK = 1;
-
- /** */
- public static final int OP_INVOKE_INTERNAL_SESSION_UNLOCK = 2;
-
- /** */
- public static final int OP_INVOKE_INTERNAL_SESSION_SET_AND_UNLOCK = 3;
-
/** Underlying JCache in binary mode. */
private final IgniteCacheProxy cache;
@@ -220,13 +208,13 @@ public class PlatformCache extends PlatformAbstractTarget {
private final boolean keepBinary;
/** */
- private static final GetAllWriter WRITER_GET_ALL = new GetAllWriter();
+ private static final PlatformFutureUtils.Writer WRITER_GET_ALL = new GetAllWriter();
/** */
- private static final EntryProcessorInvokeWriter WRITER_INVOKE = new EntryProcessorInvokeWriter();
+ private static final PlatformFutureUtils.Writer WRITER_INVOKE = new EntryProcessorInvokeWriter();
/** */
- private static final EntryProcessorInvokeAllWriter WRITER_INVOKE_ALL = new EntryProcessorInvokeAllWriter();
+ private static final PlatformFutureUtils.Writer WRITER_INVOKE_ALL = new EntryProcessorInvokeAllWriter();
/** Map with currently active locks. */
private final ConcurrentMap<Long, Lock> lockMap = GridConcurrentFactory.newMap();
@@ -297,7 +285,7 @@ public class PlatformCache extends PlatformAbstractTarget {
if (cache.isAsync())
return this;
- return new PlatformCache(platformCtx, (IgniteCache)cacheRaw.withAsync(), keepBinary);
+ return new PlatformCache(platformCtx, cacheRaw.withAsync(), keepBinary);
}
/**
@@ -469,38 +457,8 @@ public class PlatformCache extends PlatformAbstractTarget {
});
}
- case OP_INVOKE_INTERNAL: {
- int opCode = reader.readInt();
-
- String key = reader.readString();
-
- switch (opCode) {
- case OP_INVOKE_INTERNAL_SESSION_LOCK: {
- SessionStateLockInfo lockInfo = reader.readObject();
-
- Object res = cacheRaw.invoke(key, new LockEntryProcessor(), lockInfo);
-
- return writeResult(mem, res);
- }
-
- case OP_INVOKE_INTERNAL_SESSION_UNLOCK: {
- SessionStateLockInfo lockInfo = reader.readObject();
-
- cacheRaw.invoke(key, new UnlockEntryProcessor(), lockInfo);
-
- return FALSE;
- }
-
- case OP_INVOKE_INTERNAL_SESSION_SET_AND_UNLOCK:
- SessionStateData data = reader.readObject();
-
- cacheRaw.invoke(key, new SetAndUnlockEntryProcessor(), data);
-
- return FALSE;
- }
-
- return writeResult(mem, null);
- }
+ case OP_INVOKE_INTERNAL:
+ return writeResult(mem, PlatformCacheInvoker.invoke(reader, cacheRaw));
case OP_LOCK:
return registerLock(cache.lock(reader.readObjectDetached()));
@@ -720,7 +678,7 @@ public class PlatformCache extends PlatformAbstractTarget {
return new PlatformCachePartialUpdateException((CachePartialUpdateCheckedException)e, platformCtx, keepBinary);
if (e.getCause() instanceof EntryProcessorException)
- return (EntryProcessorException) e.getCause();
+ return (Exception)e.getCause();
return super.convertException(e);
}
@@ -798,7 +756,7 @@ public class PlatformCache extends PlatformAbstractTarget {
* Clears the contents of the cache, without notifying listeners or CacheWriters.
*
* @throws IllegalStateException if the cache is closed.
- * @throws javax.cache.CacheException if there is a problem during the clear
+ * @throws CacheException if there is a problem during the clear
*/
public void clear() throws IgniteCheckedException {
cache.clear();
@@ -807,7 +765,7 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Removes all entries.
*
- * @throws org.apache.ignite.IgniteCheckedException In case of error.
+ * @throws IgniteCheckedException In case of error.
*/
public void removeAll() throws IgniteCheckedException {
cache.removeAll();
@@ -1024,7 +982,7 @@ public class PlatformCache extends PlatformAbstractTarget {
/**
* Reads text query.
*/
- private Query readTextQuery(BinaryRawReaderEx reader) {
+ private Query readTextQuery(BinaryRawReader reader) {
boolean loc = reader.readBoolean();
String txt = reader.readString();
String typ = reader.readString();
@@ -1143,7 +1101,7 @@ public class PlatformCache extends PlatformAbstractTarget {
* @param update Expiry for update.
* @param access Expiry for access.
*/
- public InteropExpiryPolicy(long create, long update, long access) {
+ private InteropExpiryPolicy(long create, long update, long access) {
this.create = convert(create);
this.update = convert(update);
this.access = convert(access);
http://git-wip-us.apache.org/repos/asf/ignite/blob/ae7b1b2b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java
new file mode 100644
index 0000000..64d1a8b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java
@@ -0,0 +1,83 @@
+/*
+ * 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.cache;
+
+import org.apache.ignite.IgniteCache;
+import org.apache.ignite.internal.binary.BinaryRawReaderEx;
+import org.apache.ignite.internal.processors.platform.websession.LockEntryProcessor;
+import org.apache.ignite.internal.processors.platform.websession.SessionStateData;
+import org.apache.ignite.internal.processors.platform.websession.SessionStateLockInfo;
+import org.apache.ignite.internal.processors.platform.websession.SetAndUnlockEntryProcessor;
+import org.apache.ignite.internal.processors.platform.websession.UnlockEntryProcessor;
+
+/**
+ * Custom entry processor invoker.
+ */
+public class PlatformCacheInvoker {
+ /** */
+ public static final int OP_SESSION_LOCK = 1;
+
+ /** */
+ public static final int OP_SESSION_UNLOCK = 2;
+
+ /** */
+ public static final int OP_SESSION_SET_AND_UNLOCK = 3;
+
+ /**
+ * Invokes the custom processor.
+ *
+ * @param reader Reader.
+ * @param cache Cache.
+ *
+ * @return Result.
+ */
+ @SuppressWarnings("unchecked")
+ public static Object invoke(BinaryRawReaderEx reader, IgniteCache cache) {
+ int opCode = reader.readInt();
+
+ String key = reader.readString();
+
+ Object res = null;
+
+ switch (opCode) {
+ case OP_SESSION_LOCK: {
+ SessionStateLockInfo lockInfo = reader.readObject();
+
+ res = cache.invoke(key, new LockEntryProcessor(), lockInfo);
+
+ break;
+ }
+
+ case OP_SESSION_UNLOCK: {
+ SessionStateLockInfo lockInfo = reader.readObject();
+
+ cache.invoke(key, new UnlockEntryProcessor(), lockInfo);
+
+ break;
+ }
+
+ case OP_SESSION_SET_AND_UNLOCK:
+ SessionStateData data = reader.readObject();
+
+ cache.invoke(key, new SetAndUnlockEntryProcessor(), data);
+
+ break;
+ }
+ return res;
+ }
+}
[10/50] ignite git commit: fix raw operation
Posted by vo...@apache.org.
fix raw operation
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4208f93e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4208f93e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4208f93e
Branch: refs/heads/ignite-3199-1
Commit: 4208f93e472d1f28d5d25fa86ae6b12fe9532cf7
Parents: 5a503c7
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 17:42:01 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 17:42:01 2016 +0300
----------------------------------------------------------------------
.../Impl/AspNet/SessionStateData.cs | 2 +-
.../KeyValueDirtyTrackedCollection.cs | 25 ++++++++++----------
2 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4208f93e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateData.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateData.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateData.cs
index 1e088bd..da4d96b 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateData.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateData.cs
@@ -92,7 +92,7 @@ namespace Apache.Ignite.Core.Impl.AspNet
/// <param name="writer">Writer.</param>
public void WriteBinary(IBinaryWriter writer)
{
- var raw = (IBinaryRawWriter) writer;
+ var raw = writer.GetRawWriter();
raw.WriteInt(Timeout);
raw.WriteGuid(LockNodeId);
http://git-wip-us.apache.org/repos/asf/ignite/blob/4208f93e/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
index d02e133..028a18d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
@@ -192,33 +192,34 @@ namespace Apache.Ignite.Core.Impl.Collections
if (_isDiff)
throw new InvalidOperationException(string.Format("Cannot serialize incomplete {0}.", GetType()));
- var wr = (BinaryWriter) writer;
+ var raw = writer.GetRawWriter();
+ var wr = (BinaryWriter) raw;
if (_isNew || _dirtyAll || !WriteChangesOnly || (_removedKeys == null && _list.All(x => x.IsDirty)))
{
// Write in full mode.
- wr.WriteBoolean(true);
- wr.WriteInt(_list.Count);
+ raw.WriteBoolean(true);
+ raw.WriteInt(_list.Count);
foreach (var entry in _list)
{
- wr.WriteString(entry.Key);
+ raw.WriteString(entry.Key);
// Write as byte array to enable partial deserialization.
- wr.WriteByteArray(entry.GetBytes(wr.Marshaller));
+ raw.WriteByteArray(entry.GetBytes(wr.Marshaller));
}
}
else
{
// Write in diff mode.
- wr.WriteBoolean(false);
+ raw.WriteBoolean(false);
var stream = wr.Stream;
var countPos = stream.Position;
var count = 0;
- wr.WriteInt(count); // reserve count
+ raw.WriteInt(count); // reserve count
// Write dirty items.
foreach (var entry in _list)
@@ -226,10 +227,10 @@ namespace Apache.Ignite.Core.Impl.Collections
if (!entry.IsDirty)
continue;
- wr.WriteString(entry.Key);
+ raw.WriteString(entry.Key);
// Write as byte array to enable partial deserialization.
- wr.WriteByteArray(entry.GetBytes(wr.Marshaller));
+ raw.WriteByteArray(entry.GetBytes(wr.Marshaller));
count++;
}
@@ -250,14 +251,14 @@ namespace Apache.Ignite.Core.Impl.Collections
foreach (var entry in _list)
removed.Remove(entry.Key);
- wr.WriteInt(removed.Count);
+ raw.WriteInt(removed.Count);
foreach (var removedKey in removed)
- wr.WriteString(removedKey);
+ raw.WriteString(removedKey);
}
else
{
- wr.WriteInt(0);
+ raw.WriteInt(0);
}
}
}
[35/50] ignite git commit: Rename LockInfo
Posted by vo...@apache.org.
Rename LockInfo
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/52d8e625
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/52d8e625
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/52d8e625
Branch: refs/heads/ignite-3199-1
Commit: 52d8e6251b7d4544dac9eb4d48a9f9d79bb4c1d8
Parents: 8a6458f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 12:35:07 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 12:35:07 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockInfo.java | 87 --------------------
.../websession/SessionStateLockInfo.java | 87 ++++++++++++++++++++
2 files changed, 87 insertions(+), 87 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/52d8e625/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
deleted file mode 100644
index 28bca3a..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.platform.websession;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-import java.sql.Timestamp;
-import java.util.UUID;
-
-/**
- * Web session lock info.
- */
-public class LockInfo implements Binarylizable {
- /** ID. */
- private long id;
-
- /** Node ID. */
- private UUID nodeId;
-
- /** Time. */
- private Timestamp time;
-
- /**
- * @return Lock ID.
- */
- public long id() {
- return id;
- }
-
- /**
- * @return Node ID.
- */
- public UUID nodeId() {
- return nodeId;
- }
-
- /**
- * @return Time.
- */
- public Timestamp time() {
- return time;
- }
-
- /** {@inheritDoc} */
- @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
- BinaryRawWriter raw = writer.rawWriter();
-
- raw.writeLong(id);
- raw.writeUuid(nodeId);
- raw.writeTimestamp(time);
- }
-
- /** {@inheritDoc} */
- @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
- BinaryRawReader raw = reader.rawReader();
-
- id = raw.readLong();
- nodeId = raw.readUuid();
- time = raw.readTimestamp();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(LockInfo.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/52d8e625/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockInfo.java
new file mode 100644
index 0000000..45cc317
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockInfo.java
@@ -0,0 +1,87 @@
+/*
+ * 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.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import java.sql.Timestamp;
+import java.util.UUID;
+
+/**
+ * Web session lock info.
+ */
+public class SessionStateLockInfo implements Binarylizable {
+ /** ID. */
+ private long id;
+
+ /** Node ID. */
+ private UUID nodeId;
+
+ /** Time. */
+ private Timestamp time;
+
+ /**
+ * @return Lock ID.
+ */
+ public long id() {
+ return id;
+ }
+
+ /**
+ * @return Node ID.
+ */
+ public UUID nodeId() {
+ return nodeId;
+ }
+
+ /**
+ * @return Time.
+ */
+ public Timestamp time() {
+ return time;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ BinaryRawWriter raw = writer.rawWriter();
+
+ raw.writeLong(id);
+ raw.writeUuid(nodeId);
+ raw.writeTimestamp(time);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ BinaryRawReader raw = reader.rawReader();
+
+ id = raw.readLong();
+ nodeId = raw.readUuid();
+ time = raw.readTimestamp();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SessionStateLockInfo.class, this);
+ }
+}
[44/50] ignite git commit: Create a copy in all processors to support
any copyOnRead mode
Posted by vo...@apache.org.
Create a copy in all processors to support any copyOnRead mode
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b02dce3a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b02dce3a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b02dce3a
Branch: refs/heads/ignite-3199-1
Commit: b02dce3a6f3d298a715251c3b2085402b486b691
Parents: 17cc854
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 14:21:57 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 14:21:57 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryProcessor.java | 2 +-
.../platform/websession/SessionStateData.java | 30 ++++++++++++++------
.../websession/SetAndUnlockEntryProcessor.java | 2 +-
.../websession/UnlockEntryProcessor.java | 2 +-
4 files changed, 25 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b02dce3a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 06f1035..78148b0 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -46,7 +46,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[0];
// Not locked: lock and return result
- data.lock(lockInfo);
+ data = data.lock(lockInfo);
// Apply.
entry.setValue(data);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b02dce3a/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 5ccdada..4586c49 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
@@ -86,23 +86,25 @@ public class SessionStateData implements Binarylizable {
*
* @param lock Lock.
*/
- public void lock(SessionStateLockInfo lock) {
+ public SessionStateData lock(SessionStateLockInfo lock) {
assert !isLocked();
- lockId = lock.id();
- lockNodeId = lock.nodeId();
- lockTime = lock.time();
+ SessionStateData res = getCopy();
+
+ res.lockId = lock.id();
+ res.lockNodeId = lock.nodeId();
+ res.lockTime = lock.time();
+
+ return res;
}
/**
* Clear lock info.
*/
- public void unlock() {
+ public SessionStateData unlock() {
assert isLocked();
- lockId = 0;
- lockNodeId = null;
- lockTime = null;
+ return getCopy();
}
/**
@@ -147,4 +149,16 @@ public class SessionStateData implements Binarylizable {
@Override public String toString() {
return S.toString(SessionStateData.class, this);
}
+
+ /**
+ * Gets a copy of this instance with non-lock properties set.
+ */
+ private SessionStateData getCopy() {
+ SessionStateData res = new SessionStateData();
+
+ res.staticObjects = staticObjects;
+ res.items = items;
+ res.timeout = timeout;
+ return res;
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b02dce3a/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
index 19f3a38..62d05cb 100644
--- 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
@@ -49,7 +49,7 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
- data.unlock();
+ data = data.unlock();
// Update values.
data.applyChanges(newData);
http://git-wip-us.apache.org/repos/asf/ignite/blob/b02dce3a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index 655b314..a22c8a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -49,7 +49,7 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
- data.unlock();
+ data = data.unlock();
entry.setValue(data);
[04/50] ignite git commit: KeyValueDirtyTrackedCollection
applyChanges done
Posted by vo...@apache.org.
KeyValueDirtyTrackedCollection applyChanges done
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ae4a4a12
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ae4a4a12
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ae4a4a12
Branch: refs/heads/ignite-3199-1
Commit: ae4a4a1235dc8408cd6052065522a7998a949a9c
Parents: 31e36f3
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 16:36:19 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 16:36:19 2016 +0300
----------------------------------------------------------------------
.../KeyValueDirtyTrackedCollection.java | 50 +++++++++-----------
.../platform/websession/SessionStateData.java | 13 +++--
2 files changed, 30 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ae4a4a12/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 e963d723..3027868 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
@@ -25,14 +25,16 @@ import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
/**
* Web session lock info.
*/
public class KeyValueDirtyTrackedCollection implements Binarylizable {
/** */
- private List<Entry> list;
+ private HashMap<String, byte[]> entries;
/** */
private List<String> removedKeys;
@@ -45,11 +47,11 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
raw.writeBoolean(true); // Always full mode.
- raw.writeInt(list.size());
+ raw.writeInt(entries.size());
- for (Entry e : list) {
- raw.writeString(e.key);
- raw.writeByteArray(e.value);
+ for (Map.Entry<String, byte[]> e : entries.entrySet()) {
+ raw.writeString(e.getKey());
+ raw.writeByteArray(e.getValue());
}
}
@@ -61,10 +63,10 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
int count = raw.readInt();
- list = new ArrayList<>(count);
+ entries = new HashMap<>(count);
for (int i = 0; i < count; i++)
- list.add(new Entry(raw.readString(), raw.readByteArray()));
+ entries.put(raw.readString(), raw.readByteArray());
if (isDiff) {
count = raw.readInt();
@@ -79,29 +81,21 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
/**
* Apply changes from another instance.
*
- * @param items Items.
+ * @param other Items.
*/
- public void applyChanges(KeyValueDirtyTrackedCollection items) {
+ public void applyChanges(KeyValueDirtyTrackedCollection other) {
+ assert other != null;
- }
-
- /** Entry. */
- private static class Entry {
- /** */
- private String key;
-
- /** */
- private byte[] value;
-
- /**
- * Ctor.
- *
- * @param key Key
- * @param value Value.
- */
- private Entry(String key, byte[] value) {
- this.key = key;
- this.value = value;
+ if (other.removedKeys != null) {
+ for (String key : other.removedKeys)
+ entries.remove(key);
}
+ else {
+ // Not a diff: remove all
+ entries.clear();
+ }
+
+ for (Map.Entry<String, byte[]> e : other.entries.entrySet())
+ entries.put(e.getKey(), e.getValue());
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ae4a4a12/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 509bbb3..bd37d75 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
@@ -103,11 +103,14 @@ public class SessionStateData implements Binarylizable {
/**
* Apply changes from another instance.
*
- * @param data Data.
+ * @param other Data.
*/
- public void applyChanges(SessionStateData data) {
- timeout = data.timeout;
- staticObjects = data.staticObjects;
- items.applyChanges(data.items);
+ public void applyChanges(SessionStateData other) {
+ assert other != null;
+ assert items != null;
+
+ timeout = other.timeout;
+ staticObjects = other.staticObjects;
+ items.applyChanges(other.items);
}
}
[39/50] ignite git commit: SessionStateLockEntryResult
Posted by vo...@apache.org.
SessionStateLockEntryResult
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/89d293b0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/89d293b0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/89d293b0
Branch: refs/heads/ignite-3199-1
Commit: 89d293b06bc3ec2e62e26da63ecee0f7b6748ac4
Parents: 0a9f577
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 13:49:39 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 13:49:39 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryResult.java | 100 -------------------
.../websession/SessionStateLockEntryResult.java | 100 +++++++++++++++++++
2 files changed, 100 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/89d293b0/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryResult.java
deleted file mode 100644
index 27512c5..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryResult.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.platform.websession;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-import java.sql.Timestamp;
-
-/**
- * Result of the {@link LockEntryProcessor} execution.
- */
-@SuppressWarnings({"AssignmentToDateFieldFromParameter", "ReturnOfDateField"})
-public class LockEntryResult implements Binarylizable {
- /** Success flag. */
- private boolean success;
-
- /** Data. */
- private SessionStateData data;
-
- /** Lock time. */
- private Timestamp lockTime;
-
- /**
- * Ctor.
- *
- * @param success Success flag.
- * @param data Session data.
- * @param lockTime Lock time.
- */
- public LockEntryResult(boolean success, SessionStateData data, Timestamp lockTime) {
- this.success = success;
- this.data = data;
- this.lockTime = lockTime;
- }
-
- /**
- * @return Success flag.
- */
- public boolean success() {
- return success;
- }
-
- /**
- * @return Session state data.
- */
- public SessionStateData data() {
- return data;
- }
-
- /**
- * @return Lock time.
- */
- public Timestamp lockTime() {
- return lockTime;
- }
-
- /** {@inheritDoc} */
- @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
- BinaryRawWriter raw = writer.rawWriter();
-
- raw.writeBoolean(success);
- raw.writeObject(data);
- raw.writeTimestamp(lockTime);
- }
-
- /** {@inheritDoc} */
- @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
- BinaryRawReader raw = reader.rawReader();
-
- success = raw.readBoolean();
- data = raw.readObject();
- lockTime = raw.readTimestamp();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(LockEntryResult.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/89d293b0/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockEntryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockEntryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockEntryResult.java
new file mode 100644
index 0000000..28e0a6b
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockEntryResult.java
@@ -0,0 +1,100 @@
+/*
+ * 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.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import java.sql.Timestamp;
+
+/**
+ * Result of the {@link LockEntryProcessor} execution.
+ */
+@SuppressWarnings({"AssignmentToDateFieldFromParameter", "ReturnOfDateField"})
+public class SessionStateLockEntryResult implements Binarylizable {
+ /** Success flag. */
+ private boolean success;
+
+ /** Data. */
+ private SessionStateData data;
+
+ /** Lock time. */
+ private Timestamp lockTime;
+
+ /**
+ * Ctor.
+ *
+ * @param success Success flag.
+ * @param data Session data.
+ * @param lockTime Lock time.
+ */
+ public SessionStateLockEntryResult(boolean success, SessionStateData data, Timestamp lockTime) {
+ this.success = success;
+ this.data = data;
+ this.lockTime = lockTime;
+ }
+
+ /**
+ * @return Success flag.
+ */
+ public boolean success() {
+ return success;
+ }
+
+ /**
+ * @return Session state data.
+ */
+ public SessionStateData data() {
+ return data;
+ }
+
+ /**
+ * @return Lock time.
+ */
+ public Timestamp lockTime() {
+ return lockTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ BinaryRawWriter raw = writer.rawWriter();
+
+ raw.writeBoolean(success);
+ raw.writeObject(data);
+ raw.writeTimestamp(lockTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ BinaryRawReader raw = reader.rawReader();
+
+ success = raw.readBoolean();
+ data = raw.readObject();
+ lockTime = raw.readTimestamp();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SessionStateLockEntryResult.class, this);
+ }
+}
[08/50] ignite git commit: Fix binary mode handling
Posted by vo...@apache.org.
Fix binary mode handling
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8a441034
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8a441034
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8a441034
Branch: refs/heads/ignite-3199-1
Commit: 8a441034898a924277c048516c74c4d1a46a6d38
Parents: 31c586a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 17:06:22 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 17:06:22 2016 +0300
----------------------------------------------------------------------
.../platform/cache/PlatformCache.java | 30 +++++++++++---------
.../platform/websession/LockEntryProcessor.java | 24 +++++++---------
2 files changed, 26 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8a441034/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 3550e8a..93c2436 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -19,7 +19,6 @@ package org.apache.ignite.internal.processors.platform.cache;
import org.apache.ignite.IgniteCache;
import org.apache.ignite.IgniteCheckedException;
-import org.apache.ignite.binary.BinaryObject;
import org.apache.ignite.cache.CacheEntryProcessor;
import org.apache.ignite.cache.CacheMetrics;
import org.apache.ignite.cache.CachePartialUpdateException;
@@ -211,9 +210,12 @@ public class PlatformCache extends PlatformAbstractTarget {
/** */
public static final int OP_INVOKE_INTERNAL_SESSION_SET_AND_UNLOCK = 3;
- /** Underlying JCache. */
+ /** Underlying JCache in binary mode. */
private final IgniteCacheProxy cache;
+ /** Initial JCache (not in binary mode). */
+ private final IgniteCache cacheRaw;
+
/** Whether this cache is created with "keepBinary" flag on the other side. */
private final boolean keepBinary;
@@ -242,7 +244,9 @@ public class PlatformCache extends PlatformAbstractTarget {
public PlatformCache(PlatformContext platformCtx, IgniteCache cache, boolean keepBinary) {
super(platformCtx);
- this.cache = (IgniteCacheProxy)cache;
+ cacheRaw = cache;
+
+ this.cache = (IgniteCacheProxy)cache.withKeepBinary();
this.keepBinary = keepBinary;
}
@@ -255,7 +259,7 @@ public class PlatformCache extends PlatformAbstractTarget {
if (cache.delegate().skipStore())
return this;
- return new PlatformCache(platformCtx, cache.withSkipStore(), keepBinary);
+ return new PlatformCache(platformCtx, cacheRaw.withSkipStore(), keepBinary);
}
/**
@@ -267,7 +271,7 @@ public class PlatformCache extends PlatformAbstractTarget {
if (keepBinary)
return this;
- return new PlatformCache(platformCtx, cache.withKeepBinary(), true);
+ return new PlatformCache(platformCtx, cacheRaw.withKeepBinary(), true);
}
/**
@@ -279,7 +283,7 @@ public class PlatformCache extends PlatformAbstractTarget {
* @return Cache.
*/
public PlatformCache withExpiryPolicy(final long create, final long update, final long access) {
- IgniteCache cache0 = cache.withExpiryPolicy(new InteropExpiryPolicy(create, update, access));
+ IgniteCache cache0 = cacheRaw.withExpiryPolicy(new InteropExpiryPolicy(create, update, access));
return new PlatformCache(platformCtx, cache0, keepBinary);
}
@@ -293,7 +297,7 @@ public class PlatformCache extends PlatformAbstractTarget {
if (cache.isAsync())
return this;
- return new PlatformCache(platformCtx, (IgniteCache)cache.withAsync(), keepBinary);
+ return new PlatformCache(platformCtx, (IgniteCache)cacheRaw.withAsync(), keepBinary);
}
/**
@@ -307,7 +311,7 @@ public class PlatformCache extends PlatformAbstractTarget {
if (opCtx != null && opCtx.noRetries())
return this;
- return new PlatformCache(platformCtx, cache.withNoRetries(), keepBinary);
+ return new PlatformCache(platformCtx, cacheRaw.withNoRetries(), keepBinary);
}
/** {@inheritDoc} */
@@ -475,7 +479,7 @@ public class PlatformCache extends PlatformAbstractTarget {
case OP_INVOKE_INTERNAL_SESSION_LOCK: {
LockInfo lockInfo = (LockInfo)args[1];
- Object res = cache.invoke(key, new LockEntryProcessor(), lockInfo);
+ Object res = cacheRaw.invoke(key, new LockEntryProcessor(), lockInfo);
return writeResult(mem, res);
}
@@ -483,17 +487,15 @@ public class PlatformCache extends PlatformAbstractTarget {
case OP_INVOKE_INTERNAL_SESSION_UNLOCK: {
LockInfo lockInfo = (LockInfo)args[1];
- cache.invoke(key, new UnlockEntryProcessor(), lockInfo);
+ cacheRaw.invoke(key, new UnlockEntryProcessor(), lockInfo);
return FALSE;
}
case OP_INVOKE_INTERNAL_SESSION_SET_AND_UNLOCK:
- BinaryObject binData = (BinaryObject)args[1]; // Cache is in binary mode.
-
- SessionStateData data = binData.deserialize();
+ SessionStateData data = (SessionStateData)args[1];
- cache.invoke(key, new SetAndUnlockEntryProcessor(), data);
+ cacheRaw.invoke(key, new SetAndUnlockEntryProcessor(), data);
return FALSE;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8a441034/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 0f0822b..4f01cb6 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -17,10 +17,7 @@
package org.apache.ignite.internal.processors.platform.websession;
-import org.apache.ignite.binary.BinaryObject;
-import org.apache.ignite.binary.BinaryObjectBuilder;
import org.apache.ignite.cache.CacheEntryProcessor;
-import org.apache.ignite.internal.util.offheap.unsafe.GridOffHeapSnapTreeMap;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.MutableEntry;
@@ -29,9 +26,9 @@ import java.sql.Timestamp;
/**
* Entry processor that locks web session data.
*/
-public class LockEntryProcessor implements CacheEntryProcessor<String, BinaryObject, Object> {
+public class LockEntryProcessor implements CacheEntryProcessor<String, SessionStateData, Object> {
/** {@inheritDoc} */
- @Override public Object process(MutableEntry<String, BinaryObject> entry, Object... objects)
+ @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
throws EntryProcessorException {
// Arg contains lock info: node id + thread id
// Return result is either BinarizableSessionStateStoreData (when not locked) or lockAge (when locked)
@@ -39,13 +36,13 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, BinaryObj
if (!entry.exists())
return null;
- BinaryObject data = entry.getValue();
+ SessionStateData data = entry.getValue();
assert data != null;
- if (data.field("LockNodeId") != null) {
+ if (data.getLockNodeId() != null) {
// Already locked: return lock time.
- Object lockTime = data.field("LockTime");
+ Timestamp lockTime = data.getLockTime();
assert lockTime != null;
@@ -55,13 +52,12 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, BinaryObj
LockInfo lockInfo = (LockInfo)objects[0];
// Not locked: lock and return result
- final BinaryObjectBuilder builder = data.toBuilder();
+ data.setLockNodeId(lockInfo.getLockNodeId());
+ data.setLockId(lockInfo.getLockId());
+ data.setLockTime(lockInfo.getLockTime());
- builder.setField("LockNodeId", lockInfo.getLockNodeId());
- builder.setField("LockId", lockInfo.getLockId());
- builder.setField("LockTime", lockInfo.getLockTime());
-
- entry.setValue(builder.build());
+ // Apply.
+ entry.setValue(data);
return data;
}
[40/50] ignite git commit: SessionStateLockEntryResult
Posted by vo...@apache.org.
SessionStateLockEntryResult
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/348e5d4b
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/348e5d4b
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/348e5d4b
Branch: refs/heads/ignite-3199-1
Commit: 348e5d4b9daf863b94038ee176a21582b50d372c
Parents: 89d293b
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 13:49:42 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 13:49:42 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryProcessor.java | 4 +-
.../Apache.Ignite.Core.Tests.csproj | 2 +-
.../AspNet/LockInfoTest.cs | 64 -----------------
.../AspNet/SessionStateLockInfoTest.cs | 64 +++++++++++++++++
.../Apache.Ignite.Core.csproj | 1 +
.../Impl/AspNet/SessionStateLockEntryResult.cs | 76 ++++++++++++++++++++
6 files changed, 144 insertions(+), 67 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/348e5d4b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 2df0ab2..ea53271 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -44,7 +44,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
assert data != null;
if (data.isLocked())
- return new LockEntryResult(false, null, data.lockTime());
+ return new SessionStateLockEntryResult(false, null, data.lockTime());
SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[0];
@@ -54,7 +54,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
// Apply.
entry.setValue(data);
- return new LockEntryResult(true, data, null);
+ return new SessionStateLockEntryResult(true, data, null);
}
/** {@inheritDoc */
http://git-wip-us.apache.org/repos/asf/ignite/blob/348e5d4b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index 3cb3ff2..79d939d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -64,7 +64,7 @@
<Compile Include="AspNet\IgniteSessionStateItemCollectionTest.cs" />
<Compile Include="AspNet\IgniteSessionStateStoreDataTest.cs" />
<Compile Include="AspNet\IgniteSessionStateStoreProviderTest.cs" />
- <Compile Include="AspNet\LockInfoTest.cs" />
+ <Compile Include="AspNet\SessionStateLockInfoTest.cs" />
<Compile Include="Binary\BinaryReaderWriterTest.cs" />
<Compile Include="Binary\IO\BinaryStreamsTest.cs" />
<Compile Include="Binary\JavaTypeMappingTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/348e5d4b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
deleted file mode 100644
index a65109f..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Tests.AspNet
-{
- using System;
- using Apache.Ignite.Core.Impl.AspNet;
- using NUnit.Framework;
-
- /// <summary>
- /// Tests for <see cref="SessionStateLockInfo"/>.
- /// </summary>
- public class LockInfoTest
- {
- /// <summary>
- /// Tests the equality.
- /// </summary>
- [Test]
- public void TestEquality()
- {
- var lock1 = new SessionStateLockInfo(1, Guid.NewGuid(), DateTime.UtcNow);
- var lock2 = new SessionStateLockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
- var lock3 = new SessionStateLockInfo(lock1.LockId, lock1.LockNodeId, lock1.LockTime);
-
- Assert.AreEqual(lock1, lock3);
- Assert.AreEqual(lock1.GetHashCode(), lock3.GetHashCode());
-
- Assert.IsTrue(lock1 == lock3);
- Assert.IsFalse(lock1 != lock3);
-
- Assert.AreNotEqual(lock1, lock2);
- Assert.AreNotEqual(lock1.GetHashCode(), lock2.GetHashCode());
-
- Assert.IsFalse(lock1 == lock2);
- Assert.IsTrue(lock1 != lock2);
- }
-
- /// <summary>
- /// Tests the serialization.
- /// </summary>
- [Test]
- public void TestSerialization()
- {
- var lock1 = new SessionStateLockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
- var lock2 = TestUtils.SerializeDeserialize(lock1);
-
- Assert.AreEqual(lock1, lock2);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/348e5d4b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/SessionStateLockInfoTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/SessionStateLockInfoTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/SessionStateLockInfoTest.cs
new file mode 100644
index 0000000..161f32b
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/SessionStateLockInfoTest.cs
@@ -0,0 +1,64 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.AspNet
+{
+ using System;
+ using Apache.Ignite.Core.Impl.AspNet;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests for <see cref="SessionStateLockInfo"/>.
+ /// </summary>
+ public class SessionStateLockInfoTest
+ {
+ /// <summary>
+ /// Tests the equality.
+ /// </summary>
+ [Test]
+ public void TestEquality()
+ {
+ var lock1 = new SessionStateLockInfo(1, Guid.NewGuid(), DateTime.UtcNow);
+ var lock2 = new SessionStateLockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
+ var lock3 = new SessionStateLockInfo(lock1.LockId, lock1.LockNodeId, lock1.LockTime);
+
+ Assert.AreEqual(lock1, lock3);
+ Assert.AreEqual(lock1.GetHashCode(), lock3.GetHashCode());
+
+ Assert.IsTrue(lock1 == lock3);
+ Assert.IsFalse(lock1 != lock3);
+
+ Assert.AreNotEqual(lock1, lock2);
+ Assert.AreNotEqual(lock1.GetHashCode(), lock2.GetHashCode());
+
+ Assert.IsFalse(lock1 == lock2);
+ Assert.IsTrue(lock1 != lock2);
+ }
+
+ /// <summary>
+ /// Tests the serialization.
+ /// </summary>
+ [Test]
+ public void TestSerialization()
+ {
+ var lock1 = new SessionStateLockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
+ var lock2 = TestUtils.SerializeDeserialize(lock1);
+
+ Assert.AreEqual(lock1, lock2);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/348e5d4b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index e582996..2e9a683 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -91,6 +91,7 @@
<Compile Include="Discovery\Tcp\Package-Info.cs" />
<Compile Include="Discovery\Tcp\Static\Package-Info.cs" />
<Compile Include="Impl\AspNet\SessionStateData.cs" />
+ <Compile Include="Impl\AspNet\SessionStateLockEntryResult.cs" />
<Compile Include="Impl\AspNet\SessionStateLockInfo.cs" />
<Compile Include="Impl\Binary\BinaryReflectiveSerializerInternal.cs" />
<Compile Include="Impl\Binary\IBinarySerializerInternal.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/348e5d4b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockEntryResult.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockEntryResult.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockEntryResult.cs
new file mode 100644
index 0000000..6aa2955
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockEntryResult.cs
@@ -0,0 +1,76 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.AspNet
+{
+ using System;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// Result of the session state lock processor.
+ /// </summary>
+ public class SessionStateLockEntryResult
+ {
+ /** Success flag. */
+ private readonly bool _success;
+
+ /** Session state data. */
+ private readonly SessionStateData _data;
+
+ /** Lock time. */
+ private readonly DateTime? _lockTime;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SessionStateLockEntryResult"/> class.
+ /// </summary>
+ /// <param name="reader">The reader.</param>
+ public SessionStateLockEntryResult(IBinaryRawReader reader)
+ {
+ _success = reader.ReadBoolean();
+ _data = reader.ReadObject<SessionStateData>();
+ _lockTime = reader.ReadTimestamp();
+
+ Debug.Assert(_success ^ (_data == null));
+ Debug.Assert(_success ^ (_lockTime != null));
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether lock succeeded.
+ /// </summary>
+ public bool Success
+ {
+ get { return _success; }
+ }
+
+ /// <summary>
+ /// Gets the data. Null when <see cref="Success"/> is <c>false</c>.
+ /// </summary>
+ public SessionStateData Data
+ {
+ get { return _data; }
+ }
+
+ /// <summary>
+ /// Gets the lock time. Null when <see cref="Success"/> is <c>true</c>.
+ /// </summary>
+ public DateTime? LockTime
+ {
+ get { return _lockTime; }
+ }
+ }
+}
[07/50] ignite git commit: wip
Posted by vo...@apache.org.
wip
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/31c586ae
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/31c586ae
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/31c586ae
Branch: refs/heads/ignite-3199-1
Commit: 31c586aed2f128023d8d1abe8da7733fb5770232
Parents: b8e9299
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 16:43:42 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 16:43:42 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryProcessor.java | 24 ++++++++++++--------
1 file changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/31c586ae/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 5a26aeb..0f0822b 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -29,9 +29,9 @@ import java.sql.Timestamp;
/**
* Entry processor that locks web session data.
*/
-public class LockEntryProcessor implements CacheEntryProcessor<String, SessionStateData, Object> {
+public class LockEntryProcessor implements CacheEntryProcessor<String, BinaryObject, Object> {
/** {@inheritDoc} */
- @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
+ @Override public Object process(MutableEntry<String, BinaryObject> entry, Object... objects)
throws EntryProcessorException {
// Arg contains lock info: node id + thread id
// Return result is either BinarizableSessionStateStoreData (when not locked) or lockAge (when locked)
@@ -39,25 +39,29 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
if (!entry.exists())
return null;
- SessionStateData data = entry.getValue();
+ BinaryObject data = entry.getValue();
assert data != null;
- if (data.getLockNodeId() != null) {
+ if (data.field("LockNodeId") != null) {
// Already locked: return lock time.
- assert data.getLockTime() != null;
+ Object lockTime = data.field("LockTime");
- return data.getLockTime();
+ assert lockTime != null;
+
+ return lockTime;
}
LockInfo lockInfo = (LockInfo)objects[0];
// Not locked: lock and return result
- data.setLockNodeId(lockInfo.getLockNodeId());
- data.setLockId(lockInfo.getLockId());
- data.setLockTime(lockInfo.getLockTime());
+ final BinaryObjectBuilder builder = data.toBuilder();
+
+ builder.setField("LockNodeId", lockInfo.getLockNodeId());
+ builder.setField("LockId", lockInfo.getLockId());
+ builder.setField("LockTime", lockInfo.getLockTime());
- entry.setValue(data);
+ entry.setValue(builder.build());
return data;
}
[49/50] ignite git commit: Minor adjustments.
Posted by vo...@apache.org.
Minor adjustments.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/38bcc34a
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/38bcc34a
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/38bcc34a
Branch: refs/heads/ignite-3199-1
Commit: 38bcc34a42ccf3ab18cddb4039e7cfd80dd98c5b
Parents: bd11c1e
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 8 17:28:58 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 8 17:28:58 2016 +0300
----------------------------------------------------------------------
.../platform/websession/SessionStateData.java | 52 +++++++++++++++-----
.../websession/SetAndUnlockEntryProcessor.java | 2 +-
.../websession/UnlockEntryProcessor.java | 2 +-
3 files changed, 43 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/38bcc34a/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 59c161c..6eb3caa 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
@@ -55,6 +55,27 @@ public class SessionStateData implements Binarylizable {
private Timestamp lockTime;
/**
+ * @return Items.
+ */
+ public KeyValueDirtyTrackedCollection items() {
+ return items;
+ }
+
+ /**
+ * @return Static objects.
+ */
+ public byte[] staticObjects() {
+ return staticObjects;
+ }
+
+ /**
+ * @return Timeout.
+ */
+ public int timeout() {
+ return timeout;
+ }
+
+ /**
* @return Lock ID.
*/
public long lockId() {
@@ -100,23 +121,32 @@ public class SessionStateData implements Binarylizable {
}
/**
- * Update session state and release the lock.
+ * Unlock session state data.
*
- * @param update Updated data.
- * @return Result.
+ * @return Unlocked data.
*/
- public SessionStateData updateAndUnlock(@Nullable SessionStateData update) {
+ public SessionStateData unlock() {
assert isLocked();
- SessionStateData res = copyWithoutLockInfo();
+ return copyWithoutLockInfo();
+ }
+
+ /**
+ * Update session state and release the lock.
+ *
+ * @param items Items.
+ * @param staticObjects Static objects.
+ * @param timeout Timeout.
+ * @return Result.
+ */
+ public SessionStateData updateAndUnlock(KeyValueDirtyTrackedCollection items, byte[] staticObjects, int timeout) {
+ assert items != null;
- if (update != null) {
- assert items != null;
+ SessionStateData res = unlock();
- res.timeout = update.timeout;
- res.staticObjects = update.staticObjects;
- res.items.applyChanges(update.items);
- }
+ res.items.applyChanges(items);
+ res.staticObjects = staticObjects;
+ res.timeout = timeout;
return res;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/38bcc34a/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
index 1efdb45..33e9d91 100644
--- 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
@@ -49,7 +49,7 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
- data = data.updateAndUnlock(newData);
+ data = data.updateAndUnlock(newData.items(), newData.staticObjects(), newData.timeout());
// Apply.
entry.setValue(data);
http://git-wip-us.apache.org/repos/asf/ignite/blob/38bcc34a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index a6d1ba1..a22c8a2 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -49,7 +49,7 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
- data = data.updateAndUnlock(null);
+ data = data.unlock();
entry.setValue(data);
[43/50] ignite git commit: cleanup
Posted by vo...@apache.org.
cleanup
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/17cc854d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/17cc854d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/17cc854d
Branch: refs/heads/ignite-3199-1
Commit: 17cc854da1a814bea10d8ca48782389994a1a5b9
Parents: 595dd2e
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 14:07:28 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 14:07:28 2016 +0300
----------------------------------------------------------------------
.../processors/platform/websession/LockEntryProcessor.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/17cc854d/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 751ed48..06f1035 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -33,11 +33,8 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
/** {@inheritDoc} */
@Override public Object process(MutableEntry<String, SessionStateData> entry, Object... args)
throws EntryProcessorException {
- // Arg contains lock info: node id + thread id
- // Return result is either BinarizableSessionStateStoreData (when not locked) or lockAge (when locked)
-
if (!entry.exists())
- return null; // TODO: ?
+ return null;
SessionStateData data = entry.getValue();
[17/50] ignite git commit: cleanup
Posted by vo...@apache.org.
cleanup
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/509c0208
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/509c0208
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/509c0208
Branch: refs/heads/ignite-3199-1
Commit: 509c0208b44ff8919705450b457ad9d9e1829dab
Parents: 2fa7a8a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 18:39:32 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 18:39:32 2016 +0300
----------------------------------------------------------------------
.../Impl/Collections/KeyValueDirtyTrackedCollection.cs | 1 -
1 file changed, 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/509c0208/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
index 64d2e6f..028a18d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
@@ -33,7 +33,6 @@ namespace Apache.Ignite.Core.Impl.Collections
/// </summary>
public class KeyValueDirtyTrackedCollection : IBinaryWriteAware
{
- // TODO: SortedDictionary??
/** */
private readonly Dictionary<string, int> _dict;
[25/50] ignite git commit: Merge remote-tracking branch
'remotes/upstream/master' into ignite-3199
Posted by vo...@apache.org.
Merge remote-tracking branch 'remotes/upstream/master' into ignite-3199
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/189aacb0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/189aacb0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/189aacb0
Branch: refs/heads/ignite-3199-1
Commit: 189aacb0b154dcea510303d327e01e990c6da0aa
Parents: 82a3908 b640b8e
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Sep 6 10:41:25 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Sep 6 10:41:25 2016 +0300
----------------------------------------------------------------------
.../store/jdbc/dialect/SQLServerDialect.java | 2 +-
.../cpp/odbc/include/ignite/odbc/connection.h | 7 -
modules/storm/README.txt | 2 +-
modules/storm/pom.xml | 2 +-
.../ignite/stream/storm/StormStreamer.java | 10 +-
.../storm/StormIgniteStreamerSelfTest.java | 20 +--
.../ignite/stream/storm/TestStormSpout.java | 10 +-
.../ignite/visor/commands/VisorConsole.scala | 1 +
.../commands/cache/VisorCacheCommand.scala | 33 ++++-
.../commands/cache/VisorCacheResetCommand.scala | 129 +++++++++++++++++++
.../cache/VisorCacheResetCommandSpec.scala | 114 ++++++++++++++++
11 files changed, 294 insertions(+), 36 deletions(-)
----------------------------------------------------------------------
[28/50] ignite git commit: LockInfoTest added
Posted by vo...@apache.org.
LockInfoTest added
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/51bbcda0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/51bbcda0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/51bbcda0
Branch: refs/heads/ignite-3199-1
Commit: 51bbcda0aa9ca7c6d03a9e4fa9ee7ce7ce8f6a91
Parents: bf27a90
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Sep 6 11:08:55 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Sep 6 11:08:55 2016 +0300
----------------------------------------------------------------------
.../Apache.Ignite.Core.Tests.csproj | 1 +
.../AspNet/LockInfoTest.cs | 64 ++++++++++++++++++++
2 files changed, 65 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/51bbcda0/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
index d74fdf4..3cb3ff2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/Apache.Ignite.Core.Tests.csproj
@@ -64,6 +64,7 @@
<Compile Include="AspNet\IgniteSessionStateItemCollectionTest.cs" />
<Compile Include="AspNet\IgniteSessionStateStoreDataTest.cs" />
<Compile Include="AspNet\IgniteSessionStateStoreProviderTest.cs" />
+ <Compile Include="AspNet\LockInfoTest.cs" />
<Compile Include="Binary\BinaryReaderWriterTest.cs" />
<Compile Include="Binary\IO\BinaryStreamsTest.cs" />
<Compile Include="Binary\JavaTypeMappingTest.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/51bbcda0/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
new file mode 100644
index 0000000..dada98d
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
@@ -0,0 +1,64 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Tests.AspNet
+{
+ using System;
+ using Apache.Ignite.Core.Impl.AspNet;
+ using NUnit.Framework;
+
+ /// <summary>
+ /// Tests for <see cref="LockInfo"/>.
+ /// </summary>
+ public class LockInfoTest
+ {
+ /// <summary>
+ /// Tests the equality.
+ /// </summary>
+ [Test]
+ public void TestEquality()
+ {
+ var lock1 = new LockInfo(1, Guid.NewGuid(), DateTime.UtcNow);
+ var lock2 = new LockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
+ var lock3 = new LockInfo(lock1.LockId, lock1.LockNodeId, lock1.LockTime);
+
+ Assert.AreEqual(lock1, lock3);
+ Assert.AreEqual(lock1.GetHashCode(), lock3.GetHashCode());
+
+ Assert.IsTrue(lock1 == lock3);
+ Assert.IsFalse(lock1 != lock3);
+
+ Assert.AreNotEqual(lock1, lock2);
+ Assert.AreNotEqual(lock1.GetHashCode(), lock2.GetHashCode());
+
+ Assert.IsFalse(lock1 == lock2);
+ Assert.IsTrue(lock1 != lock2);
+ }
+
+ /// <summary>
+ /// Tests the serialization.
+ /// </summary>
+ [Test]
+ public void TestSerialization()
+ {
+ var lock1 = new LockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
+ var lock2 = TestUtils.SerializeDeserialize(lock1);
+
+ Assert.AreEqual(lock1, lock2);
+ }
+ }
+}
[19/50] ignite git commit: Implement Keys property
Posted by vo...@apache.org.
Implement Keys property
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/3141a805
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/3141a805
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/3141a805
Branch: refs/heads/ignite-3199-1
Commit: 3141a805006c5b2a155e41a1cee8d113f63819a3
Parents: cce9a6a
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 18:54:25 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 18:54:25 2016 +0300
----------------------------------------------------------------------
.../Impl/IgniteSessionStateItemCollection.cs | 23 +++++++++++++-------
1 file changed, 15 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/3141a805/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
index 545121a..5f46248 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
@@ -119,14 +119,7 @@ namespace Apache.Ignite.AspNet.Impl
/** <inheritdoc /> */
public NameObjectCollectionBase.KeysCollection Keys
{
- get
- {
- // TODO: Inherit NameObjectCollectionBase in this class!
- // We should do everything possible to be pluggable.
-
- // KeysCollection ctor is internal, not possible to return it.
- throw new NotSupportedException("Use GetEnumerator instead to get all entries.");
- }
+ get { return new NameObjectCollection(this).Keys; }
}
/** <inheritdoc /> */
@@ -135,5 +128,19 @@ namespace Apache.Ignite.AspNet.Impl
get { return _collection.IsDirty; }
set { _collection.IsDirty = value; }
}
+
+ /// <summary>
+ /// NameObjectCollectionBase.KeysCollection has internal constructor.
+ /// The only way to implement ISessionStateItemCollection.Keys property
+ /// is to have a NameObjectCollectionBase in hand.
+ /// </summary>
+ private class NameObjectCollection : NameObjectCollectionBase
+ {
+ public NameObjectCollection(IgniteSessionStateItemCollection col)
+ {
+ foreach (string key in col)
+ BaseAdd(key, null);
+ }
+ }
}
}
\ No newline at end of file
[02/50] ignite git commit: wip
Posted by vo...@apache.org.
wip
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/be620f20
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/be620f20
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/be620f20
Branch: refs/heads/ignite-3199-1
Commit: be620f204607435f4cbb65f9f109450f2ca2bf59
Parents: 4c12e74
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 16:21:57 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 16:21:57 2016 +0300
----------------------------------------------------------------------
.../platform/cache/PlatformCache.java | 13 +++--
.../platform/websession/LockEntryProcessor.java | 4 +-
.../websession/ReleaseEntryProcessor.java | 25 ----------
.../websession/UnlockEntryProcessor.java | 51 ++++++++++++++++++++
4 files changed, 63 insertions(+), 30 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/be620f20/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 6eae5e0..4bf82e8 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -51,6 +51,7 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformWriterClosure;
import org.apache.ignite.internal.processors.platform.websession.LockEntryProcessor;
import org.apache.ignite.internal.processors.platform.websession.LockInfo;
+import org.apache.ignite.internal.processors.platform.websession.UnlockEntryProcessor;
import org.apache.ignite.internal.util.GridConcurrentFactory;
import org.apache.ignite.internal.util.future.IgniteFutureImpl;
import org.apache.ignite.internal.util.typedef.C1;
@@ -468,15 +469,21 @@ public class PlatformCache extends PlatformAbstractTarget {
Object key = args[0];
switch (opCode) {
- case OP_INVOKE_INTERNAL_SESSION_LOCK:
+ case OP_INVOKE_INTERNAL_SESSION_LOCK: {
LockInfo lockInfo = (LockInfo)args[1];
Object res = cache.invoke(key, new LockEntryProcessor(), lockInfo);
return writeResult(mem, res);
+ }
- case OP_INVOKE_INTERNAL_SESSION_UNLOCK:
- break;
+ case OP_INVOKE_INTERNAL_SESSION_UNLOCK: {
+ LockInfo lockInfo = (LockInfo)args[1];
+
+ cache.invoke(key, new UnlockEntryProcessor(), lockInfo);
+
+ return FALSE;
+ }
case OP_INVOKE_INTERNAL_SESSION_SET_AND_UNLOCK:
break;
http://git-wip-us.apache.org/repos/asf/ignite/blob/be620f20/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 9629f9d..5a26aeb 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -31,8 +31,8 @@ import java.sql.Timestamp;
*/
public class LockEntryProcessor implements CacheEntryProcessor<String, SessionStateData, Object> {
/** {@inheritDoc} */
- @Override public Object process(MutableEntry<String, SessionStateData> entry,
- Object... objects) throws EntryProcessorException {
+ @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
+ throws EntryProcessorException {
// Arg contains lock info: node id + thread id
// Return result is either BinarizableSessionStateStoreData (when not locked) or lockAge (when locked)
http://git-wip-us.apache.org/repos/asf/ignite/blob/be620f20/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/ReleaseEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/ReleaseEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/ReleaseEntryProcessor.java
deleted file mode 100644
index 9e767fa..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/ReleaseEntryProcessor.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.platform.websession;
-
-/**
- * Entry processor that releases web session data.
- */
-public class ReleaseEntryProcessor {
- // TODO
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/be620f20/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
new file mode 100644
index 0000000..12f42a3
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -0,0 +1,51 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.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 UnlockEntryProcessor 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;
+
+ LockInfo lockInfo = (LockInfo)objects[0];
+
+ assert data.getLockNodeId() == lockInfo.getLockNodeId();
+ assert data.getLockId() == lockInfo.getLockId();
+
+ // Unlock.
+ data.setLockNodeId(null);
+
+ entry.setValue(data);
+
+ return null;
+ }
+}
[05/50] ignite git commit: wip
Posted by vo...@apache.org.
wip
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/fdae22b0
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/fdae22b0
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/fdae22b0
Branch: refs/heads/ignite-3199-1
Commit: fdae22b01c6ef44f09a41a6e5417debe58e6ff92
Parents: ae4a4a1
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 16:37:18 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 16:37:18 2016 +0300
----------------------------------------------------------------------
.../internal/processors/platform/cache/PlatformCache.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/fdae22b0/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 4bf82e8..e4bf9ab 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -51,6 +51,8 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformWriterClosure;
import org.apache.ignite.internal.processors.platform.websession.LockEntryProcessor;
import org.apache.ignite.internal.processors.platform.websession.LockInfo;
+import org.apache.ignite.internal.processors.platform.websession.SessionStateData;
+import org.apache.ignite.internal.processors.platform.websession.SetAndUnlockEntryProcessor;
import org.apache.ignite.internal.processors.platform.websession.UnlockEntryProcessor;
import org.apache.ignite.internal.util.GridConcurrentFactory;
import org.apache.ignite.internal.util.future.IgniteFutureImpl;
@@ -486,7 +488,11 @@ public class PlatformCache extends PlatformAbstractTarget {
}
case OP_INVOKE_INTERNAL_SESSION_SET_AND_UNLOCK:
- break;
+ SessionStateData data = (SessionStateData)args[1];
+
+ cache.invoke(key, new SetAndUnlockEntryProcessor(), data);
+
+ return FALSE;
}
return writeResult(mem, null);
[09/50] ignite git commit: Fix binayr mode
Posted by vo...@apache.org.
Fix binayr mode
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5a503c7e
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5a503c7e
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5a503c7e
Branch: refs/heads/ignite-3199-1
Commit: 5a503c7e9c03f192896df6bcb39150d5a190b0fd
Parents: 8a44103
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 17:12:32 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 17:12:32 2016 +0300
----------------------------------------------------------------------
.../processors/platform/PlatformProcessorImpl.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5a503c7e/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
index e367768..0fefc33 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/PlatformProcessorImpl.java
@@ -211,7 +211,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
if (cache == null)
throw new IllegalArgumentException("Cache doesn't exist: " + name);
- return new PlatformCache(platformCtx, cache.keepBinary(), false);
+ return new PlatformCache(platformCtx, cache, false);
}
/** {@inheritDoc} */
@@ -220,7 +220,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
assert cache != null;
- return new PlatformCache(platformCtx, cache.keepBinary(), false);
+ return new PlatformCache(platformCtx, cache, false);
}
/** {@inheritDoc} */
@@ -229,7 +229,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
assert cache != null;
- return new PlatformCache(platformCtx, cache.keepBinary(), false);
+ return new PlatformCache(platformCtx, cache, false);
}
/** {@inheritDoc} */
@@ -241,7 +241,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
? (IgniteCacheProxy)ctx.grid().createCache(cfg, PlatformConfigurationUtils.readNearConfiguration(reader))
: (IgniteCacheProxy)ctx.grid().createCache(cfg);
- return new PlatformCache(platformCtx, cache.keepBinary(), false);
+ return new PlatformCache(platformCtx, cache, false);
}
/** {@inheritDoc} */
@@ -254,7 +254,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
PlatformConfigurationUtils.readNearConfiguration(reader))
: (IgniteCacheProxy)ctx.grid().getOrCreateCache(cfg);
- return new PlatformCache(platformCtx, cache.keepBinary(), false);
+ return new PlatformCache(platformCtx, cache, false);
}
/** {@inheritDoc} */
@@ -408,7 +408,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().createNearCache(cacheName, cfg);
- return new PlatformCache(platformCtx, cache.keepBinary(), false);
+ return new PlatformCache(platformCtx, cache, false);
}
/** {@inheritDoc} */
@@ -417,7 +417,7 @@ public class PlatformProcessorImpl extends GridProcessorAdapter implements Platf
IgniteCacheProxy cache = (IgniteCacheProxy)ctx.grid().getOrCreateNearCache(cacheName, cfg);
- return new PlatformCache(platformCtx, cache.keepBinary(), false);
+ return new PlatformCache(platformCtx, cache, false);
}
/** {@inheritDoc} */
[30/50] ignite git commit: Better lock info naming.
Posted by vo...@apache.org.
Better lock info naming.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7a90d553
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7a90d553
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7a90d553
Branch: refs/heads/ignite-3199-1
Commit: 7a90d5539f454891714d235947a49b6687c1bca7
Parents: ab4bf73
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 7 20:04:39 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 20:04:39 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryProcessor.java | 6 +--
.../platform/websession/LockInfo.java | 48 +++++++++++---------
.../websession/UnlockEntryProcessor.java | 4 +-
3 files changed, 32 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a90d553/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index ac5ca8a..a8591a4 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -55,9 +55,9 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
LockInfo lockInfo = (LockInfo)objects[0];
// Not locked: lock and return result
- data.setLockNodeId(lockInfo.getLockNodeId());
- data.setLockId(lockInfo.getLockId());
- data.setLockTime(lockInfo.getLockTime());
+ data.setLockNodeId(lockInfo.nodeId());
+ data.setLockId(lockInfo.id());
+ data.setLockTime(lockInfo.getTime());
// Apply.
entry.setValue(data);
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a90d553/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
index 6142b00..e71ae38 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
@@ -23,6 +23,7 @@ import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.util.typedef.internal.S;
import java.sql.Timestamp;
import java.util.UUID;
@@ -31,51 +32,56 @@ import java.util.UUID;
* Web session lock info.
*/
public class LockInfo implements Binarylizable {
- /** */
- private long lockId;
+ /** ID. */
+ private long id;
- /** */
- private UUID lockNodeId;
+ /** Node ID. */
+ private UUID nodeId;
- /** */
- private Timestamp lockTime;
+ /** Time. */
+ private Timestamp time;
/**
- * Gets the lock id.
+ * @return Lock ID.
*/
- public long getLockId() {
- return lockId;
+ public long id() {
+ return id;
}
/**
- * Gets the lock node id.
+ * @return Node ID.
*/
- public UUID getLockNodeId() {
- return lockNodeId;
+ public UUID nodeId() {
+ return nodeId;
}
/**
- * Gets the lock time.
+ * @return Time.
*/
- public Timestamp getLockTime() {
- return lockTime;
+ public Timestamp getTime() {
+ return time;
}
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
BinaryRawWriter raw = writer.rawWriter();
- raw.writeLong(lockId);
- raw.writeUuid(lockNodeId);
- raw.writeTimestamp(lockTime);
+ raw.writeLong(id);
+ raw.writeUuid(nodeId);
+ raw.writeTimestamp(time);
}
/** {@inheritDoc} */
@Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
BinaryRawReader raw = reader.rawReader();
- lockId = raw.readLong();
- lockNodeId = raw.readUuid();
- lockTime = raw.readTimestamp();
+ id = raw.readLong();
+ nodeId = raw.readUuid();
+ time = raw.readTimestamp();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(LockInfo.class, this);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/7a90d553/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index 640695d..5554026 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -41,10 +41,10 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
LockInfo lockInfo = (LockInfo)objects[0];
- if (!data.getLockNodeId().equals(lockInfo.getLockNodeId()))
+ if (!data.getLockNodeId().equals(lockInfo.nodeId()))
throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
- if (data.getLockId() != lockInfo.getLockId())
+ if (data.getLockId() != lockInfo.id())
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
[21/50] ignite git commit: Test fixed
Posted by vo...@apache.org.
Test fixed
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/c413cc10
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/c413cc10
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/c413cc10
Branch: refs/heads/ignite-3199-1
Commit: c413cc107ab8cb1d1d7b2e075ce99e13663197e9
Parents: 6221aed
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 18:58:22 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 18:58:22 2016 +0300
----------------------------------------------------------------------
.../AspNet/IgniteSessionStateItemCollectionTest.cs | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/c413cc10/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
index 40b67e0..eba95d4 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
@@ -40,10 +40,10 @@ namespace Apache.Ignite.Core.Tests.AspNet
Assert.IsFalse(col.Dirty);
Assert.IsFalse(col.IsSynchronized);
Assert.AreEqual(0, col.Count);
- Assert.Throws<NotSupportedException>(() => Assert.IsNull(col.Keys));
Assert.IsNotNull(col.SyncRoot);
Assert.IsEmpty(col);
Assert.IsEmpty(col.OfType<string>().ToArray());
+ Assert.IsEmpty(col.Keys);
col.Clear();
col.Remove("key");
@@ -75,7 +75,9 @@ namespace Apache.Ignite.Core.Tests.AspNet
Assert.AreEqual(2, col.Count);
Assert.IsTrue(col.Dirty);
- Assert.AreEqual(new[] {"key", "1"}, col.OfType<string>().ToArray());
+
+ CollectionAssert.AreEquivalent(new[] {"key", "1"}, col);
+ CollectionAssert.AreEquivalent(new[] {"key", "1"}, col.Keys);
// Modify using index.
col[0] = "val1";
[18/50] ignite git commit: Fix SerialUUID
Posted by vo...@apache.org.
Fix SerialUUID
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/cce9a6aa
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/cce9a6aa
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/cce9a6aa
Branch: refs/heads/ignite-3199-1
Commit: cce9a6aaa7bfc302a73880f2640c065768360884
Parents: 509c020
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 18:49:20 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 18:49:20 2016 +0300
----------------------------------------------------------------------
.../processors/platform/websession/LockEntryProcessor.java | 3 +++
.../platform/websession/SetAndUnlockEntryProcessor.java | 3 +++
.../processors/platform/websession/UnlockEntryProcessor.java | 3 +++
3 files changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/cce9a6aa/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 4f01cb6..ac5ca8a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -27,6 +27,9 @@ import java.sql.Timestamp;
* Entry processor that locks web session data.
*/
public class LockEntryProcessor implements CacheEntryProcessor<String, SessionStateData, Object> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
/** {@inheritDoc} */
@Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
throws EntryProcessorException {
http://git-wip-us.apache.org/repos/asf/ignite/blob/cce9a6aa/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
index 7ad2fc7..1d6bfa2 100644
--- 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
@@ -26,6 +26,9 @@ import javax.cache.processor.MutableEntry;
* Entry processor that unlocks web session data.
*/
public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, SessionStateData, Object> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
/** {@inheritDoc} */
@Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
throws EntryProcessorException {
http://git-wip-us.apache.org/repos/asf/ignite/blob/cce9a6aa/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index 79b9c3b..640695d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -26,6 +26,9 @@ import javax.cache.processor.MutableEntry;
* Entry processor that unlocks web session data.
*/
public class UnlockEntryProcessor implements CacheEntryProcessor<String, SessionStateData, Object> {
+ /** */
+ private static final long serialVersionUID = 0L;
+
/** {@inheritDoc} */
@Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
throws EntryProcessorException {
[36/50] ignite git commit: Rename LockInfo
Posted by vo...@apache.org.
Rename LockInfo
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/70fa4e99
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/70fa4e99
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/70fa4e99
Branch: refs/heads/ignite-3199-1
Commit: 70fa4e996ba9ba61c1643fd7229494fdd9ba8100
Parents: 52d8e62
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 12:35:16 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 12:35:16 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 4 +-
.../platform/cache/PlatformCache.java | 6 +-
.../platform/websession/LockEntryProcessor.java | 2 +-
.../platform/websession/SessionStateData.java | 2 +-
.../websession/UnlockEntryProcessor.java | 2 +-
.../IgniteSessionStateStoreProvider.cs | 4 +-
.../AspNet/LockInfoTest.cs | 10 +-
.../Apache.Ignite.Core.csproj | 2 +-
.../Apache.Ignite.Core/Impl/AspNet/LockInfo.cs | 166 -------------------
.../Impl/AspNet/SessionStateLockInfo.cs | 166 +++++++++++++++++++
.../Impl/Binary/Marshaller.cs | 2 +-
11 files changed, 183 insertions(+), 183 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index ffd9699..49f1867 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -77,7 +77,7 @@ import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdatePropertiesP
import org.apache.ignite.internal.processors.igfs.meta.IgfsMetaUpdateTimesProcessor;
import org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryProxy;
import org.apache.ignite.internal.processors.platform.websession.KeyValueDirtyTrackedCollection;
-import org.apache.ignite.internal.processors.platform.websession.LockInfo;
+import org.apache.ignite.internal.processors.platform.websession.SessionStateLockInfo;
import org.apache.ignite.internal.processors.platform.websession.SessionStateData;
import org.apache.ignite.internal.util.lang.GridMapEntry;
import org.apache.ignite.internal.util.typedef.F;
@@ -322,7 +322,7 @@ public class BinaryContext {
registerPredefinedType(BinaryEnumObjectImpl.class, 0);
registerPredefinedType(SessionStateData.class, 0);
- registerPredefinedType(LockInfo.class, 0);
+ registerPredefinedType(SessionStateLockInfo.class, 0);
registerPredefinedType(KeyValueDirtyTrackedCollection.class, 0);
// IDs range [200..1000] is used by Ignite internal APIs.
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index 93c2436..f45f458 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -50,7 +50,7 @@ import org.apache.ignite.internal.processors.platform.utils.PlatformListenable;
import org.apache.ignite.internal.processors.platform.utils.PlatformUtils;
import org.apache.ignite.internal.processors.platform.utils.PlatformWriterClosure;
import org.apache.ignite.internal.processors.platform.websession.LockEntryProcessor;
-import org.apache.ignite.internal.processors.platform.websession.LockInfo;
+import org.apache.ignite.internal.processors.platform.websession.SessionStateLockInfo;
import org.apache.ignite.internal.processors.platform.websession.SessionStateData;
import org.apache.ignite.internal.processors.platform.websession.SetAndUnlockEntryProcessor;
import org.apache.ignite.internal.processors.platform.websession.UnlockEntryProcessor;
@@ -477,7 +477,7 @@ public class PlatformCache extends PlatformAbstractTarget {
switch (opCode) {
case OP_INVOKE_INTERNAL_SESSION_LOCK: {
- LockInfo lockInfo = (LockInfo)args[1];
+ SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[1];
Object res = cacheRaw.invoke(key, new LockEntryProcessor(), lockInfo);
@@ -485,7 +485,7 @@ public class PlatformCache extends PlatformAbstractTarget {
}
case OP_INVOKE_INTERNAL_SESSION_UNLOCK: {
- LockInfo lockInfo = (LockInfo)args[1];
+ SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[1];
cacheRaw.invoke(key, new UnlockEntryProcessor(), lockInfo);
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 72aa183..ff5107a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -46,7 +46,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
if (data.isLocked())
return data.lockTime();
- LockInfo lockInfo = (LockInfo)args[0];
+ SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[0];
// Not locked: lock and return result
data.lock(lockInfo);
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/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 2c4a62f..5ccdada 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
@@ -86,7 +86,7 @@ public class SessionStateData implements Binarylizable {
*
* @param lock Lock.
*/
- public void lock(LockInfo lock) {
+ public void lock(SessionStateLockInfo lock) {
assert !isLocked();
lockId = lock.id();
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index 1075958..655b314 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -40,7 +40,7 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
assert data != null;
assert data.lockNodeId() != null;
- LockInfo lockInfo = (LockInfo)args[0];
+ SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[0];
if (!data.lockNodeId().equals(lockInfo.nodeId()))
throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
index 2aa4e70..fdbd528 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
@@ -398,9 +398,9 @@ namespace Apache.Ignite.AspNet
/// <summary>
/// Gets the lock info.
/// </summary>
- private LockInfo GetLockInfo(long lockId)
+ private SessionStateLockInfo GetLockInfo(long lockId)
{
- return new LockInfo(lockId, Cache.Ignite.GetCluster().GetLocalNode().Id, DateTime.UtcNow);
+ return new SessionStateLockInfo(lockId, Cache.Ignite.GetCluster().GetLocalNode().Id, DateTime.UtcNow);
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
index dada98d..a65109f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/LockInfoTest.cs
@@ -22,7 +22,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
using NUnit.Framework;
/// <summary>
- /// Tests for <see cref="LockInfo"/>.
+ /// Tests for <see cref="SessionStateLockInfo"/>.
/// </summary>
public class LockInfoTest
{
@@ -32,9 +32,9 @@ namespace Apache.Ignite.Core.Tests.AspNet
[Test]
public void TestEquality()
{
- var lock1 = new LockInfo(1, Guid.NewGuid(), DateTime.UtcNow);
- var lock2 = new LockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
- var lock3 = new LockInfo(lock1.LockId, lock1.LockNodeId, lock1.LockTime);
+ var lock1 = new SessionStateLockInfo(1, Guid.NewGuid(), DateTime.UtcNow);
+ var lock2 = new SessionStateLockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
+ var lock3 = new SessionStateLockInfo(lock1.LockId, lock1.LockNodeId, lock1.LockTime);
Assert.AreEqual(lock1, lock3);
Assert.AreEqual(lock1.GetHashCode(), lock3.GetHashCode());
@@ -55,7 +55,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
[Test]
public void TestSerialization()
{
- var lock1 = new LockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
+ var lock1 = new SessionStateLockInfo(2, Guid.NewGuid(), DateTime.UtcNow.AddDays(1));
var lock2 = TestUtils.SerializeDeserialize(lock1);
Assert.AreEqual(lock1, lock2);
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 547ca55..e582996 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -91,7 +91,7 @@
<Compile Include="Discovery\Tcp\Package-Info.cs" />
<Compile Include="Discovery\Tcp\Static\Package-Info.cs" />
<Compile Include="Impl\AspNet\SessionStateData.cs" />
- <Compile Include="Impl\AspNet\LockInfo.cs" />
+ <Compile Include="Impl\AspNet\SessionStateLockInfo.cs" />
<Compile Include="Impl\Binary\BinaryReflectiveSerializerInternal.cs" />
<Compile Include="Impl\Binary\IBinarySerializerInternal.cs" />
<Compile Include="Binary\Package-Info.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/LockInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/LockInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/LockInfo.cs
deleted file mode 100644
index 9ac7806..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/LockInfo.cs
+++ /dev/null
@@ -1,166 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.AspNet
-{
- using System;
- using System.Diagnostics;
- using Apache.Ignite.Core.Binary;
- using Apache.Ignite.Core.Impl.Binary;
-
- /// <summary>
- /// Lock info.
- /// </summary>
- public struct LockInfo : IBinaryWriteAware, IEquatable<LockInfo>
- {
- /** */
- private readonly long _lockId;
-
- /** */
- private readonly Guid _lockNodeId;
-
- /** */
- private readonly DateTime _lockTime;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LockInfo"/> struct.
- /// </summary>
- /// <param name="lockId">The lock identifier.</param>
- /// <param name="lockNodeId">The lock node identifier.</param>
- /// <param name="lockTime">The lock time.</param>
- public LockInfo(long lockId, Guid lockNodeId, DateTime lockTime)
- {
- _lockId = lockId;
- _lockNodeId = lockNodeId;
- _lockTime = lockTime;
- }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="LockInfo"/> struct.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public LockInfo(IBinaryRawReader reader)
- {
- _lockId = reader.ReadLong();
-
- var guid = reader.ReadGuid();
- Debug.Assert(guid != null);
- _lockNodeId = guid.Value;
-
- var time = reader.ReadTimestamp();
- Debug.Assert(time != null);
- _lockTime = time.Value;
- }
-
- /// <summary>
- /// Gets or sets the lock node id. Null means not locked.
- /// </summary>
- public Guid LockNodeId
- {
- get { return _lockNodeId; }
- }
-
- /// <summary>
- /// Gets or sets the lock id.
- /// </summary>
- public long LockId
- {
- get { return _lockId; }
- }
-
- /// <summary>
- /// Gets or sets the lock time.
- /// </summary>
- public DateTime LockTime
- {
- get { return _lockTime; }
- }
-
- /// <summary>
- /// Writes this object to the given writer.
- /// </summary>
- /// <param name="writer">Writer.</param>
- public void WriteBinary(IBinaryWriter writer)
- {
- var raw = writer.GetRawWriter();
-
- raw.WriteLong(_lockId);
- raw.WriteGuid(_lockNodeId);
- raw.WriteTimestamp(_lockTime);
- }
-
- /// <summary>
- /// Indicates whether the current object is equal to another object of the same type.
- /// </summary>
- /// <param name="other">An object to compare with this object.</param>
- /// <returns>
- /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
- /// </returns>
- public bool Equals(LockInfo other)
- {
- return _lockTime.Equals(other._lockTime) && _lockId == other._lockId
- && _lockNodeId.Equals(other._lockNodeId);
- }
-
- /// <summary>
- /// Determines whether the specified <see cref="object" />, is equal to this instance.
- /// </summary>
- /// <param name="obj">The <see cref="object" /> to compare with this instance.</param>
- /// <returns>
- /// <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.
- /// </returns>
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- return obj is LockInfo && Equals((LockInfo) obj);
- }
-
- /// <summary>
- /// Returns a hash code for this instance.
- /// </summary>
- /// <returns>
- /// A hash code for this instance, suitable for use in hashing algorithms
- /// and data structures like a hash table.
- /// </returns>
- public override int GetHashCode()
- {
- unchecked
- {
- var hashCode = _lockTime.GetHashCode();
- hashCode = (hashCode*397) ^ _lockId.GetHashCode();
- hashCode = (hashCode*397) ^ _lockNodeId.GetHashCode();
- return hashCode;
- }
- }
-
- /// <summary>
- /// Implements the operator ==.
- /// </summary>
- public static bool operator ==(LockInfo left, LockInfo right)
- {
- return left.Equals(right);
- }
-
- /// <summary>
- /// Implements the operator !=.
- /// </summary>
- public static bool operator !=(LockInfo left, LockInfo right)
- {
- return !left.Equals(right);
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockInfo.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockInfo.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockInfo.cs
new file mode 100644
index 0000000..194c0db
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockInfo.cs
@@ -0,0 +1,166 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.AspNet
+{
+ using System;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
+
+ /// <summary>
+ /// Lock info.
+ /// </summary>
+ public struct SessionStateLockInfo : IBinaryWriteAware, IEquatable<SessionStateLockInfo>
+ {
+ /** */
+ private readonly long _lockId;
+
+ /** */
+ private readonly Guid _lockNodeId;
+
+ /** */
+ private readonly DateTime _lockTime;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SessionStateLockInfo"/> struct.
+ /// </summary>
+ /// <param name="lockId">The lock identifier.</param>
+ /// <param name="lockNodeId">The lock node identifier.</param>
+ /// <param name="lockTime">The lock time.</param>
+ public SessionStateLockInfo(long lockId, Guid lockNodeId, DateTime lockTime)
+ {
+ _lockId = lockId;
+ _lockNodeId = lockNodeId;
+ _lockTime = lockTime;
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SessionStateLockInfo"/> struct.
+ /// </summary>
+ /// <param name="reader">The reader.</param>
+ public SessionStateLockInfo(IBinaryRawReader reader)
+ {
+ _lockId = reader.ReadLong();
+
+ var guid = reader.ReadGuid();
+ Debug.Assert(guid != null);
+ _lockNodeId = guid.Value;
+
+ var time = reader.ReadTimestamp();
+ Debug.Assert(time != null);
+ _lockTime = time.Value;
+ }
+
+ /// <summary>
+ /// Gets or sets the lock node id. Null means not locked.
+ /// </summary>
+ public Guid LockNodeId
+ {
+ get { return _lockNodeId; }
+ }
+
+ /// <summary>
+ /// Gets or sets the lock id.
+ /// </summary>
+ public long LockId
+ {
+ get { return _lockId; }
+ }
+
+ /// <summary>
+ /// Gets or sets the lock time.
+ /// </summary>
+ public DateTime LockTime
+ {
+ get { return _lockTime; }
+ }
+
+ /// <summary>
+ /// Writes this object to the given writer.
+ /// </summary>
+ /// <param name="writer">Writer.</param>
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ var raw = writer.GetRawWriter();
+
+ raw.WriteLong(_lockId);
+ raw.WriteGuid(_lockNodeId);
+ raw.WriteTimestamp(_lockTime);
+ }
+
+ /// <summary>
+ /// Indicates whether the current object is equal to another object of the same type.
+ /// </summary>
+ /// <param name="other">An object to compare with this object.</param>
+ /// <returns>
+ /// true if the current object is equal to the <paramref name="other" /> parameter; otherwise, false.
+ /// </returns>
+ public bool Equals(SessionStateLockInfo other)
+ {
+ return _lockTime.Equals(other._lockTime) && _lockId == other._lockId
+ && _lockNodeId.Equals(other._lockNodeId);
+ }
+
+ /// <summary>
+ /// Determines whether the specified <see cref="object" />, is equal to this instance.
+ /// </summary>
+ /// <param name="obj">The <see cref="object" /> to compare with this instance.</param>
+ /// <returns>
+ /// <c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.
+ /// </returns>
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ return obj is SessionStateLockInfo && Equals((SessionStateLockInfo) obj);
+ }
+
+ /// <summary>
+ /// Returns a hash code for this instance.
+ /// </summary>
+ /// <returns>
+ /// A hash code for this instance, suitable for use in hashing algorithms
+ /// and data structures like a hash table.
+ /// </returns>
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ var hashCode = _lockTime.GetHashCode();
+ hashCode = (hashCode*397) ^ _lockId.GetHashCode();
+ hashCode = (hashCode*397) ^ _lockNodeId.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ /// <summary>
+ /// Implements the operator ==.
+ /// </summary>
+ public static bool operator ==(SessionStateLockInfo left, SessionStateLockInfo right)
+ {
+ return left.Equals(right);
+ }
+
+ /// <summary>
+ /// Implements the operator !=.
+ /// </summary>
+ public static bool operator !=(SessionStateLockInfo left, SessionStateLockInfo right)
+ {
+ return !left.Equals(right);
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/70fa4e99/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index 03a65a1..e7b345e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -598,7 +598,7 @@ namespace Apache.Ignite.Core.Impl.Binary
AddSystemType(0, r => new ObjectInfoHolder(r));
AddSystemType(0, r => new KeyValueDirtyTrackedCollection(r));
AddSystemType(0, r => new SessionStateData(r));
- AddSystemType(0, r => new LockInfo(r));
+ AddSystemType(0, r => new SessionStateLockInfo(r));
}
}
}
[37/50] ignite git commit: Simpligfy KeyValueDirtyTrackedCollection
Posted by vo...@apache.org.
Simpligfy KeyValueDirtyTrackedCollection
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5c947bcb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5c947bcb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5c947bcb
Branch: refs/heads/ignite-3199-1
Commit: 5c947bcb195d0e7af065bbd29f1b5beba5aab1c3
Parents: 70fa4e9
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 13:01:24 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 13:01:24 2016 +0300
----------------------------------------------------------------------
.../KeyValueDirtyTrackedCollection.java | 38 +++++-------
.../KeyValueDirtyTrackedCollection.cs | 61 +++++++++-----------
2 files changed, 41 insertions(+), 58 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c947bcb/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 058e146..2a89164 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
@@ -25,8 +25,6 @@ import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.util.typedef.internal.S;
-import java.util.ArrayList;
-import java.util.List;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;
@@ -38,8 +36,8 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
/** Entry order is important. */
private SortedMap<String, byte[]> entries;
- /** */
- private List<String> removedKeys;
+ /** Whether this is a diff. */
+ private boolean isDiff;
/**
* Apply changes from another instance.
@@ -49,26 +47,27 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
public void applyChanges(KeyValueDirtyTrackedCollection other) {
assert other != null;
- if (other.removedKeys != null) {
- for (String key : other.removedKeys)
- entries.remove(key);
- }
- else {
+ if (!other.isDiff) {
// Not a diff: remove all
entries.clear();
}
- for (Map.Entry<String, byte[]> e : other.entries.entrySet())
- entries.put(e.getKey(), e.getValue());
+ for (Map.Entry<String, byte[]> e : other.entries.entrySet()) {
+ String key = e.getKey();
+ byte[] value = e.getValue();
+
+ if (value != null)
+ entries.put(key, value);
+ else
+ entries.remove(key); // Null value indicates removed key.
+ }
}
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
- assert removedKeys == null; // Can't write diff.
-
BinaryRawWriter raw = writer.rawWriter();
- raw.writeBoolean(true); // Always full mode.
+ raw.writeBoolean(!isDiff);
raw.writeInt(entries.size());
@@ -82,7 +81,7 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
@Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
BinaryRawReader raw = reader.rawReader();
- boolean isDiff = !raw.readBoolean();
+ isDiff = !raw.readBoolean();
int count = raw.readInt();
@@ -90,15 +89,6 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
for (int i = 0; i < count; i++)
entries.put(raw.readString(), raw.readByteArray());
-
- if (isDiff) {
- count = raw.readInt();
-
- removedKeys = new ArrayList<>(count);
-
- for (int i = 0; i < count; i++)
- removedKeys.add(raw.readString());
- }
}
/** {@inheritDoc} */
http://git-wip-us.apache.org/repos/asf/ignite/blob/5c947bcb/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
index 028a18d..13548a8 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
@@ -70,25 +70,18 @@ namespace Apache.Ignite.Core.Impl.Collections
{
var key = reader.ReadString();
- var entry = new Entry(key, true, reader.Marshaller, reader.ReadByteArray());
+ var valBytes = reader.ReadByteArray();
- _dict[key] = _list.Count;
-
- _list.Add(entry);
- }
-
- if (_isDiff)
- {
- // Read removed keys.
- count = reader.ReadInt();
-
- if (count > 0)
+ if (valBytes != null)
{
- _removedKeys = new HashSet<string>();
+ var entry = new Entry(key, true, reader.Marshaller, valBytes);
- for (var i = 0; i < count; i++)
- _removedKeys.Add(reader.ReadString());
+ _dict[key] = _list.Count;
+
+ _list.Add(entry);
}
+ else
+ AddRemovedKey(key);
}
_isNew = false;
@@ -221,6 +214,24 @@ namespace Apache.Ignite.Core.Impl.Collections
raw.WriteInt(count); // reserve count
+ // Write removed keys as [key + null].
+ if (_removedKeys != null)
+ {
+ // Filter out existing keys.
+ var removed = new HashSet<string>(_removedKeys);
+
+ foreach (var entry in _list)
+ removed.Remove(entry.Key);
+
+ foreach (var removedKey in removed)
+ {
+ raw.WriteString(removedKey);
+ raw.WriteByteArray(null);
+
+ count++;
+ }
+ }
+
// Write dirty items.
foreach (var entry in _list)
{
@@ -235,31 +246,13 @@ namespace Apache.Ignite.Core.Impl.Collections
count++;
}
- // Write dirty item count.
+ // Write item count.
var pos = stream.Position;
stream.Seek(countPos, SeekOrigin.Begin);
stream.WriteInt(count);
stream.Seek(pos, SeekOrigin.Begin);
- // Write removed keys.
- if (_removedKeys != null)
- {
- // Filter out existing keys.
- var removed = new HashSet<string>(_removedKeys);
-
- foreach (var entry in _list)
- removed.Remove(entry.Key);
-
- raw.WriteInt(removed.Count);
-
- foreach (var removedKey in removed)
- raw.WriteString(removedKey);
- }
- else
- {
- raw.WriteInt(0);
- }
}
}
[50/50] ignite git commit: Unlock processor prototype.
Posted by vo...@apache.org.
Unlock processor prototype.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8359c220
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8359c220
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8359c220
Branch: refs/heads/ignite-3199-1
Commit: 8359c220f6143d60e5791e80c0fce0ee2c991e90
Parents: 38bcc34
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 8 17:45:11 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 8 17:45:11 2016 +0300
----------------------------------------------------------------------
...tformDotnetSessionSetAndUnlockProcessor.java | 134 +++++++++++++++++++
.../platform/websession/SessionStateData.java | 17 ++-
2 files changed, 148 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8359c220/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionSetAndUnlockProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionSetAndUnlockProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionSetAndUnlockProcessor.java
new file mode 100644
index 0000000..5f16bee
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/PlatformDotnetSessionSetAndUnlockProcessor.java
@@ -0,0 +1,134 @@
+/*
+ * 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.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import javax.cache.processor.EntryProcessorException;
+import javax.cache.processor.MutableEntry;
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * Processor to unlock and optionally update the session.
+ */
+public class PlatformDotnetSessionSetAndUnlockProcessor implements
+ CacheEntryProcessor<String, SessionStateData, Void>, Binarylizable {
+ /** Lock node ID. */
+ private UUID lockNodeId;
+
+ /** Lock ID. */
+ private long lockId;
+
+ /** Update flag. */
+ private boolean update;
+
+ /** Data. */
+ private Map<String, byte[]> items;
+
+ /** Static data. */
+ private byte[] staticData;
+
+ /** Timeout. */
+ private int timeout;
+
+ /**
+ * Constructor.
+ *
+ * @param lockNodeId Lock node ID.
+ * @param lockId Lock ID.
+ */
+ public PlatformDotnetSessionSetAndUnlockProcessor(UUID lockNodeId, long lockId) {
+ this(lockNodeId, lockId, false, null, null, -1);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param lockNodeId Lock node ID.
+ * @param lockId Lock ID.
+ * @param items Items.
+ * @param staticData Static data.
+ * @param timeout Timeout.
+ */
+ public PlatformDotnetSessionSetAndUnlockProcessor(UUID lockNodeId, long lockId,
+ Map<String, byte[]> items, byte[] staticData, int timeout) {
+ this(lockNodeId, lockId, true, items, staticData, timeout);
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param lockNodeId Lock node ID.
+ * @param lockId Lock ID.
+ * @param update Whether to perform update.
+ * @param items Items.
+ * @param staticData Static data.
+ * @param timeout Timeout.
+ */
+ public PlatformDotnetSessionSetAndUnlockProcessor(UUID lockNodeId, long lockId, boolean update,
+ Map<String, byte[]> items, byte[] staticData, int timeout) {
+ this.lockNodeId = lockNodeId;
+ this.lockId = lockId;
+ this.update = update;
+ this.items = items;
+ this.staticData = staticData;
+ this.timeout = timeout;
+ }
+
+ /** {@inheritDoc} */
+ @Override public Void process(MutableEntry<String, SessionStateData> entry, Object... args)
+ throws EntryProcessorException {
+ assert entry.exists();
+
+ SessionStateData data = entry.getValue();
+
+ assert data != null;
+
+ // Unlock and update.
+ if (update)
+ data = data.updateAndUnlock(lockNodeId, lockId, items, staticData, timeout);
+ else
+ data = data.unlock(lockNodeId, lockId);
+
+ // Apply.
+ entry.setValue(data);
+
+ return null;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ // TODO
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ // TODO
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(PlatformDotnetSessionSetAndUnlockProcessor.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/8359c220/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 6eb3caa..ac81314 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
@@ -123,26 +123,37 @@ public class SessionStateData implements Binarylizable {
/**
* Unlock session state data.
*
+ * @param lockNodeId Lock node ID.
+ * @param lockId Lock ID.
* @return Unlocked data.
*/
- public SessionStateData unlock() {
+ public SessionStateData unlock(UUID lockNodeId, long lockId) {
assert isLocked();
+ if (!this.lockNodeId.equals(lockNodeId))
+ throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
+
+ if (this.lockId != lockId)
+ throw new IllegalStateException("Can not unlock session data: lock id check failed.");
+
return copyWithoutLockInfo();
}
/**
* Update session state and release the lock.
*
+ * @param lockNodeId Lock node ID.
+ * @param lockId Lock ID.
* @param items Items.
* @param staticObjects Static objects.
* @param timeout Timeout.
* @return Result.
*/
- public SessionStateData updateAndUnlock(KeyValueDirtyTrackedCollection items, byte[] staticObjects, int timeout) {
+ public SessionStateData updateAndUnlock(UUID lockNodeId, long lockId, KeyValueDirtyTrackedCollection items,
+ byte[] staticObjects, int timeout) {
assert items != null;
- SessionStateData res = unlock();
+ SessionStateData res = unlock(lockNodeId, lockId);
res.items.applyChanges(items);
res.staticObjects = staticObjects;
[33/50] ignite git commit: Mnors.
Posted by vo...@apache.org.
Mnors.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/eb08a67c
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/eb08a67c
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/eb08a67c
Branch: refs/heads/ignite-3199-1
Commit: eb08a67cdaa572843ca124e55891bf6a5e000618
Parents: 9807ee3
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 7 20:30:38 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 20:30:38 2016 +0300
----------------------------------------------------------------------
.../KeyValueDirtyTrackedCollection.java | 44 +++++++++++---------
.../platform/websession/SessionStateData.java | 28 ++++++-------
2 files changed, 39 insertions(+), 33 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb08a67c/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 581dbb3..058e146 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
@@ -23,6 +23,7 @@ import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.util.typedef.internal.S;
import java.util.ArrayList;
import java.util.List;
@@ -40,6 +41,27 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
/** */
private List<String> removedKeys;
+ /**
+ * Apply changes from another instance.
+ *
+ * @param other Items.
+ */
+ public void applyChanges(KeyValueDirtyTrackedCollection other) {
+ assert other != null;
+
+ if (other.removedKeys != null) {
+ for (String key : other.removedKeys)
+ entries.remove(key);
+ }
+ else {
+ // Not a diff: remove all
+ entries.clear();
+ }
+
+ for (Map.Entry<String, byte[]> e : other.entries.entrySet())
+ entries.put(e.getKey(), e.getValue());
+ }
+
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
assert removedKeys == null; // Can't write diff.
@@ -79,24 +101,8 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
}
}
- /**
- * Apply changes from another instance.
- *
- * @param other Items.
- */
- public void applyChanges(KeyValueDirtyTrackedCollection other) {
- assert other != null;
-
- if (other.removedKeys != null) {
- for (String key : other.removedKeys)
- entries.remove(key);
- }
- else {
- // Not a diff: remove all
- entries.clear();
- }
-
- for (Map.Entry<String, byte[]> e : other.entries.entrySet())
- entries.put(e.getKey(), e.getValue());
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(KeyValueDirtyTrackedCollection.class, this);
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/eb08a67c/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 e850706..08a02e3 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
@@ -105,6 +105,20 @@ public class SessionStateData implements Binarylizable {
lockTime = null;
}
+ /**
+ * Apply changes from another instance.
+ *
+ * @param other Data.
+ */
+ public void applyChanges(SessionStateData other) {
+ assert other != null;
+ assert items != null;
+
+ timeout = other.timeout;
+ staticObjects = other.staticObjects;
+ items.applyChanges(other.items);
+ }
+
/** {@inheritDoc} */
@Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
BinaryRawWriter raw = writer.rawWriter();
@@ -129,20 +143,6 @@ public class SessionStateData implements Binarylizable {
staticObjects = raw.readByteArray();
}
- /**
- * Apply changes from another instance.
- *
- * @param other Data.
- */
- public void applyChanges(SessionStateData other) {
- assert other != null;
- assert items != null;
-
- timeout = other.timeout;
- staticObjects = other.staticObjects;
- items.applyChanges(other.items);
- }
-
/** {@inheritDoc} */
@Override public String toString() {
return S.toString(SessionStateData.class, this);
[15/50] ignite git commit: cleanup
Posted by vo...@apache.org.
cleanup
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/98da016d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/98da016d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/98da016d
Branch: refs/heads/ignite-3199-1
Commit: 98da016de33560e25c6df7ca8f5d8c8bb858f559
Parents: 4d76769
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 18:29:27 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 18:29:27 2016 +0300
----------------------------------------------------------------------
.../IgniteSessionStateStoreProvider.cs | 112 -------------------
1 file changed, 112 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/98da016d/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
index 8c95f07..5c13c29 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
@@ -454,117 +454,5 @@ namespace Apache.Ignite.AspNet
((ICacheInternal) cache).Invoke<object>((int) Op.SetAndUnlock, key, data);
}
-
- /*
- // TODO: Implement this in Java.
- [Serializable]
- private class LockEntryProcessor :
- ICacheEntryProcessor<string, SessionStateData, LockInfo, object>
- {
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
- public object Process(IMutableCacheEntry<string, SessionStateData> entry, LockInfo arg)
- {
- // Arg contains lock info: node id + thread id
- // Return result is either BinarizableSessionStateStoreData (when not locked) or lockAge (when locked)
- // or null (when not exists)
-
- if (!entry.Exists)
- return null;
-
- var data = entry.Value;
-
- Debug.Assert(data != null);
-
- if (data.LockNodeId != null)
- {
- // Already locked: return lock time.
- Debug.Assert(data.LockTime != null);
-
- return data.LockTime;
- }
-
- // Not locked: lock and return result
- data.LockNodeId = arg.LockNodeId;
- data.LockId = arg.LockId;
- data.LockTime = arg.LockTime;
-
- entry.Value = data;
-
- return data;
- }
- }
-
- [Serializable]
- private class ReleaseLockEntryProcessor : ICacheEntryProcessor<string, SessionStateData, LockInfo, object>
- {
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
- public object Process(IMutableCacheEntry<string, SessionStateData> entry, LockInfo arg)
- {
- var val = entry.Value;
-
- if (val != null)
- {
- if (val.LockNodeId == null)
- throw new InvalidOperationException("LockNodeId is null.");
-
- if (val.LockNodeId != arg.LockNodeId)
- throw new InvalidOperationException("Invalid lock node id TODO");
-
- if (val.LockId != arg.LockId)
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
- "Invalid lock id: expected {0} but was {1}", arg.LockId, val.LockId));
-
- val.LockNodeId = null;
-
- entry.Value = val;
- }
- else
- {
- Debug.Fail("");
- }
-
- return null;
- }
- }
-
- [Serializable]
- private class SetAndReleaseLockEntryProcessor :
- ICacheEntryProcessor<string, SessionStateData, SessionStateData, object>
- {
- [SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods")]
- public object Process(IMutableCacheEntry<string, SessionStateData> entry, SessionStateData arg)
- {
- var val = entry.Value;
-
- if (val != null)
- {
- if (val.LockNodeId == null)
- throw new InvalidOperationException("LockNodeId is null.");
-
- if (val.LockNodeId != arg.LockNodeId)
- throw new InvalidOperationException("Invalid lock node id TODO");
-
- if (val.LockId != arg.LockId)
- throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture,
- "Invalid lock id: expected {0} but was {1}", arg.LockId, val.LockId));
-
- // Release lock.
- val.LockNodeId = null;
-
- // Update values.
- val.Items.ApplyChanges(arg.Items);
- val.StaticObjects = arg.StaticObjects;
- val.Timeout = arg.Timeout;
-
- // Apply.
- entry.Value = val;
- }
- else
- Debug.Fail("");
-
- return null;
- }
- }*/
-
}
}
\ No newline at end of file
[42/50] ignite git commit: Fix SessionStateLockResult registration
Posted by vo...@apache.org.
Fix SessionStateLockResult registration
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/595dd2ef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/595dd2ef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/595dd2ef
Branch: refs/heads/ignite-3199-1
Commit: 595dd2ef1483a8639767188b0f8bbcac8e2e2b8a
Parents: ddae6ac
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 14:05:05 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 14:05:05 2016 +0300
----------------------------------------------------------------------
.../org/apache/ignite/internal/binary/BinaryContext.java | 2 ++
.../Impl/AspNet/SessionStateLockResult.cs | 11 ++++++++++-
.../dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/595dd2ef/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
index 49f1867..4e7fb7e 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/binary/BinaryContext.java
@@ -79,6 +79,7 @@ import org.apache.ignite.internal.processors.platform.PlatformJavaObjectFactoryP
import org.apache.ignite.internal.processors.platform.websession.KeyValueDirtyTrackedCollection;
import org.apache.ignite.internal.processors.platform.websession.SessionStateLockInfo;
import org.apache.ignite.internal.processors.platform.websession.SessionStateData;
+import org.apache.ignite.internal.processors.platform.websession.SessionStateLockResult;
import org.apache.ignite.internal.util.lang.GridMapEntry;
import org.apache.ignite.internal.util.typedef.F;
import org.apache.ignite.internal.util.typedef.T2;
@@ -323,6 +324,7 @@ public class BinaryContext {
registerPredefinedType(SessionStateData.class, 0);
registerPredefinedType(SessionStateLockInfo.class, 0);
+ registerPredefinedType(SessionStateLockResult.class, 0);
registerPredefinedType(KeyValueDirtyTrackedCollection.class, 0);
// IDs range [200..1000] is used by Ignite internal APIs.
http://git-wip-us.apache.org/repos/asf/ignite/blob/595dd2ef/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs
index 4bf483c..bab66f5 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs
@@ -20,11 +20,12 @@ namespace Apache.Ignite.Core.Impl.AspNet
using System;
using System.Diagnostics;
using Apache.Ignite.Core.Binary;
+ using Apache.Ignite.Core.Impl.Binary;
/// <summary>
/// Result of the session state lock processor.
/// </summary>
- public class SessionStateLockResult
+ public class SessionStateLockResult : IBinaryWriteAware
{
/** Success flag. */
private readonly bool _success;
@@ -80,5 +81,13 @@ namespace Apache.Ignite.Core.Impl.AspNet
{
return string.Format("{0} [Success={1}]", GetType().Name, _success);
}
+
+ /// <summary>
+ /// Writes this object to the given writer.
+ /// </summary>
+ public void WriteBinary(IBinaryWriter writer)
+ {
+ throw new NotSupportedException(GetType() + " is only written from native code.");
+ }
}
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/595dd2ef/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
index e7b345e..03dbe2f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Binary/Marshaller.cs
@@ -599,6 +599,7 @@ namespace Apache.Ignite.Core.Impl.Binary
AddSystemType(0, r => new KeyValueDirtyTrackedCollection(r));
AddSystemType(0, r => new SessionStateData(r));
AddSystemType(0, r => new SessionStateLockInfo(r));
+ AddSystemType(0, r => new SessionStateLockResult(r));
}
}
}
[47/50] ignite git commit: cleanup
Posted by vo...@apache.org.
cleanup
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/7b488379
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/7b488379
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/7b488379
Branch: refs/heads/ignite-3199-1
Commit: 7b48837982ab6bf2df31f4a83a313fe060fbdec9
Parents: ae7b1b2
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 14:53:51 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 14:53:51 2016 +0300
----------------------------------------------------------------------
.../internal/processors/platform/cache/PlatformCacheInvoker.java | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/7b488379/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java
index 64d1a8b..8586770 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCacheInvoker.java
@@ -78,6 +78,7 @@ public class PlatformCacheInvoker {
break;
}
+
return res;
}
}
[48/50] ignite git commit: Minor adjustments.
Posted by vo...@apache.org.
Minor adjustments.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bd11c1e7
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bd11c1e7
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bd11c1e7
Branch: refs/heads/ignite-3199-1
Commit: bd11c1e7d37eafff5185d3fb32c83fb1a3466255
Parents: 7b48837
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Thu Sep 8 16:58:57 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Thu Sep 8 16:58:57 2016 +0300
----------------------------------------------------------------------
.../platform/websession/SessionStateData.java | 51 +++++++++++---------
.../websession/SetAndUnlockEntryProcessor.java | 5 +-
.../websession/UnlockEntryProcessor.java | 2 +-
3 files changed, 29 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd11c1e7/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 4586c49..59c161c 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
@@ -25,6 +25,7 @@ import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
import org.apache.ignite.internal.util.tostring.GridToStringExclude;
import org.apache.ignite.internal.util.typedef.internal.S;
+import org.jetbrains.annotations.Nullable;
import java.sql.Timestamp;
import java.util.UUID;
@@ -89,7 +90,7 @@ public class SessionStateData implements Binarylizable {
public SessionStateData lock(SessionStateLockInfo lock) {
assert !isLocked();
- SessionStateData res = getCopy();
+ SessionStateData res = copyWithoutLockInfo();
res.lockId = lock.id();
res.lockNodeId = lock.nodeId();
@@ -99,26 +100,40 @@ public class SessionStateData implements Binarylizable {
}
/**
- * Clear lock info.
+ * Update session state and release the lock.
+ *
+ * @param update Updated data.
+ * @return Result.
*/
- public SessionStateData unlock() {
+ public SessionStateData updateAndUnlock(@Nullable SessionStateData update) {
assert isLocked();
- return getCopy();
+ SessionStateData res = copyWithoutLockInfo();
+
+ if (update != null) {
+ assert items != null;
+
+ res.timeout = update.timeout;
+ res.staticObjects = update.staticObjects;
+ res.items.applyChanges(update.items);
+ }
+
+ return res;
}
/**
- * Apply changes from another instance.
+ * Gets a copy of this instance with non-lock properties set.
*
- * @param other Data.
+ * @return Copied state data.
*/
- public void applyChanges(SessionStateData other) {
- assert other != null;
- assert items != null;
+ private SessionStateData copyWithoutLockInfo() {
+ SessionStateData res = new SessionStateData();
+
+ res.staticObjects = staticObjects;
+ res.items = items;
+ res.timeout = timeout;
- timeout = other.timeout;
- staticObjects = other.staticObjects;
- items.applyChanges(other.items);
+ return res;
}
/** {@inheritDoc} */
@@ -149,16 +164,4 @@ public class SessionStateData implements Binarylizable {
@Override public String toString() {
return S.toString(SessionStateData.class, this);
}
-
- /**
- * Gets a copy of this instance with non-lock properties set.
- */
- private SessionStateData getCopy() {
- SessionStateData res = new SessionStateData();
-
- res.staticObjects = staticObjects;
- res.items = items;
- res.timeout = timeout;
- return res;
- }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd11c1e7/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
index 62d05cb..1efdb45 100644
--- 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
@@ -49,10 +49,7 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
- data = data.unlock();
-
- // Update values.
- data.applyChanges(newData);
+ data = data.updateAndUnlock(newData);
// Apply.
entry.setValue(data);
http://git-wip-us.apache.org/repos/asf/ignite/blob/bd11c1e7/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index a22c8a2..a6d1ba1 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -49,7 +49,7 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
- data = data.unlock();
+ data = data.updateAndUnlock(null);
entry.setValue(data);
[31/50] ignite git commit: Better invariants in SessionStateData.
Posted by vo...@apache.org.
Better invariants in SessionStateData.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/5543901d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/5543901d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/5543901d
Branch: refs/heads/ignite-3199-1
Commit: 5543901d26f1ed82cf0e465f57852b98f11b98bd
Parents: 7a90d55
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 7 20:14:25 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 20:14:25 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryProcessor.java | 15 +---
.../platform/websession/LockInfo.java | 2 +-
.../platform/websession/SessionStateData.java | 80 ++++++++++++--------
.../websession/SetAndUnlockEntryProcessor.java | 8 +-
.../websession/UnlockEntryProcessor.java | 8 +-
5 files changed, 60 insertions(+), 53 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/5543901d/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index a8591a4..03ae929 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -21,7 +21,6 @@ import org.apache.ignite.cache.CacheEntryProcessor;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.MutableEntry;
-import java.sql.Timestamp;
/**
* Entry processor that locks web session data.
@@ -43,21 +42,13 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
assert data != null;
- if (data.getLockNodeId() != null) {
- // Already locked: return lock time.
- Timestamp lockTime = data.getLockTime();
-
- assert lockTime != null;
-
- return lockTime;
- }
+ if (data.locked())
+ return data.lockTime();
LockInfo lockInfo = (LockInfo)objects[0];
// Not locked: lock and return result
- data.setLockNodeId(lockInfo.nodeId());
- data.setLockId(lockInfo.id());
- data.setLockTime(lockInfo.getTime());
+ data.lock(lockInfo);
// Apply.
entry.setValue(data);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5543901d/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
index e71ae38..28bca3a 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockInfo.java
@@ -58,7 +58,7 @@ public class LockInfo implements Binarylizable {
/**
* @return Time.
*/
- public Timestamp getTime() {
+ public Timestamp time() {
return time;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5543901d/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 6ef7c59..e850706 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
@@ -23,6 +23,8 @@ import org.apache.ignite.binary.BinaryRawWriter;
import org.apache.ignite.binary.BinaryReader;
import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.util.tostring.GridToStringExclude;
+import org.apache.ignite.internal.util.typedef.internal.S;
import java.sql.Timestamp;
import java.util.UUID;
@@ -32,66 +34,75 @@ import java.util.UUID;
*/
@SuppressWarnings({"ReturnOfDateField", "AssignmentToDateFieldFromParameter"})
public class SessionStateData implements Binarylizable {
- /** */
- private int timeout;
+ /** Items. */
+ private KeyValueDirtyTrackedCollection items;
- /** */
- private UUID lockNodeId;
+ /** Static objects. */
+ @GridToStringExclude
+ private byte[] staticObjects;
- /** */
- private long lockId;
+ /** Timeout. */
+ private int timeout;
- /** */
- private Timestamp lockTime;
+ /** Lock ID. */
+ private long lockId;
- /** */
- private KeyValueDirtyTrackedCollection items;
+ /** Lock node ID. */
+ private UUID lockNodeId;
- /** */
- private byte[] staticObjects;
+ /** Lock time. */
+ private Timestamp lockTime;
/**
- * Gets the lock node id.
+ * @return Lock ID.
*/
- public UUID getLockNodeId() {
- return lockNodeId;
+ public long lockId() {
+ return lockId;
}
/**
- * Sets the lock node id.
- *
+ * @return Lock node ID.
*/
- public void setLockNodeId(UUID lockNodeId) {
- this.lockNodeId = lockNodeId;
+ public UUID lockNodeId() {
+ return lockNodeId;
}
/**
- * Gets the lock id.
- *
+ * @return Lock time.
*/
- public long getLockId() {
- return lockId;
+ public Timestamp lockTime() {
+ return lockTime;
}
/**
- * Sets the lock id.
+ * @return {@code True} if locked.
*/
- public void setLockId(long lockId) {
- this.lockId = lockId;
+ public boolean locked() {
+ return lockTime == null;
}
/**
- * Gets the lock time.
+ * Set lock info.
+ *
+ * @param lock Lock.
*/
- public Timestamp getLockTime() {
- return lockTime;
+ public void lock(LockInfo lock) {
+ assert !locked();
+
+ lockId = lock.id();
+ lockNodeId = lock.nodeId();
+ lockTime = lock.time();
}
/**
- * Sets the lock time.
+ * Clear lock info.
*/
- public void setLockTime(Timestamp lockTime) {
- this.lockTime = lockTime;
+ public void unlock() {
+ assert locked();
+
+ lockId = 0;
+ lockNodeId = null;
+ lockTime = null;
}
/** {@inheritDoc} */
@@ -131,4 +142,9 @@ public class SessionStateData implements Binarylizable {
staticObjects = other.staticObjects;
items.applyChanges(other.items);
}
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SessionStateData.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/5543901d/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
index c973256..6ac8ed1 100644
--- 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
@@ -37,18 +37,18 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
SessionStateData data = entry.getValue();
assert data != null;
- assert data.getLockNodeId() != null;
+ assert data.lockNodeId() != null;
SessionStateData newData = (SessionStateData)objects[0];
- if (!data.getLockNodeId().equals(newData.getLockNodeId()))
+ if (!data.lockNodeId().equals(newData.lockNodeId()))
throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
- if (data.getLockId() != newData.getLockId())
+ if (data.lockId() != newData.lockId())
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
- data.setLockNodeId(null);
+ data.unlock();
// Update values.
data.applyChanges(newData);
http://git-wip-us.apache.org/repos/asf/ignite/blob/5543901d/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index 5554026..f6aa798 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -37,18 +37,18 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
SessionStateData data = entry.getValue();
assert data != null;
- assert data.getLockNodeId() != null;
+ assert data.lockNodeId() != null;
LockInfo lockInfo = (LockInfo)objects[0];
- if (!data.getLockNodeId().equals(lockInfo.nodeId()))
+ if (!data.lockNodeId().equals(lockInfo.nodeId()))
throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
- if (data.getLockId() != lockInfo.id())
+ if (data.lockId() != lockInfo.id())
throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
- data.setLockNodeId(null);
+ data.unlock();
entry.setValue(data);
[16/50] ignite git commit: cleanup
Posted by vo...@apache.org.
cleanup
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/2fa7a8af
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/2fa7a8af
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/2fa7a8af
Branch: refs/heads/ignite-3199-1
Commit: 2fa7a8afb93ada6c3fad767edccbe795913fa87f
Parents: 98da016
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 18:34:58 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 18:34:58 2016 +0300
----------------------------------------------------------------------
.../platform/websession/SessionStateData.java | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/2fa7a8af/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 bd37d75..4837966 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
@@ -30,7 +30,7 @@ import java.util.UUID;
/**
* Web session state data.
*/
-public class SessionStateData implements Binarylizable {
+@SuppressWarnings({"ReturnOfDateField", "AssignmentToDateFieldFromParameter"}) public class SessionStateData implements Binarylizable {
/** */
private int timeout;
@@ -56,22 +56,39 @@ public class SessionStateData implements Binarylizable {
return lockNodeId;
}
+ /**
+ * Sets the lock node id.
+ *
+ */
public void setLockNodeId(UUID lockNodeId) {
this.lockNodeId = lockNodeId;
}
+ /**
+ * Gets the lock id.
+ *
+ */
public long getLockId() {
return lockId;
}
+ /**
+ * Sets the lock id.
+ */
public void setLockId(long lockId) {
this.lockId = lockId;
}
+ /**
+ * Gets the lock time.
+ */
public Timestamp getLockTime() {
return lockTime;
}
+ /**
+ * Sets the lock time.
+ */
public void setLockTime(Timestamp lockTime) {
this.lockTime = lockTime;
}
[11/50] ignite git commit: wip
Posted by vo...@apache.org.
wip
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6cfe66f5
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6cfe66f5
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6cfe66f5
Branch: refs/heads/ignite-3199-1
Commit: 6cfe66f561d50b3b1c2470ac1c267e8e772546ca
Parents: 4208f93e
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 17:44:56 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 17:44:56 2016 +0300
----------------------------------------------------------------------
.../processors/platform/websession/SetAndUnlockEntryProcessor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/6cfe66f5/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
index 23ac0e1..7ad2fc7 100644
--- 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
@@ -38,7 +38,7 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
SessionStateData newData = (SessionStateData)objects[0];
- assert data.getLockNodeId() == newData.getLockNodeId();
+ assert data.getLockNodeId().equals(newData.getLockNodeId());
assert data.getLockId() == newData.getLockId();
// Unlock.
[29/50] ignite git commit: Merge branch 'ignite-3199' of
https://github.com/ptupitsyn/ignite into ignite-3199
Posted by vo...@apache.org.
Merge branch 'ignite-3199' of https://github.com/ptupitsyn/ignite into ignite-3199
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ab4bf738
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ab4bf738
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ab4bf738
Branch: refs/heads/ignite-3199-1
Commit: ab4bf7383617fd8d29d3cf1941f687624829428a
Parents: 31b9bb8 51bbcda
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 7 19:26:30 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 19:26:30 2016 +0300
----------------------------------------------------------------------
.../ignite/internal/binary/BinaryContext.java | 7 +
.../platform/PlatformProcessorImpl.java | 14 +-
.../platform/cache/PlatformCache.java | 70 ++-
.../KeyValueDirtyTrackedCollection.java | 102 ++++
.../platform/websession/LockEntryProcessor.java | 67 +++
.../platform/websession/LockInfo.java | 81 +++
.../platform/websession/SessionStateData.java | 134 +++++
.../websession/SetAndUnlockEntryProcessor.java | 61 +++
.../websession/UnlockEntryProcessor.java | 57 ++
.../Apache.Ignite.AspNet.csproj | 5 +
.../Apache.Ignite.AspNet.ruleset | 3 +
.../IgniteOutputCacheProvider.cs | 120 +----
.../IgniteSessionStateStoreProvider.cs | 460 +++++++++++++++++
.../Apache.Ignite.AspNet/Impl/ConfigUtil.cs | 101 ++++
.../Impl/ExpiryCacheHolder.cs | 113 ++++
.../Impl/IgniteSessionStateItemCollection.cs | 148 ++++++
.../Impl/IgniteSessionStateStoreData.cs | 126 +++++
.../Properties/AssemblyInfo.cs | 5 +-
.../Apache.Ignite.Core.Tests.csproj | 7 +
.../BinarizableSessionStateStoreDataTest.cs | 73 +++
.../AspNet/ExpiryCacheHolderTest.cs | 491 ++++++++++++++++++
.../IgniteSessionStateItemCollectionTest.cs | 138 +++++
.../AspNet/IgniteSessionStateStoreDataTest.cs | 58 +++
.../IgniteSessionStateStoreProviderTest.cs | 484 +++++++++++++++++
.../AspNet/LockInfoTest.cs | 64 +++
.../KeyValueDirtyTrackedCollectionTest.cs | 238 +++++++++
.../Apache.Ignite.Core.Tests/TestUtils.cs | 12 +
.../dotnet/Apache.Ignite.Core.Tests/app.config | 15 +
.../Apache.Ignite.Core.csproj | 3 +
.../Apache.Ignite.Core/Impl/AspNet/LockInfo.cs | 166 ++++++
.../Impl/AspNet/SessionStateData.cs | 105 ++++
.../Impl/Binary/Marshaller.cs | 5 +
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 11 +
.../Apache.Ignite.Core/Impl/Cache/CacheOp.cs | 3 +-
.../Impl/Cache/ICacheInternal.cs | 11 +
.../KeyValueDirtyTrackedCollection.cs | 516 +++++++++++++++++++
36 files changed, 3950 insertions(+), 124 deletions(-)
----------------------------------------------------------------------
[41/50] ignite git commit: Return LockEntryResult from
LockEntryProcessor
Posted by vo...@apache.org.
Return LockEntryResult from LockEntryProcessor
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ddae6acd
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ddae6acd
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ddae6acd
Branch: refs/heads/ignite-3199-1
Commit: ddae6acdecced9717fad6c84479d87f9b65b61c7
Parents: 348e5d4
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 13:54:52 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 13:54:52 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryProcessor.java | 6 +-
.../websession/SessionStateLockEntryResult.java | 100 -------------------
.../websession/SessionStateLockResult.java | 100 +++++++++++++++++++
.../IgniteSessionStateStoreProvider.cs | 14 +--
.../Apache.Ignite.Core.csproj | 2 +-
.../Impl/AspNet/SessionStateLockEntryResult.cs | 76 --------------
.../Impl/AspNet/SessionStateLockResult.cs | 84 ++++++++++++++++
7 files changed, 195 insertions(+), 187 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/ddae6acd/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index ea53271..751ed48 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -37,14 +37,14 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
// Return result is either BinarizableSessionStateStoreData (when not locked) or lockAge (when locked)
if (!entry.exists())
- return null;
+ return null; // TODO: ?
SessionStateData data = entry.getValue();
assert data != null;
if (data.isLocked())
- return new SessionStateLockEntryResult(false, null, data.lockTime());
+ return new SessionStateLockResult(false, null, data.lockTime());
SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[0];
@@ -54,7 +54,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
// Apply.
entry.setValue(data);
- return new SessionStateLockEntryResult(true, data, null);
+ return new SessionStateLockResult(true, data, null);
}
/** {@inheritDoc */
http://git-wip-us.apache.org/repos/asf/ignite/blob/ddae6acd/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockEntryResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockEntryResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockEntryResult.java
deleted file mode 100644
index 28e0a6b..0000000
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockEntryResult.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.ignite.internal.processors.platform.websession;
-
-import org.apache.ignite.binary.BinaryObjectException;
-import org.apache.ignite.binary.BinaryRawReader;
-import org.apache.ignite.binary.BinaryRawWriter;
-import org.apache.ignite.binary.BinaryReader;
-import org.apache.ignite.binary.BinaryWriter;
-import org.apache.ignite.binary.Binarylizable;
-import org.apache.ignite.internal.util.typedef.internal.S;
-
-import java.sql.Timestamp;
-
-/**
- * Result of the {@link LockEntryProcessor} execution.
- */
-@SuppressWarnings({"AssignmentToDateFieldFromParameter", "ReturnOfDateField"})
-public class SessionStateLockEntryResult implements Binarylizable {
- /** Success flag. */
- private boolean success;
-
- /** Data. */
- private SessionStateData data;
-
- /** Lock time. */
- private Timestamp lockTime;
-
- /**
- * Ctor.
- *
- * @param success Success flag.
- * @param data Session data.
- * @param lockTime Lock time.
- */
- public SessionStateLockEntryResult(boolean success, SessionStateData data, Timestamp lockTime) {
- this.success = success;
- this.data = data;
- this.lockTime = lockTime;
- }
-
- /**
- * @return Success flag.
- */
- public boolean success() {
- return success;
- }
-
- /**
- * @return Session state data.
- */
- public SessionStateData data() {
- return data;
- }
-
- /**
- * @return Lock time.
- */
- public Timestamp lockTime() {
- return lockTime;
- }
-
- /** {@inheritDoc} */
- @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
- BinaryRawWriter raw = writer.rawWriter();
-
- raw.writeBoolean(success);
- raw.writeObject(data);
- raw.writeTimestamp(lockTime);
- }
-
- /** {@inheritDoc} */
- @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
- BinaryRawReader raw = reader.rawReader();
-
- success = raw.readBoolean();
- data = raw.readObject();
- lockTime = raw.readTimestamp();
- }
-
- /** {@inheritDoc} */
- @Override public String toString() {
- return S.toString(SessionStateLockEntryResult.class, this);
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ddae6acd/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockResult.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockResult.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockResult.java
new file mode 100644
index 0000000..7b531b4
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/SessionStateLockResult.java
@@ -0,0 +1,100 @@
+/*
+ * 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.binary.BinaryObjectException;
+import org.apache.ignite.binary.BinaryRawReader;
+import org.apache.ignite.binary.BinaryRawWriter;
+import org.apache.ignite.binary.BinaryReader;
+import org.apache.ignite.binary.BinaryWriter;
+import org.apache.ignite.binary.Binarylizable;
+import org.apache.ignite.internal.util.typedef.internal.S;
+
+import java.sql.Timestamp;
+
+/**
+ * Result of the {@link LockEntryProcessor} execution.
+ */
+@SuppressWarnings({"AssignmentToDateFieldFromParameter", "ReturnOfDateField"})
+public class SessionStateLockResult implements Binarylizable {
+ /** Success flag. */
+ private boolean success;
+
+ /** Data. */
+ private SessionStateData data;
+
+ /** Lock time. */
+ private Timestamp lockTime;
+
+ /**
+ * Ctor.
+ *
+ * @param success Success flag.
+ * @param data Session data.
+ * @param lockTime Lock time.
+ */
+ public SessionStateLockResult(boolean success, SessionStateData data, Timestamp lockTime) {
+ this.success = success;
+ this.data = data;
+ this.lockTime = lockTime;
+ }
+
+ /**
+ * @return Success flag.
+ */
+ public boolean success() {
+ return success;
+ }
+
+ /**
+ * @return Session state data.
+ */
+ public SessionStateData data() {
+ return data;
+ }
+
+ /**
+ * @return Lock time.
+ */
+ public Timestamp lockTime() {
+ return lockTime;
+ }
+
+ /** {@inheritDoc} */
+ @Override public void writeBinary(BinaryWriter writer) throws BinaryObjectException {
+ BinaryRawWriter raw = writer.rawWriter();
+
+ raw.writeBoolean(success);
+ raw.writeObject(data);
+ raw.writeTimestamp(lockTime);
+ }
+
+ /** {@inheritDoc} */
+ @Override public void readBinary(BinaryReader reader) throws BinaryObjectException {
+ BinaryRawReader raw = reader.rawReader();
+
+ success = raw.readBoolean();
+ data = raw.readObject();
+ lockTime = raw.readTimestamp();
+ }
+
+ /** {@inheritDoc} */
+ @Override public String toString() {
+ return S.toString(SessionStateLockResult.class, this);
+ }
+}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ddae6acd/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
index fdbd528..2408f75 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
@@ -238,16 +238,16 @@ namespace Apache.Ignite.AspNet
return null;
}
- var data = lockResult as SessionStateData;
-
- if (data == null)
+ if (!lockResult.Success)
{
// Already locked.
Log("GetItemExclusive already locked", id, context);
locked = true;
- lockAge = DateTime.UtcNow - (DateTime)lockResult;
+ Debug.Assert(lockResult.LockTime != null);
+
+ lockAge = DateTime.UtcNow - lockResult.LockTime.Value;
return null;
}
@@ -256,7 +256,7 @@ namespace Apache.Ignite.AspNet
locked = false;
- return new IgniteSessionStateStoreData(data);
+ return new IgniteSessionStateStoreData(lockResult.Data);
}
/// <summary>
@@ -432,9 +432,9 @@ namespace Apache.Ignite.AspNet
/// <summary>
/// Locks the item.
/// </summary>
- private object LockItem(string key, long lockId)
+ private SessionStateLockResult LockItem(string key, long lockId)
{
- return ((ICacheInternal) Cache).Invoke<object>((int) Op.Lock, key, GetLockInfo(lockId));
+ return ((ICacheInternal) Cache).Invoke<SessionStateLockResult>((int) Op.Lock, key, GetLockInfo(lockId));
}
/// <summary>
http://git-wip-us.apache.org/repos/asf/ignite/blob/ddae6acd/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
index 2e9a683..f546c21 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Apache.Ignite.Core.csproj
@@ -91,7 +91,7 @@
<Compile Include="Discovery\Tcp\Package-Info.cs" />
<Compile Include="Discovery\Tcp\Static\Package-Info.cs" />
<Compile Include="Impl\AspNet\SessionStateData.cs" />
- <Compile Include="Impl\AspNet\SessionStateLockEntryResult.cs" />
+ <Compile Include="Impl\AspNet\SessionStateLockResult.cs" />
<Compile Include="Impl\AspNet\SessionStateLockInfo.cs" />
<Compile Include="Impl\Binary\BinaryReflectiveSerializerInternal.cs" />
<Compile Include="Impl\Binary\IBinarySerializerInternal.cs" />
http://git-wip-us.apache.org/repos/asf/ignite/blob/ddae6acd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockEntryResult.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockEntryResult.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockEntryResult.cs
deleted file mode 100644
index 6aa2955..0000000
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockEntryResult.cs
+++ /dev/null
@@ -1,76 +0,0 @@
-\ufeff/*
- * 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.
- */
-
-namespace Apache.Ignite.Core.Impl.AspNet
-{
- using System;
- using System.Diagnostics;
- using Apache.Ignite.Core.Binary;
-
- /// <summary>
- /// Result of the session state lock processor.
- /// </summary>
- public class SessionStateLockEntryResult
- {
- /** Success flag. */
- private readonly bool _success;
-
- /** Session state data. */
- private readonly SessionStateData _data;
-
- /** Lock time. */
- private readonly DateTime? _lockTime;
-
- /// <summary>
- /// Initializes a new instance of the <see cref="SessionStateLockEntryResult"/> class.
- /// </summary>
- /// <param name="reader">The reader.</param>
- public SessionStateLockEntryResult(IBinaryRawReader reader)
- {
- _success = reader.ReadBoolean();
- _data = reader.ReadObject<SessionStateData>();
- _lockTime = reader.ReadTimestamp();
-
- Debug.Assert(_success ^ (_data == null));
- Debug.Assert(_success ^ (_lockTime != null));
- }
-
- /// <summary>
- /// Gets a value indicating whether lock succeeded.
- /// </summary>
- public bool Success
- {
- get { return _success; }
- }
-
- /// <summary>
- /// Gets the data. Null when <see cref="Success"/> is <c>false</c>.
- /// </summary>
- public SessionStateData Data
- {
- get { return _data; }
- }
-
- /// <summary>
- /// Gets the lock time. Null when <see cref="Success"/> is <c>true</c>.
- /// </summary>
- public DateTime? LockTime
- {
- get { return _lockTime; }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/ignite/blob/ddae6acd/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs
new file mode 100644
index 0000000..4bf483c
--- /dev/null
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/AspNet/SessionStateLockResult.cs
@@ -0,0 +1,84 @@
+\ufeff/*
+ * 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.
+ */
+
+namespace Apache.Ignite.Core.Impl.AspNet
+{
+ using System;
+ using System.Diagnostics;
+ using Apache.Ignite.Core.Binary;
+
+ /// <summary>
+ /// Result of the session state lock processor.
+ /// </summary>
+ public class SessionStateLockResult
+ {
+ /** Success flag. */
+ private readonly bool _success;
+
+ /** Session state data. */
+ private readonly SessionStateData _data;
+
+ /** Lock time. */
+ private readonly DateTime? _lockTime;
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="SessionStateLockResult"/> class.
+ /// </summary>
+ /// <param name="reader">The reader.</param>
+ public SessionStateLockResult(IBinaryRawReader reader)
+ {
+ _success = reader.ReadBoolean();
+ _data = reader.ReadObject<SessionStateData>();
+ _lockTime = reader.ReadTimestamp();
+
+ Debug.Assert(_success ^ (_data == null));
+ Debug.Assert(_success ^ (_lockTime != null));
+ }
+
+ /// <summary>
+ /// Gets a value indicating whether lock succeeded.
+ /// </summary>
+ public bool Success
+ {
+ get { return _success; }
+ }
+
+ /// <summary>
+ /// Gets the data. Null when <see cref="Success"/> is <c>false</c>.
+ /// </summary>
+ public SessionStateData Data
+ {
+ get { return _data; }
+ }
+
+ /// <summary>
+ /// Gets the lock time. Null when <see cref="Success"/> is <c>true</c>.
+ /// </summary>
+ public DateTime? LockTime
+ {
+ get { return _lockTime; }
+ }
+
+ /// <summary>
+ /// Returns a <see cref="string" /> that represents this instance.
+ /// </summary>
+ public override string ToString()
+ {
+ return string.Format("{0} [Success={1}]", GetType().Name, _success);
+ }
+ }
+}
[27/50] ignite git commit: cleanup
Posted by vo...@apache.org.
cleanup
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/bf27a906
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/bf27a906
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/bf27a906
Branch: refs/heads/ignite-3199-1
Commit: bf27a9069d8f92c5345ce9866b9db9c0939991e8
Parents: 88640dd
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Sep 6 11:00:47 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Sep 6 11:00:47 2016 +0300
----------------------------------------------------------------------
.../processors/platform/websession/SessionStateData.java | 3 ++-
.../platform/websession/SetAndUnlockEntryProcessor.java | 7 +++++--
2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/bf27a906/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 4837966..6ef7c59 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
@@ -30,7 +30,8 @@ import java.util.UUID;
/**
* Web session state data.
*/
-@SuppressWarnings({"ReturnOfDateField", "AssignmentToDateFieldFromParameter"}) public class SessionStateData implements Binarylizable {
+@SuppressWarnings({"ReturnOfDateField", "AssignmentToDateFieldFromParameter"})
+public class SessionStateData implements Binarylizable {
/** */
private int timeout;
http://git-wip-us.apache.org/repos/asf/ignite/blob/bf27a906/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
index 1d6bfa2..c973256 100644
--- 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
@@ -41,8 +41,11 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
SessionStateData newData = (SessionStateData)objects[0];
- assert data.getLockNodeId().equals(newData.getLockNodeId());
- assert data.getLockId() == newData.getLockId();
+ if (!data.getLockNodeId().equals(newData.getLockNodeId()))
+ throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
+
+ if (data.getLockId() != newData.getLockId())
+ throw new IllegalStateException("Can not unlock session data: lock id check failed.");
// Unlock.
data.setLockNodeId(null);
[12/50] ignite git commit: wip
Posted by vo...@apache.org.
wip
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4d865357
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4d865357
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4d865357
Branch: refs/heads/ignite-3199-1
Commit: 4d86535758e96918fc0072aa2918334547096180
Parents: 6cfe66f
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 17:47:45 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 17:47:45 2016 +0300
----------------------------------------------------------------------
.../platform/websession/KeyValueDirtyTrackedCollection.java | 5 +++--
.../Impl/Collections/KeyValueDirtyTrackedCollection.cs | 1 +
2 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d865357/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 3027868..c79b337 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
@@ -28,13 +28,14 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.TreeMap;
/**
* Web session lock info.
*/
public class KeyValueDirtyTrackedCollection implements Binarylizable {
/** */
- private HashMap<String, byte[]> entries;
+ private Map<String, byte[]> entries; // TODO: Map breaks order.
/** */
private List<String> removedKeys;
@@ -63,7 +64,7 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
int count = raw.readInt();
- entries = new HashMap<>(count);
+ entries = new TreeMap<>(); // TreeMap maintains order.
for (int i = 0; i < count; i++)
entries.put(raw.readString(), raw.readByteArray());
http://git-wip-us.apache.org/repos/asf/ignite/blob/4d865357/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
index 028a18d..64d2e6f 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Collections/KeyValueDirtyTrackedCollection.cs
@@ -33,6 +33,7 @@ namespace Apache.Ignite.Core.Impl.Collections
/// </summary>
public class KeyValueDirtyTrackedCollection : IBinaryWriteAware
{
+ // TODO: SortedDictionary??
/** */
private readonly Dictionary<string, int> _dict;
[22/50] ignite git commit: TestCreateNewStoreData added
Posted by vo...@apache.org.
TestCreateNewStoreData added
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/78d184da
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/78d184da
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/78d184da
Branch: refs/heads/ignite-3199-1
Commit: 78d184da4f4558f743f8ffd4f45ea72ac7e9a1c2
Parents: c413cc1
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 19:54:32 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 19:54:32 2016 +0300
----------------------------------------------------------------------
.../IgniteSessionStateStoreProviderTest.cs | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/78d184da/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs
index f6a81b5..97ec63e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs
@@ -246,6 +246,25 @@ namespace Apache.Ignite.Core.Tests.AspNet
}
/// <summary>
+ /// Tests the create new store data.
+ /// </summary>
+ [Test]
+ public void TestCreateNewStoreData()
+ {
+ var provider = GetProvider();
+
+ var data = provider.CreateNewStoreData(HttpContext, 56);
+
+ Assert.AreEqual(56, data.Timeout);
+ Assert.IsEmpty(data.Items);
+ Assert.IsEmpty(data.StaticObjects);
+
+ // Check that caches are empty.
+ var ignite = Ignition.GetIgnite(GridName);
+ Assert.IsFalse(ignite.GetCacheNames().SelectMany(x => ignite.GetCache<int, int>(x)).Any());
+ }
+
+ /// <summary>
/// Tests the expiry.
/// </summary>
[Test]
[03/50] ignite git commit: wip
Posted by vo...@apache.org.
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;
+ }
+}
[45/50] ignite git commit: Refactror InvokeInternal
Posted by vo...@apache.org.
Refactror InvokeInternal
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/a3045420
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/a3045420
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/a3045420
Branch: refs/heads/ignite-3199-1
Commit: a3045420156832c27a7321a3305875d63a98d434
Parents: b02dce3
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 14:41:47 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 14:41:47 2016 +0300
----------------------------------------------------------------------
.../processors/platform/cache/PlatformCache.java | 9 ++++-----
.../IgniteSessionStateStoreProvider.cs | 18 +++++++++++++++---
.../Apache.Ignite.Core/Impl/Cache/CacheImpl.cs | 4 ++--
.../Impl/Cache/ICacheInternal.cs | 5 +++--
4 files changed, 24 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/a3045420/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
index f45f458..276867f 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/cache/PlatformCache.java
@@ -471,13 +471,12 @@ public class PlatformCache extends PlatformAbstractTarget {
case OP_INVOKE_INTERNAL: {
int opCode = reader.readInt();
- Object[] args = reader.readObjectArray();
- Object key = args[0];
+ String key = reader.readString();
switch (opCode) {
case OP_INVOKE_INTERNAL_SESSION_LOCK: {
- SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[1];
+ SessionStateLockInfo lockInfo = reader.readObject();
Object res = cacheRaw.invoke(key, new LockEntryProcessor(), lockInfo);
@@ -485,7 +484,7 @@ public class PlatformCache extends PlatformAbstractTarget {
}
case OP_INVOKE_INTERNAL_SESSION_UNLOCK: {
- SessionStateLockInfo lockInfo = (SessionStateLockInfo)args[1];
+ SessionStateLockInfo lockInfo = reader.readObject();
cacheRaw.invoke(key, new UnlockEntryProcessor(), lockInfo);
@@ -493,7 +492,7 @@ public class PlatformCache extends PlatformAbstractTarget {
}
case OP_INVOKE_INTERNAL_SESSION_SET_AND_UNLOCK:
- SessionStateData data = (SessionStateData)args[1];
+ SessionStateData data = reader.readObject();
cacheRaw.invoke(key, new SetAndUnlockEntryProcessor(), data);
http://git-wip-us.apache.org/repos/asf/ignite/blob/a3045420/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
index 2408f75..1b559f9 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
@@ -434,7 +434,11 @@ namespace Apache.Ignite.AspNet
/// </summary>
private SessionStateLockResult LockItem(string key, long lockId)
{
- return ((ICacheInternal) Cache).Invoke<SessionStateLockResult>((int) Op.Lock, key, GetLockInfo(lockId));
+ return ((ICacheInternal) Cache).Invoke<SessionStateLockResult>((int) Op.Lock, w =>
+ {
+ w.WriteString(key);
+ w.WriteObject(GetLockInfo(lockId));
+ });
}
/// <summary>
@@ -442,7 +446,11 @@ namespace Apache.Ignite.AspNet
/// </summary>
private void UnlockItem(string key, long lockId)
{
- ((ICacheInternal) Cache).Invoke<object>((int) Op.Unlock, key, GetLockInfo(lockId));
+ ((ICacheInternal) Cache).Invoke<object>((int) Op.Unlock, w =>
+ {
+ w.WriteString(key);
+ w.WriteObject(GetLockInfo(lockId));
+ });
}
/// <summary>
@@ -454,7 +462,11 @@ namespace Apache.Ignite.AspNet
var cache = _expiryCacheHolder.GetCacheWithExpiry(data.Timeout * 60);
- ((ICacheInternal) cache).Invoke<object>((int) Op.SetAndUnlock, key, data);
+ ((ICacheInternal) cache).Invoke<object>((int) Op.SetAndUnlock, w =>
+ {
+ w.WriteString(key);
+ w.WriteObject(data);
+ });
}
}
}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ignite/blob/a3045420/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
index 7750e12..6cecb6d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/CacheImpl.cs
@@ -873,12 +873,12 @@ namespace Apache.Ignite.Core.Impl.Cache
}
/** <inheritDoc /> */
- public T Invoke<T>(int opCode, params object[] args)
+ public T Invoke<T>(int opCode, Action<IBinaryRawWriter> writeAction)
{
return DoOutInOpX((int) CacheOp.InvokeInternal, writer =>
{
writer.WriteInt(opCode);
- writer.WriteArray(args);
+ writeAction(writer);
},
(input, res) => res == True ? Marshaller.Unmarshal<T>(input) : default(T), ReadException);
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/a3045420/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs
index c382dc8..4157833 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core/Impl/Cache/ICacheInternal.cs
@@ -20,6 +20,7 @@ namespace Apache.Ignite.Core.Impl.Cache
using System;
using Apache.Ignite.Core.Binary;
using Apache.Ignite.Core.Cache.Query;
+ using Apache.Ignite.Core.Impl.Binary;
/// <summary>
/// Extended Cache interface for internal needs.
@@ -42,10 +43,10 @@ namespace Apache.Ignite.Core.Impl.Cache
/// </summary>
/// <typeparam name="T">The type of the result.</typeparam>
/// <param name="opCode">The operation code.</param>
- /// <param name="args">The arguments.</param>
+ /// <param name="writeAction">The write action.</param>
/// <returns>
/// Result of the processing.
/// </returns>
- T Invoke<T>(int opCode, params object[] args);
+ T Invoke<T>(int opCode, Action<IBinaryRawWriter> writeAction);
}
}
[32/50] ignite git commit: Mnors.
Posted by vo...@apache.org.
Mnors.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/9807ee35
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/9807ee35
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/9807ee35
Branch: refs/heads/ignite-3199-1
Commit: 9807ee352ecd7cdbfd175a532f2a4c70eb65bd84
Parents: 5543901
Author: vozerov-gridgain <vo...@gridgain.com>
Authored: Wed Sep 7 20:22:53 2016 +0300
Committer: vozerov-gridgain <vo...@gridgain.com>
Committed: Wed Sep 7 20:22:53 2016 +0300
----------------------------------------------------------------------
.../platform/websession/LockEntryProcessor.java | 10 ++++++++--
.../platform/websession/SetAndUnlockEntryProcessor.java | 10 ++++++++--
.../platform/websession/UnlockEntryProcessor.java | 10 ++++++++--
3 files changed, 24 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/9807ee35/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 03ae929..7cf3016 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.platform.websession;
import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.internal.util.typedef.internal.S;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.MutableEntry;
@@ -30,7 +31,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
+ @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... args)
throws EntryProcessorException {
// Arg contains lock info: node id + thread id
// Return result is either BinarizableSessionStateStoreData (when not locked) or lockAge (when locked)
@@ -45,7 +46,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
if (data.locked())
return data.lockTime();
- LockInfo lockInfo = (LockInfo)objects[0];
+ LockInfo lockInfo = (LockInfo)args[0];
// Not locked: lock and return result
data.lock(lockInfo);
@@ -55,4 +56,9 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
return data;
}
+
+ /** {@inheritDoc */
+ @Override public String toString() {
+ return S.toString(LockEntryProcessor.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9807ee35/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
index 6ac8ed1..19f3a38 100644
--- 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
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.platform.websession;
import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.internal.util.typedef.internal.S;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.MutableEntry;
@@ -30,7 +31,7 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
+ @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... args)
throws EntryProcessorException {
assert entry.exists();
@@ -39,7 +40,7 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
assert data != null;
assert data.lockNodeId() != null;
- SessionStateData newData = (SessionStateData)objects[0];
+ SessionStateData newData = (SessionStateData)args[0];
if (!data.lockNodeId().equals(newData.lockNodeId()))
throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
@@ -58,4 +59,9 @@ public class SetAndUnlockEntryProcessor implements CacheEntryProcessor<String, S
return null;
}
+
+ /** {@inheritDoc */
+ @Override public String toString() {
+ return S.toString(SetAndUnlockEntryProcessor.class, this);
+ }
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/9807ee35/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index f6aa798..1075958 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -18,6 +18,7 @@
package org.apache.ignite.internal.processors.platform.websession;
import org.apache.ignite.cache.CacheEntryProcessor;
+import org.apache.ignite.internal.util.typedef.internal.S;
import javax.cache.processor.EntryProcessorException;
import javax.cache.processor.MutableEntry;
@@ -30,7 +31,7 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
private static final long serialVersionUID = 0L;
/** {@inheritDoc} */
- @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... objects)
+ @Override public Object process(MutableEntry<String, SessionStateData> entry, Object... args)
throws EntryProcessorException {
assert entry.exists();
@@ -39,7 +40,7 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
assert data != null;
assert data.lockNodeId() != null;
- LockInfo lockInfo = (LockInfo)objects[0];
+ LockInfo lockInfo = (LockInfo)args[0];
if (!data.lockNodeId().equals(lockInfo.nodeId()))
throw new IllegalStateException("Can not unlock session data: lock node id check failed.");
@@ -54,4 +55,9 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
return null;
}
+
+ /** {@inheritDoc */
+ @Override public String toString() {
+ return S.toString(UnlockEntryProcessor.class, this);
+ }
}
[24/50] ignite git commit: wip
Posted by vo...@apache.org.
wip
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/82a39084
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/82a39084
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/82a39084
Branch: refs/heads/ignite-3199-1
Commit: 82a39084dffa51dd9f4cc5ad39ecd3fbc73b3693
Parents: b88ef7c
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 20:02:51 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 20:02:51 2016 +0300
----------------------------------------------------------------------
.../AspNet/IgniteSessionStateItemCollectionTest.cs | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/82a39084/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
index eba95d4..58cf0dc 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
@@ -93,6 +93,8 @@ namespace Apache.Ignite.Core.Tests.AspNet
Assert.AreEqual("val2", col["key"]);
Assert.AreEqual(3, col["1"]);
+ // TODO: CopyTo, syncroot
+
// Remove.
col["2"] = 2;
col["3"] = 3;
[23/50] ignite git commit: Fix LockId logic
Posted by vo...@apache.org.
Fix LockId logic
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/b88ef7cb
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/b88ef7cb
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/b88ef7cb
Branch: refs/heads/ignite-3199-1
Commit: b88ef7cb425c38c8bfb3de3f35afea681e7dbe41
Parents: 78d184d
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 19:58:20 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 19:58:20 2016 +0300
----------------------------------------------------------------------
.../IgniteSessionStateStoreProvider.cs | 2 ++
.../AspNet/IgniteSessionStateStoreProviderTest.cs | 14 +++++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/b88ef7cb/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
index 5c13c29..2aa4e70 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/IgniteSessionStateStoreProvider.cs
@@ -183,6 +183,8 @@ namespace Apache.Ignite.AspNet
lockAge = DateTime.UtcNow - data.LockTime.Value;
+ lockId = data.LockId;
+
return null;
}
http://git-wip-us.apache.org/repos/asf/ignite/blob/b88ef7cb/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs
index 97ec63e..0cedc0e 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateStoreProviderTest.cs
@@ -215,7 +215,19 @@ namespace Apache.Ignite.Core.Tests.AspNet
object lockId1; // do not overwrite lockId
res = provider.GetItem(HttpContext, Id, out locked, out lockAge, out lockId1, out actions);
Assert.IsNull(res);
- Assert.IsNull(lockId1);
+ Assert.IsNotNull(lockId1);
+ Assert.IsTrue(locked);
+ Assert.Greater(lockAge, TimeSpan.Zero);
+ Assert.AreEqual(SessionStateActions.None, actions);
+ }).Wait();
+
+ // Try to get it in a different thread.
+ Task.Factory.StartNew(() =>
+ {
+ object lockId1; // do not overwrite lockId
+ res = provider.GetItemExclusive(HttpContext, Id, out locked, out lockAge, out lockId1, out actions);
+ Assert.IsNull(res);
+ Assert.IsNotNull(lockId1);
Assert.IsTrue(locked);
Assert.Greater(lockAge, TimeSpan.Zero);
Assert.AreEqual(SessionStateActions.None, actions);
[34/50] ignite git commit: Fix test
Posted by vo...@apache.org.
Fix test
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/8a6458f8
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/8a6458f8
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/8a6458f8
Branch: refs/heads/ignite-3199-1
Commit: 8a6458f896dec5ceebcdf989da3f958b4f9ec58e
Parents: eb08a67
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Thu Sep 8 12:26:31 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Thu Sep 8 12:26:31 2016 +0300
----------------------------------------------------------------------
.../processors/platform/websession/LockEntryProcessor.java | 2 +-
.../processors/platform/websession/SessionStateData.java | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/8a6458f8/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
index 7cf3016..72aa183 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/LockEntryProcessor.java
@@ -43,7 +43,7 @@ public class LockEntryProcessor implements CacheEntryProcessor<String, SessionSt
assert data != null;
- if (data.locked())
+ if (data.isLocked())
return data.lockTime();
LockInfo lockInfo = (LockInfo)args[0];
http://git-wip-us.apache.org/repos/asf/ignite/blob/8a6458f8/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 08a02e3..2c4a62f 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
@@ -77,8 +77,8 @@ public class SessionStateData implements Binarylizable {
/**
* @return {@code True} if locked.
*/
- public boolean locked() {
- return lockTime == null;
+ public boolean isLocked() {
+ return lockTime != null;
}
/**
@@ -87,7 +87,7 @@ public class SessionStateData implements Binarylizable {
* @param lock Lock.
*/
public void lock(LockInfo lock) {
- assert !locked();
+ assert !isLocked();
lockId = lock.id();
lockNodeId = lock.nodeId();
@@ -98,7 +98,7 @@ public class SessionStateData implements Binarylizable {
* Clear lock info.
*/
public void unlock() {
- assert locked();
+ assert isLocked();
lockId = 0;
lockNodeId = null;
[26/50] ignite git commit: IgniteSessionStateItemCollectionTest done
Posted by vo...@apache.org.
IgniteSessionStateItemCollectionTest done
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/88640ddf
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/88640ddf
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/88640ddf
Branch: refs/heads/ignite-3199-1
Commit: 88640ddf8d866d69f4f2d5115462fc0ec6a89591
Parents: 189aacb
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Tue Sep 6 10:48:45 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Tue Sep 6 10:48:45 2016 +0300
----------------------------------------------------------------------
.../Impl/IgniteSessionStateItemCollection.cs | 3 +--
.../Apache.Ignite.Core.Tests/AspNet/ExpiryCacheHolderTest.cs | 2 +-
.../AspNet/IgniteSessionStateItemCollectionTest.cs | 6 +++++-
3 files changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/88640ddf/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
index 5609961..ee436f6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.AspNet/Impl/IgniteSessionStateItemCollection.cs
@@ -61,9 +61,8 @@ namespace Apache.Ignite.AspNet.Impl
"The number of elements in the source collection is greater than the available space " +
"from specified index to the end of the array.");
- var i = 0;
foreach (var key in _collection.GetKeys())
- array.SetValue(key, i++);
+ array.SetValue(key, index++);
}
/** <inheritdoc /> */
http://git-wip-us.apache.org/repos/asf/ignite/blob/88640ddf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/ExpiryCacheHolderTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/ExpiryCacheHolderTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/ExpiryCacheHolderTest.cs
index 38db8d4..6f8c2f6 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/ExpiryCacheHolderTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/ExpiryCacheHolderTest.cs
@@ -52,7 +52,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
CheckExpiry(TimeSpan.FromSeconds(15), cache1);
Assert.AreNotSame(cache, cache1);
- Assert.AreSame(cache1, (CacheEx) holder.GetCacheWithExpiry(15));
+ Assert.AreSame(cache1, holder.GetCacheWithExpiry(15));
// Check rounding.
var cache2 = (CacheEx) holder.GetCacheWithExpiry(DateTime.UtcNow.AddSeconds(15.1));
http://git-wip-us.apache.org/repos/asf/ignite/blob/88640ddf/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
index 58cf0dc..9f8f34d 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/AspNet/IgniteSessionStateItemCollectionTest.cs
@@ -44,6 +44,7 @@ namespace Apache.Ignite.Core.Tests.AspNet
Assert.IsEmpty(col);
Assert.IsEmpty(col.OfType<string>().ToArray());
Assert.IsEmpty(col.Keys);
+ Assert.IsNotNull(col.SyncRoot);
col.Clear();
col.Remove("key");
@@ -93,7 +94,10 @@ namespace Apache.Ignite.Core.Tests.AspNet
Assert.AreEqual("val2", col["key"]);
Assert.AreEqual(3, col["1"]);
- // TODO: CopyTo, syncroot
+ // CopyTo.
+ var keys = new string[5];
+ col.CopyTo(keys, 2);
+ Assert.AreEqual(new[] {null, null, "key", "1", null}, keys);
// Remove.
col["2"] = 2;
[13/50] ignite git commit: Fix entry order
Posted by vo...@apache.org.
Fix entry order
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/4a4ab881
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/4a4ab881
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/4a4ab881
Branch: refs/heads/ignite-3199-1
Commit: 4a4ab881c565d8d1ff9849abe2657e4355fa5858
Parents: 4d86535
Author: Pavel Tupitsyn <pt...@apache.org>
Authored: Mon Sep 5 17:49:12 2016 +0300
Committer: Pavel Tupitsyn <pt...@apache.org>
Committed: Mon Sep 5 17:49:12 2016 +0300
----------------------------------------------------------------------
.../platform/websession/KeyValueDirtyTrackedCollection.java | 8 ++++----
.../processors/platform/websession/UnlockEntryProcessor.java | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a4ab881/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 c79b337..581dbb3 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
@@ -25,17 +25,17 @@ import org.apache.ignite.binary.BinaryWriter;
import org.apache.ignite.binary.Binarylizable;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.SortedMap;
import java.util.TreeMap;
/**
* Web session lock info.
*/
public class KeyValueDirtyTrackedCollection implements Binarylizable {
- /** */
- private Map<String, byte[]> entries; // TODO: Map breaks order.
+ /** Entry order is important. */
+ private SortedMap<String, byte[]> entries;
/** */
private List<String> removedKeys;
@@ -64,7 +64,7 @@ public class KeyValueDirtyTrackedCollection implements Binarylizable {
int count = raw.readInt();
- entries = new TreeMap<>(); // TreeMap maintains order.
+ entries = new TreeMap<>();
for (int i = 0; i < count; i++)
entries.put(raw.readString(), raw.readByteArray());
http://git-wip-us.apache.org/repos/asf/ignite/blob/4a4ab881/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
index 12f42a3..d9be048 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/processors/platform/websession/UnlockEntryProcessor.java
@@ -38,7 +38,7 @@ public class UnlockEntryProcessor implements CacheEntryProcessor<String, Session
LockInfo lockInfo = (LockInfo)objects[0];
- assert data.getLockNodeId() == lockInfo.getLockNodeId();
+ assert data.getLockNodeId().equals(lockInfo.getLockNodeId());
assert data.getLockId() == lockInfo.getLockId();
// Unlock.