Archiviert
13
0

Attempt to fix memory leaks with the ChannelInjector

Addresses https://github.com/aadnk/ProtocolLib/issues/70
Dieser Commit ist enthalten in:
Dan Mulloy 2014-11-15 14:56:57 -05:00
Ursprung 592874fd5e
Commit ca2bc3ecc5

Datei anzeigen

@ -113,6 +113,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
* A flag set by the main thread to indiciate that a packet should not be processed.
*/
private final ThreadLocal<Boolean> scheduleProcessPackets = new ThreadLocal<Boolean>() {
@Override
protected Boolean initialValue() {
return true;
};
@ -667,6 +668,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
* Set the player instance.
* @param player - current instance.
*/
@Override
public void setPlayer(Player player) {
this.player = player;
}
@ -675,6 +677,7 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
* Set the updated player instance.
* @param updated - updated instance.
*/
@Override
public void setUpdatedPlayer(Player updated) {
this.updated = updated;
}
@ -734,6 +737,10 @@ class ChannelInjector extends ByteToMessageDecoder implements Injector {
// Clear cache
factory.invalidate(player);
}
// dmulloy2 - attempt to fix memory leakage
this.player = null;
this.updated = null;
}
}