struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Phil Adams <padam...@gmail.com>
Subject Re: Struts2 threading in a Java EE application server environment
Date Tue, 19 Oct 2010 03:58:31 GMT
Specifically, the thread context information placed on the original
thread by the servlet container that provides the J2EE name associated
with the webapp and component, etc.   This information is (as far as I
know) specific to the servlet container implementation and is not
portable in any way, so I would be surprised if struts2 was able to
copy it from the original thread to the new thread in any reliable
way.

In the webapp that has this problem, I see this in the web.xml:

	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

Does the StrutsPrepareAndExecuteFilter, in fact, create a new thread
on which it invokes the action's "execute()" method?
It certainly seems that way, as here is a partial stacktrace on which
the action class is invoked:

	com.my.package.MyActionClass.execute(MyActionClass:100)
	sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	java.lang.reflect.Method.invoke(Method.java:600)
	com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
	com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
	org.apache.struts2.interceptor.BackgroundProcess$1.run(BackgroundProcess.java:57)
	java.lang.Thread.run(Thread.java:736)


On Mon, Oct 18, 2010 at 10:40 PM, Dave Newton <davelnewton@gmail.com> wrote:
> What information is missing?
>
> Dave
>
> On Mon, Oct 18, 2010 at 11:34 PM, Phil Adams <padamstx@gmail.com> wrote:
>> Hi,
>> I'm trying to help a customer that is using Struts2 within a Java
>> EE-compliant application server.  Unfortunately, I have no real
>> experience with Struts2 so I was hoping someone on this mailing list
>> could offer some help.
>>
>> The main issue that I'm dealing with is this...   An HTTP request is
>> received by the app server's servlet container and struts2 is invoking an
>> action class's "execute()" method, but it appears to be doing this on
>> a "new" thread (i.e. a thread other than the servlet container's
>> "worker" thread).
>>
>> First of all, is this normal and expected?   If so, is it controllable
>> by the user via some sort of configuration?      Also, how does the
>> struts2 framework deal with thread context information?
>> Specifically, when creating new threads in a Java EE environment, the
>> thread context information needs to be copied from the original thread
>> to the new thread, otherwise various Java EE components will have
>> unpredictable results.
>>
>> Thanks in advance for any help!
>>
>> --
>> Phil Adams
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
Phil Adams
Cedar Park, TX

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message