1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.netty.handler.execution;
17
18 import java.util.concurrent.Executor;
19
20 import org.jboss.netty.channel.ChannelEvent;
21 import org.jboss.netty.channel.ChannelHandlerContext;
22 import org.jboss.netty.util.EstimatableObjectWrapper;
23
24 public abstract class ChannelEventRunnable implements Runnable, EstimatableObjectWrapper {
25
26
27
28
29
30 protected static final ThreadLocal<Executor> PARENT = new ThreadLocal<Executor>();
31
32 protected final ChannelHandlerContext ctx;
33 protected final ChannelEvent e;
34 int estimatedSize;
35 private final Executor executor;
36
37
38
39
40
41 protected ChannelEventRunnable(ChannelHandlerContext ctx, ChannelEvent e, Executor executor) {
42 this.ctx = ctx;
43 this.e = e;
44 this.executor = executor;
45 }
46
47
48
49
50
51 public ChannelHandlerContext getContext() {
52 return ctx;
53 }
54
55
56
57
58 public ChannelEvent getEvent() {
59 return e;
60 }
61
62 public Object unwrap() {
63 return e;
64 }
65
66 public final void run() {
67 doRun();
68 }
69
70 protected abstract void doRun();
71 }