org.gudy.azureus2.core3.util
Class ConcurrentHasher

java.lang.Object
  extended by org.gudy.azureus2.core3.util.ConcurrentHasher

public class ConcurrentHasher
extends Object


Field Summary
protected  List<SHA1Hasher> hashers
           
protected  int processor_num
           
protected  AESemaphore request_sem
           
protected  List<ConcurrentHasherRequest> requests
           
protected  AEMonitor requests_mon
           
protected  AESemaphore scheduler_sem
           
protected static ConcurrentHasher singleton
           
 
Constructor Summary
protected ConcurrentHasher()
           
 
Method Summary
 ConcurrentHasherRequest addRequest(ByteBuffer buffer)
          add a synchronous request - on return it will have run (or been cancelled)
 ConcurrentHasherRequest addRequest(ByteBuffer buffer, ConcurrentHasherRequestListener listener, boolean low_priorty)
          Add an asynchronous request if listener supplied, sync otherwise
static boolean concurrentHashingAvailable()
           
static ConcurrentHasher getSingleton()
           
static void main(String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

singleton

protected static final ConcurrentHasher singleton

processor_num

protected int processor_num

requests

protected final List<ConcurrentHasherRequest> requests

hashers

protected final List<SHA1Hasher> hashers

request_sem

protected final AESemaphore request_sem

scheduler_sem

protected final AESemaphore scheduler_sem

requests_mon

protected final AEMonitor requests_mon
Constructor Detail

ConcurrentHasher

protected ConcurrentHasher()
Method Detail

getSingleton

public static ConcurrentHasher getSingleton()

concurrentHashingAvailable

public static boolean concurrentHashingAvailable()

addRequest

public ConcurrentHasherRequest addRequest(ByteBuffer buffer)
add a synchronous request - on return it will have run (or been cancelled)


addRequest

public ConcurrentHasherRequest addRequest(ByteBuffer buffer,
                                          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(String[] args)