Archiviert
13
0

Fix one of many issues with reloading

I'm only fixing this because it was relatively simple and I got a lot of reports for it. Seriously people, Stop. Reloading.

Fixes #373, fixes #368, fixes #360, fixes #359
Dieser Commit ist enthalten in:
Dan Mulloy 2017-07-08 02:10:24 -04:00
Ursprung 59171c5443
Commit e1ea295600

Datei anzeigen

@ -27,6 +27,7 @@ import java.util.Map.Entry;
import java.util.NoSuchElementException;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.atomic.AtomicInteger;
import net.sf.cglib.proxy.Factory;
@ -92,7 +93,18 @@ public class ChannelInjector extends ByteToMessageDecoder implements Injector {
// Versioning
private static Class<?> PACKET_SET_PROTOCOL = null;
private static AttributeKey<Integer> PROTOCOL_KEY = AttributeKey.valueOf("PROTOCOL");
private static AtomicInteger keyId = new AtomicInteger();
private static AttributeKey<Integer> PROTOCOL_KEY;
static {
// Shout-outs to reloading
try {
PROTOCOL_KEY = AttributeKey.valueOf("PROTOCOL");
} catch (IllegalArgumentException ex) {
PROTOCOL_KEY = AttributeKey.valueOf("PROTOCOL-" + keyId.getAndIncrement());
}
}
// Saved accessors
private static MethodAccessor DECODE_BUFFER;