static ByteOperations getBest()

in cassandra-analytics-core/src/main/java/org/apache/cassandra/spark/bulkwriter/util/FastByteOperations.java [82:104]


        static ByteOperations getBest()
        {
            String arch = System.getProperty("os.arch");
            boolean unaligned = arch.equals("i386") || arch.equals("x86") || arch.equals("x86_64") || arch.equals("amd64");
            if (!unaligned)
            {
                return new PureJavaOperations();
            }
            try
            {
                Class<?> theClass = Class.forName(UNSAFE_COMPARER_NAME);

                // Yes, UnsafeComparer does implement Comparer<byte[]>
                @SuppressWarnings("unchecked")
                ByteOperations comparer = (ByteOperations) theClass.getConstructor().newInstance();
                return comparer;
            }
            catch (Throwable throwable)
            {
                // Ensure we really catch *everything*
                return new PureJavaOperations();
            }
        }