Skip to content

Instantly share code, notes, and snippets.

@ceki
Created May 3, 2013 10:31
Show Gist options
  • Save ceki/5508403 to your computer and use it in GitHub Desktop.
Save ceki/5508403 to your computer and use it in GitHub Desktop.
class AbstractSocketAppender extends ... {
ConnectionRunner connectionRunner = ...:
public final void run() {
try {
while (!Thread.currentThread().isInterrupted()) {
Socket socket = connectionRunner.getSocket();
if(socket == null)
break;
dispatchEvents();
}
} catch (InterruptedException ex) {
assert true; // ok... we'll exit now
}
addInfo("shutting down");
}
void stop() {
CloseUtil.closeQuietly(socket);
task.cancel(true);
connectionRunner.stop();
super.stop();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment