INNER CODE UNIT · Java
put2QueuePolling
RuedigerMoeller/kontraktor · attic/ElasticScheduler.java:96
public void put2QueuePolling(Queue q, boolean isCBQ, Object o, Object receiver) {
int count = 0;
boolean warningPrinted = false;
while ( ! q.offer(o) ) {
pollDelay(count++);
if ( count > RECURSE_ON_BLOCK_THRESHOLD && isCBQ) {
// thread is blocked, try to schedule other actors on this dispatcher (only calbacks+futures!)
if (Thread.currentThread() instanceof DispatcherThread) {
// fixme: think about consequences in depth.
//
// if blocked trying to put a callback onto a callback queue:
// check wether receiving actor is also scheduled on current thread
// if so, poll its message queue. fixme: what happens if sender == receiver
// Actor sendingActor = Actor.sender.get();
DispatcherThread dp = (DispatcherThread) Thread.currentThread();