Consumerpublic class Consumer extends Thread
Fields Summary |
---|
private BlockingQueue | q | private PrintStream | out |
Methods Summary |
---|
private void | process(java.lang.Object obj)
out.printf("%s processing object:%n '%s'%n",
getName(), obj.toString());
| public void | run()
try {
while (true) {
process(q.take());
}
} catch (InterruptedException e) {
out.printf("%s interrupted: %s", getName(), e.getMessage());
}
|
|