<div dir="ltr">$BGO>lMM(B<div><br></div><div>$BAa!9$N$4JV?.$K$b$+$+$o$i$:!"$*Ni$,CY$l?=$7Lu$4$6$$$^$;$s!#(B</div><div>$B$465<x$$$?$@$-$^$7$?J}K!$K$F!"K\7o$N2]Bj$r%/%j%"$9$k$3$H$,$G$-$^$7$?!*(B</div><div>$B$"$j$,$H$&$4$6$$$^$7$?!#(B</div><div>$B$H$F$b=u$+$j$^$7$?!#(B</div><div><br></div><div>$B:#8e$H$b$h$m$7$/$*4j$$$$$?$7$^$9!#(B</div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013$BG/(B11$B7n(B27$BF|(B 12:34 Yasuyuki BABA <span dir="ltr"><<a href="mailto:yasuyuki.baba@gmail.com" target="_blank">yasuyuki.baba@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
$B$3$s$K$A$O!"GO>l$G$9!#(B<br>
<br>
$B0J2<$N$h$&$J(B ThreadContext $B$r%/%j%"$9$k%j%9%J$rEPO?$9$k$3$H$G2r>C$9$k$H;W$$$^$9!#(B<br>
$B%W%i%0%$%s$@$H%U%)%o!<%I$9$k$H$-$K$&$^$/F0$+$J$$$+$b$7$l$J$$$G$9!#(B<br>
<br>
$B$A$g$C$H%o!<%/%"%i%&%s%IE*$JJ}K!$J$N$H!"$-$A$s$H8!>Z$G$-$F$$$J$$$N$G?=$7Lu$"$j$^$;$s!#(B<br>
$B$*;n$7$$$?$@$1$l$P$H;W$$$^$9!#(B<br>
<br>
---------------<br>
import java.lang.reflect.Field;<br>
<br>
import javax.servlet.ServletRequestEvent;<br>
import javax.servlet.ServletRequestListener;<br>
<br>
import org.seasar.cubby.internal.controller.ThreadContext;<br>
import org.seasar.framework.util.ClassUtil;<br>
import org.seasar.framework.util.FieldUtil;<br>
<br>
public class ThreadContextListener implements ServletRequestListener {<br>
<br>
private static ThreadLocal<ThreadContext> PREVIOUS = getPrevious();<br>
<br>
private static ThreadLocal<ThreadContext> getPrevious() {<br>
Field field = ClassUtil.getDeclaredField(ThreadContext.class,<br>
"PREVIOUS");<br>
field.setAccessible(true);<br>
@SuppressWarnings("unchecked")<br>
ThreadLocal<ThreadContext> tl = (ThreadLocal<ThreadContext>)<br>
FieldUtil.get(field, null);<br>
return tl;<br>
}<br>
<br>
public void requestInitialized(ServletRequestEvent sre) {<br>
}<br>
<br>
public void requestDestroyed(ServletRequestEvent sre) {<br>
ThreadContext.remove();<br>
PREVIOUS.remove();<br>
}<br>
}<br>
---------------<br>
<br>
2013$BG/(B11$B7n(B26$BF|(B 21:21 $B$O$C$7$#(B <<a href="mailto:hasuie@gmail.com">hasuie@gmail.com</a>>:<br>
<div><div class="h5">> $B$*@$OC$K$J$j$^$9!#$O$C$7$#$H?=$7$^$9!#(B<br>
><br>
> $BI=Bj$N$H$*$j!"(BTomcat7 $BDd;_;~$K0J2<$N$h$&$J%9%l%C%I%m!<%+%k$N%a%b%j%j!<%/%(%i!<$,%m%0=PNO$5$l$k$N$r2sHr$7$?$$$N$G$9$,!"2?$+<j$O$J$$$G$7$g$&$+!)(B<br>
><br>
> $B=EBg(B: A web application created a ThreadLocal with key of type<br>
> [java.lang.ThreadLocal] (value [java.lang.ThreadLocal@543e51ed]) and a value<br>
> of type [org.seasar.cubby.internal.controller.ThreadContext] (value<br>
> [org.seasar.cubby.internal.controller.ThreadContext@3605435c]) but failed to<br>
> remove it when<br>
> the web application was stopped. To prevent a memory leak, the ThreadLocal<br>
> has been forcibly removed.<br>
><br>
> $B<+A0$G;HMQ$7$F$$$k(BThreadLocal$BJQ?t$O!"(BAbstractPlugin#invokeActionResult<br>
> $B$K$F!"%/%j%"$7$F$$$^$9$,!"%U%l!<%`%o!<%/$N(B ThreadContext<br>
> $B$N%/%j%"Ey$,%"%W%j%1!<%7%g%sB&$G2DG=$G$"$l$P!"$465<x$7$F$$$?$@$1$k$H!"$3$A$i$GBP1~2DG=$J$N$G$9$,!&!&!&!#(B<br>
><br>
> $B0J>e$h$m$7$/$*4j$$$$$?$7$^$9!#(B<br>
><br>
</div></div>> _______________________________________________<br>
> cubby-user mailing list<br>
> <a href="mailto:cubby-user@ml.seasar.org">cubby-user@ml.seasar.org</a><br>
> <a href="https://ml.seasar.org/mailman/listinfo/cubby-user" target="_blank">https://ml.seasar.org/mailman/listinfo/cubby-user</a><br>
><br>
<span class="HOEnZb"><font color="#888888"><br>
<br>
<br>
--<br>
BABA,Yasuyuki<br>
<a href="mailto:yasuyuki.baba@gmail.com">yasuyuki.baba@gmail.com</a><br>
_______________________________________________<br>
cubby-user mailing list<br>
<a href="mailto:cubby-user@ml.seasar.org">cubby-user@ml.seasar.org</a><br>
<a href="https://ml.seasar.org/mailman/listinfo/cubby-user" target="_blank">https://ml.seasar.org/mailman/listinfo/cubby-user</a><br>
</font></span></blockquote></div><br></div></div>