Methods Summary |
---|
private synchronized DocumentDescription | getNextDocumentFromQueue()
while (0 == _printQueue.size()) {
try {
wait();
} catch (Exception ignored) {
}
}
DocumentDescription nextDocument = (DocumentDescription) _printQueue.remove(0);
return nextDocument;
|
public synchronized boolean | printDocument(DocumentDescription document)
_printQueue.add(document);
notifyAll();
return true;
|
private void | printNextDocument()
try {
DocumentDescription documentToPrint = getNextDocumentFromQueue();
setCurrentlyPrinting(true);
_realPrinter.printDocument(documentToPrint);
setCurrentlyPrinting(false);
} catch (Exception ignored) {
/*
This is a real issue-- what do we do with PrinterExceptions
when we've batched things up like this.
*/
}
|
public synchronized boolean | printerAvailable()
if (_currentlyPrinting) {
return false;
}
return _realPrinter.printerAvailable();
|
private synchronized void | setCurrentlyPrinting(boolean currentlyPrinting)
_currentlyPrinting = currentlyPrinting;
|