java - Asynchronous execution in BlockingQueue -


i using java collections blockingqueue data processing. current code looks like

while(true){     if(queue.size() > 0)         handle(queue.take()) } 

is there way (in java or other frameworks) can process asynchronously, like,

queue.sethandler(new handler<e>()); 

somewhere down class..

class handler implements ihandler<e>{     void handle(e e){         handle(e)     } } 


Comments