Skip to content
Permalink
Browse files
Proper freeing of resources (e.g. output-thread) when connection is
closed [JENKINS-25349]
Don't know why I disabled this initially.
  • Loading branch information
kutzi committed Nov 1, 2014
1 parent 6b1f4fa commit 98b0105a743d062abf957c285cdded06fedd3fa3
Showing with 12 additions and 7 deletions.
  1. +12 −7 src/main/java/hudson/plugins/ircbot/v2/IRCConnection.java
@@ -87,13 +87,18 @@ public IRCConnection(DescriptorImpl descriptor, AuthenticationHolder authenticat
public void close() {
this.listener.explicitDisconnect = true;

if (this.pircConnection != null && this.pircConnection.isConnected()) {
this.listener.removeJoinListener(this);
this.listener.removePartListener(this);
this.listener.removeInviteListener(this);

this.pircConnection.disconnect();
//this.pircConnection.shutdown();
if (this.pircConnection != null) {
if (this.pircConnection.isConnected()) {
this.listener.removeJoinListener(this);
this.listener.removePartListener(this);
this.listener.removeInviteListener(this);

this.pircConnection.disconnect();
}

// Perform a proper shutdown, also freeing all the resources (input-/output-thread)
// Note that with PircBotx 2.x the threads are gone and we can maybe simplify this
this.pircConnection.shutdown(true);
}
}

0 comments on commit 98b0105

Please sign in to comment.