Repository: ignite Updated Branches: refs/heads/ignite-5272 c3883a48d -> bdf074dcf
IgniteUtils: removed unused code. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/6283bd83 Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/6283bd83 Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/6283bd83 Branch: refs/heads/ignite-5272 Commit: 6283bd83ed42d12d9aa9eee37b4ce86596dc2351 Parents: 9b3987d Author: sboikov <[email protected]> Authored: Wed Jun 14 14:57:11 2017 +0300 Committer: sboikov <[email protected]> Committed: Wed Jun 14 14:57:11 2017 +0300 ---------------------------------------------------------------------- .../ignite/internal/util/IgniteUtils.java | 219 +------------------ 1 file changed, 1 insertion(+), 218 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/6283bd83/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 4e9d0c7..5a14b4a 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 @@ -187,8 +187,6 @@ import org.apache.ignite.internal.managers.deployment.GridDeploymentInfo; import org.apache.ignite.internal.mxbean.IgniteStandardMXBean; import org.apache.ignite.internal.processors.cache.GridCacheAttributes; import org.apache.ignite.internal.processors.cache.GridCacheSharedContext; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersion; -import org.apache.ignite.internal.processors.cache.version.GridCacheVersionEx; import org.apache.ignite.internal.transactions.IgniteTxHeuristicCheckedException; import org.apache.ignite.internal.transactions.IgniteTxOptimisticCheckedException; import org.apache.ignite.internal.transactions.IgniteTxRollbackCheckedException; @@ -3008,10 +3006,9 @@ public abstract class IgniteUtils { * @param data An array of characters containing hexidecimal digits * @return A byte array containing binary data decoded from * the supplied char array. - * @throws org.apache.ignite.IgniteCheckedException Thrown if an odd number or illegal of characters is supplied. + * @throws IgniteCheckedException Thrown if an odd number or illegal of characters is supplied. */ public static byte[] decodeHex(char[] data) throws IgniteCheckedException { - int len = data.length; if ((len & 0x01) != 0) @@ -3105,21 +3102,6 @@ public abstract class IgniteUtils { } /** - * Takes given collection, shuffles it and returns iterable instance. - * - * @param <T> Type of elements to create iterator for. - * @param col Collection to shuffle. - * @return Iterable instance over randomly shuffled collection. - */ - public static <T> Iterable<T> randomIterable(Collection<T> col) { - List<T> list = new ArrayList<>(col); - - Collections.shuffle(list); - - return list; - } - - /** * Converts enumeration to iterable so it can be used in {@code foreach} construct. * * @param <T> Types of instances for iteration. @@ -3848,26 +3830,6 @@ public abstract class IgniteUtils { /** * Checks for containment of the value in the array. - * Both array cells and value may be {@code null}. Two {@code null}s are considered equal. - * - * @param arr Array of objects. - * @param c Collection to check. - * @return {@code true} if contains object, {@code false} otherwise. - */ - public static boolean containsObjectArray(@Nullable Object[] arr, @Nullable Collection<Object> c) { - if (arr == null || arr.length == 0 || c == null || c.isEmpty()) - return false; - - for (Object o : arr) { - if (c.contains(o)) - return true; - } - - return false; - } - - /** - * Checks for containment of the value in the array. * * @param arr Array of objects. * @param val Value to check for containment inside of array. @@ -9227,185 +9189,6 @@ public abstract class IgniteUtils { } /** - * @param arr Array. - * @param off Offset. - * @param uid UUID. - * @return Offset. - */ - public static long writeGridUuid(byte[] arr, long off, @Nullable IgniteUuid uid) { - GridUnsafe.putBoolean(arr, off++, uid != null); - - if (uid != null) { - GridUnsafe.putLong(arr, off, uid.globalId().getMostSignificantBits()); - - off += 8; - - GridUnsafe.putLong(arr, off, uid.globalId().getLeastSignificantBits()); - - off += 8; - - GridUnsafe.putLong(arr, off, uid.localId()); - - off += 8; - } - - return off; - } - - /** - * @param arr Array. - * @param off Offset. - * @return UUID. - */ - @Nullable public static IgniteUuid readGridUuid(byte[] arr, long off) { - if (GridUnsafe.getBoolean(arr, off++)) { - long most = GridUnsafe.getLong(arr, off); - - off += 8; - - long least = GridUnsafe.getLong(arr, off); - - off += 8; - - UUID globalId = new UUID(most, least); - - long locId = GridUnsafe.getLong(arr, off); - - return new IgniteUuid(globalId, locId); - } - - return null; - } - - /** - * @param ptr Offheap address. - * @return UUID. - */ - @Nullable public static IgniteUuid readGridUuid(long ptr) { - if (GridUnsafe.getBoolean(null, ptr++)) { - long most = GridUnsafe.getLong(ptr); - - ptr += 8; - - long least = GridUnsafe.getLong(ptr); - - ptr += 8; - - UUID globalId = new UUID(most, least); - - long locId = GridUnsafe.getLong(ptr); - - return new IgniteUuid(globalId, locId); - } - - return null; - } - - /** - * @param arr Array. - * @param off Offset. - * @param ver Version. - * @return Offset. - */ - public static long writeVersion(byte[] arr, long off, GridCacheVersion ver) { - boolean verEx = ver instanceof GridCacheVersionEx; - - GridUnsafe.putBoolean(arr, off++, verEx); - - if (verEx) { - GridCacheVersion drVer = ver.conflictVersion(); - - assert drVer != null; - - GridUnsafe.putInt(arr, off, drVer.topologyVersion()); - - off += 4; - - GridUnsafe.putInt(arr, off, drVer.nodeOrderAndDrIdRaw()); - - off += 4; - - GridUnsafe.putLong(arr, off, drVer.order()); - - off += 8; - } - - GridUnsafe.putInt(arr, off, ver.topologyVersion()); - - off += 4; - - GridUnsafe.putInt(arr, off, ver.nodeOrderAndDrIdRaw()); - - off += 4; - - GridUnsafe.putLong(arr, off, ver.order()); - - off += 8; - - return off; - } - - /** - * @param ptr Offheap address. - * @param verEx If {@code true} reads {@link GridCacheVersionEx} instance. - * @return Version. - */ - public static GridCacheVersion readVersion(long ptr, boolean verEx) { - GridCacheVersion ver = new GridCacheVersion(GridUnsafe.getInt(ptr), - GridUnsafe.getInt(ptr + 4), - GridUnsafe.getLong(ptr + 8)); - - if (verEx) { - ptr += 16; - - ver = new GridCacheVersionEx(GridUnsafe.getInt(ptr), - GridUnsafe.getInt(ptr + 4), - GridUnsafe.getLong(ptr + 8), - ver); - } - - return ver; - } - - /** - * @param arr Array. - * @param off Offset. - * @param verEx If {@code true} reads {@link GridCacheVersionEx} instance. - * @return Version. - */ - public static GridCacheVersion readVersion(byte[] arr, long off, boolean verEx) { - int topVer = GridUnsafe.getInt(arr, off); - - off += 4; - - int nodeOrderDrId = GridUnsafe.getInt(arr, off); - - off += 4; - - long order = GridUnsafe.getLong(arr, off); - - off += 8; - - GridCacheVersion ver = new GridCacheVersion(topVer, nodeOrderDrId, order); - - if (verEx) { - topVer = GridUnsafe.getInt(arr, off); - - off += 4; - - nodeOrderDrId = GridUnsafe.getInt(arr, off); - - off += 4; - - order = GridUnsafe.getLong(arr, off); - - ver = new GridCacheVersionEx(topVer, nodeOrderDrId, order, ver); - } - - return ver; - } - - /** * @param ptr Address. * @param size Size. * @return Bytes.
