mirror of https://github.com/zlatinb/muwire
close connections in parallel, more shutdown fixes
parent
a388eaec1d
commit
db7e21e343
|
@ -234,9 +234,13 @@ public class Core {
|
|||
}
|
||||
|
||||
public void shutdown() {
|
||||
log.info("shutting down connection manager")
|
||||
connectionManager.shutdown()
|
||||
log.info("shutting down download manageer")
|
||||
downloadManager.shutdown()
|
||||
log.info("shutting down connection acceeptor")
|
||||
connectionAcceptor.stop()
|
||||
log.info("shutting down connection establisher")
|
||||
connectionEstablisher.stop()
|
||||
}
|
||||
|
||||
|
|
|
@ -76,9 +76,9 @@ abstract class Connection implements Closeable {
|
|||
return
|
||||
}
|
||||
log.info("closing $name")
|
||||
endpoint.close()
|
||||
reader.interrupt()
|
||||
writer.interrupt()
|
||||
endpoint.close()
|
||||
eventBus.publish(new DisconnectionEvent(destination: endpoint.destination))
|
||||
}
|
||||
|
||||
|
|
|
@ -104,8 +104,8 @@ class UltrapeerConnectionManager extends ConnectionManager {
|
|||
|
||||
@Override
|
||||
void shutdown() {
|
||||
peerConnections.each {k,v -> v.close() }
|
||||
leafConnections.each {k,v -> v.close() }
|
||||
peerConnections.values().stream().parallel().forEach({v -> v.close()})
|
||||
leafConnections.values().stream().parallel().forEach({v -> v.close()})
|
||||
peerConnections.clear()
|
||||
leafConnections.clear()
|
||||
}
|
||||
|
|
|
@ -138,5 +138,6 @@ public class DownloadManager {
|
|||
|
||||
public void shutdown() {
|
||||
downloaders.each { it.stop() }
|
||||
Downloader.executorService.shutdownNow()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue