Package com.biglybt.core.util
Class ConcurrentHasher
- java.lang.Object
-
- com.biglybt.core.util.ConcurrentHasher
-
public class ConcurrentHasher extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static boolean
friendly_hashing
protected int
processor_num
protected AESemaphore
request_sem
protected java.util.List<ConcurrentHasherRequest>
requests
protected AEMonitor
requests_mon
protected AESemaphore
scheduler_sem
protected static ConcurrentHasher
singleton
protected java.util.List<SHA1Hasher>
v1_hashers
protected java.util.List<java.security.MessageDigest>
v2_hashers
-
Constructor Summary
Constructors Modifier Constructor Description protected
ConcurrentHasher()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)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 otherwisestatic boolean
concurrentHashingAvailable()
static ConcurrentHasher
getSingleton()
static void
main(java.lang.String[] args)
-
-
-
Field Detail
-
singleton
protected static final ConcurrentHasher singleton
-
processor_num
protected int processor_num
-
requests
protected final java.util.List<ConcurrentHasherRequest> requests
-
v1_hashers
protected final java.util.List<SHA1Hasher> v1_hashers
-
v2_hashers
protected final java.util.List<java.security.MessageDigest> v2_hashers
-
request_sem
protected final AESemaphore request_sem
-
scheduler_sem
protected final AESemaphore scheduler_sem
-
requests_mon
protected final AEMonitor requests_mon
-
friendly_hashing
private static boolean friendly_hashing
-
-
Method Detail
-
getSingleton
public static ConcurrentHasher getSingleton()
-
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)
-
-