Skip to content

Instantly share code, notes, and snippets.

@colin-haber
Created June 4, 2011 04:05
Show Gist options
  • Select an option

  • Save colin-haber/1007565 to your computer and use it in GitHub Desktop.

Select an option

Save colin-haber/1007565 to your computer and use it in GitHub Desktop.
blocking problems
private void initPrinter() {
new Thread(new Runnable() { public void run() {while (true) {
Message read = messageQueue.read();
String text = read.getText();
//process and print
} catch (Exception e) {
e.printStackTrace();
}
}}}).start();
}
public Message read() {
try {
return (Message) in.readObject();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment