struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4592) The ScopedModelDriven Interceptor is not thread safe ?
Date Tue, 19 Jan 2016 19:43:39 GMT

    [ https://issues.apache.org/jira/browse/WW-4592?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15107282#comment-15107282
] 

Lukasz Lenart commented on WW-4592:
-----------------------------------

Interceptors are singletons per stack which means if you want to use them for just one action
you will get another instance, separated one from any other instance of `ScopedModelDriven`

> The ScopedModelDriven Interceptor is not thread safe ?
> ------------------------------------------------------
>
>                 Key: WW-4592
>                 URL: https://issues.apache.org/jira/browse/WW-4592
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>            Reporter: Andrea Ligios
>             Fix For: 2.5.x
>
>
> Looking at the source code of the ScopedModelDriven Interceptor, I can see the following
variables scoped at class level:
> {code:java}
>      private String scope;
>      private String name;
>      private String className;
>      private ObjectFactory objectFactory;
> {code}
> https://github.com/apache/struts/blob/master/core/src/main/java/com/opensymphony/xwork2/interceptor/ScopedModelDrivenInterceptor.java#L85-L88
> AFAIK, this means they're not thread safe, since different requests could override those
variables altering the workflow of other threads.
> Even if it's not that easy for it to happen, it seems just wrong.
> And by the way, what's the problem on having those defined at method level, and settle
things once and for all ? 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message