Class ConcurrentHasher


  • public class ConcurrentHasher
    extends java.lang.Object
    • Field Detail

      • processor_num

        protected int processor_num
      • v1_hashers

        protected final java.util.List<SHA1Hasher> v1_hashers
      • v2_hashers

        protected final java.util.List<java.security.MessageDigest> v2_hashers
      • scheduler_sem

        protected final AESemaphore scheduler_sem
      • requests_mon

        protected final AEMonitor requests_mon
      • friendly_hashing

        private static boolean friendly_hashing
    • Constructor Detail

      • ConcurrentHasher

        protected ConcurrentHasher()
    • Method Detail

      • concurrentHashingAvailable

        public static boolean concurrentHashingAvailable()
      • addRequest

        public ConcurrentHasherRequest addRequest​(java.nio.ByteBuffer buffer,
                                                  int hash_version,
                                                  int piece_size,
                                                  long v2_file_size)
        add a synchronous request - on return it will have run (or been cancelled)
      • addRequest

        public ConcurrentHasherRequest addRequest​(java.nio.ByteBuffer buffer,
                                                  int hash_version,
                                                  int piece_size,
                                                  long v2_file_size,
                                                  ConcurrentHasherRequestListener listener,
                                                  boolean low_priorty)
        Add an asynchronous request if listener supplied, sync otherwise
        Parameters:
        buffer -
        priority -
        listener -
        low_priorty - low priority checks will cause the "friendly hashing" setting to be taken into account
        Returns:
      • main

        public static void main​(java.lang.String[] args)