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() {
|
public void shutdown() {
|
||||||
|
log.info("shutting down connection manager")
|
||||||
connectionManager.shutdown()
|
connectionManager.shutdown()
|
||||||
|
log.info("shutting down download manageer")
|
||||||
downloadManager.shutdown()
|
downloadManager.shutdown()
|
||||||
|
log.info("shutting down connection acceeptor")
|
||||||
connectionAcceptor.stop()
|
connectionAcceptor.stop()
|
||||||
|
log.info("shutting down connection establisher")
|
||||||
connectionEstablisher.stop()
|
connectionEstablisher.stop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,9 +76,9 @@ abstract class Connection implements Closeable {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
log.info("closing $name")
|
log.info("closing $name")
|
||||||
endpoint.close()
|
|
||||||
reader.interrupt()
|
reader.interrupt()
|
||||||
writer.interrupt()
|
writer.interrupt()
|
||||||
|
endpoint.close()
|
||||||
eventBus.publish(new DisconnectionEvent(destination: endpoint.destination))
|
eventBus.publish(new DisconnectionEvent(destination: endpoint.destination))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,8 @@ class UltrapeerConnectionManager extends ConnectionManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
void shutdown() {
|
void shutdown() {
|
||||||
peerConnections.each {k,v -> v.close() }
|
peerConnections.values().stream().parallel().forEach({v -> v.close()})
|
||||||
leafConnections.each {k,v -> v.close() }
|
leafConnections.values().stream().parallel().forEach({v -> v.close()})
|
||||||
peerConnections.clear()
|
peerConnections.clear()
|
||||||
leafConnections.clear()
|
leafConnections.clear()
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,5 +138,6 @@ public class DownloadManager {
|
||||||
|
|
||||||
public void shutdown() {
|
public void shutdown() {
|
||||||
downloaders.each { it.stop() }
|
downloaders.each { it.stop() }
|
||||||
|
Downloader.executorService.shutdownNow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue