refactoring: ProtocolDecoder
This commit is contained in:
@@ -8,17 +8,17 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public class WideClassObjectPool {
|
||||
public abstract class WideClassObjectPool<T extends Passivable> {
|
||||
|
||||
private final Map<Class, ObjectPool> mapPool = new HashMap<>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public <R extends Passivable> ObjectPool<R> getPool(Class<R> clazz) {
|
||||
public <R extends T> ObjectPool<R> getPool(Class<R> clazz) {
|
||||
return mapPool.computeIfAbsent(clazz, tClass -> new GenericObjectPool<R>(new WideClassFactory(clazz)));
|
||||
}
|
||||
|
||||
@RequiredArgsConstructor
|
||||
private static class WideClassFactory<R extends Passivable> extends PassivablePooledObjectFactory<R> {
|
||||
private class WideClassFactory<R extends T> extends PassivablePooledObjectFactory<R> {
|
||||
|
||||
private final Class<R> clazz;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user