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/01/11 16:27:25 UTC
[32/50] [abbrv] ignite git commit: PageMemory - WIP.
PageMemory - WIP.
Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/13e408ef
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/13e408ef
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/13e408ef
Branch: refs/heads/ignite-2234
Commit: 13e408efaeaa6a57061fa4d5f8be4a608495e9c7
Parents: ce2a29b
Author: Alexey Goncharuk <al...@gmail.com>
Authored: Tue Dec 29 17:32:06 2015 +0300
Committer: Alexey Goncharuk <al...@gmail.com>
Committed: Tue Dec 29 17:33:17 2015 +0300
----------------------------------------------------------------------
.../ignite/internal/util/IgniteUtils.java | 40 ++++++++++++++++++++
1 file changed, 40 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ignite/blob/13e408ef/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
----------------------------------------------------------------------
diff --git a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
index be4851d..480859d 100644
--- a/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
+++ b/modules/core/src/main/java/org/apache/ignite/internal/util/IgniteUtils.java
@@ -7667,6 +7667,22 @@ public abstract class IgniteUtils {
}
/**
+ * Gets object field offset.
+ *
+ * @param cls Object class.
+ * @param fieldName Field name.
+ * @return Field offset.
+ */
+ public static long fieldOffset(Class<?> cls, String fieldName) {
+ try {
+ return UNSAFE.objectFieldOffset(cls.getDeclaredField(fieldName));
+ }
+ catch (NoSuchFieldException e) {
+ throw new IllegalStateException(e);
+ }
+ }
+
+ /**
* @param cls Class to check.
* @return {@code True} if class is final.
*/
@@ -9174,6 +9190,30 @@ public abstract class IgniteUtils {
}
/**
+ * @param cls The class to search.
+ * @param name Name of a field to get.
+ * @return Field or {@code null}.
+ */
+ @Nullable public static Field findNonPublicField(Class<?> cls, String name) {
+ while (cls != null) {
+ try {
+ Field fld = cls.getDeclaredField(name);
+
+ fld.setAccessible(true);
+
+ return fld;
+ }
+ catch (NoSuchFieldException e) {
+ // No-op.
+ }
+
+ cls = cls.getSuperclass();
+ }
+
+ return null;
+ }
+
+ /**
* @param c Collection.
* @param p Optional filters.
* @return Resulting array list.