Fixed memory leak in OrderedMemoryAwareThreadPoolExecutor
This commit is contained in:
parent
967bd4d06d
commit
5cd9b6722a
@ -30,10 +30,8 @@ import java.util.concurrent.TimeUnit;
|
|||||||
|
|
||||||
import org.jboss.netty.channel.Channel;
|
import org.jboss.netty.channel.Channel;
|
||||||
import org.jboss.netty.channel.ChannelEvent;
|
import org.jboss.netty.channel.ChannelEvent;
|
||||||
import org.jboss.netty.channel.ChannelState;
|
|
||||||
import org.jboss.netty.channel.ChannelStateEvent;
|
|
||||||
import org.jboss.netty.util.ObjectSizeEstimator;
|
import org.jboss.netty.util.ObjectSizeEstimator;
|
||||||
import org.jboss.netty.util.internal.ConcurrentIdentityHashMap;
|
import org.jboss.netty.util.internal.ConcurrentIdentityWeakKeyHashMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A {@link MemoryAwareThreadPoolExecutor} which maintains the
|
* A {@link MemoryAwareThreadPoolExecutor} which maintains the
|
||||||
@ -71,7 +69,7 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
|
|||||||
MemoryAwareThreadPoolExecutor {
|
MemoryAwareThreadPoolExecutor {
|
||||||
|
|
||||||
private final ConcurrentMap<Channel, Executor> childExecutors =
|
private final ConcurrentMap<Channel, Executor> childExecutors =
|
||||||
new ConcurrentIdentityHashMap<Channel, Executor>();
|
new ConcurrentIdentityWeakKeyHashMap<Channel, Executor>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new instance.
|
* Creates a new instance.
|
||||||
@ -169,15 +167,6 @@ public class OrderedMemoryAwareThreadPoolExecutor extends
|
|||||||
executor = oldExecutor;
|
executor = oldExecutor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the entry when the channel closes.
|
|
||||||
if (e instanceof ChannelStateEvent) {
|
|
||||||
ChannelStateEvent se = (ChannelStateEvent) e;
|
|
||||||
if (se.getState() == ChannelState.OPEN &&
|
|
||||||
!channel.isOpen()) {
|
|
||||||
childExecutors.remove(channel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return executor;
|
return executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user