문제

I have multiple producers, each pushing data into there own Blocking queues. The data from each producer is processed independently, (hence the separate queues).

My single consumer currently polls each of those queues, with a timeout on each.

Program works just fine, but I am trying to optimize, I don't like the "polling". Is this the most efficient way to approach this.?,

I have written the same app using a consumer per producer, but that profiled slightly worse.

thanks .

도움이 되었습니까?

해결책

Try to register the consumer as a listener on the queues, so that a change in the queue status informs the consumer without actively polling (Inversion of control).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top