Igor, problem is that it doesn't work how it should, it is hard to explain :) btw I can tell a difference between proxy and real instance.
see steps to reproduce it https://issues.apache.org/jira/browse/TAP5-1765 I hope nobody has an upload component in production, interrupted file upload and every component event throws an exception. :) Denis Nov 30, 2011 v 6:21 PM, Igor Drobiazko: > I'm sorry but I still don't get where the problem is. MultipartDecoder is > per-thread service; there is not problem with @Autobuild in the builder > method. UploadExceptionFilter holds the old instance because it holds the > proxy which delegates to per-thread instances of MultipartDecoderImpl. > > On Wed, Nov 30, 2011 at 2:56 PM, Denis Stepanov > <[email protected]>wrote: > >> There is no problem with the code, problem is that it doesn't work how it >> should since 5.3. MultipartDecoder is recreated I can see code beeing >> invoked but UploadExceptionFilter still has the old instance an it will >> throw an upload exception every component event. >> >> Problem it seems to be related to the using of Autobuild in a build >> method, if I replace it with a constructor call MultipartDecoder will >> became perthread again. >> >> Denis >> >> Nov 30, 2011 v 1:42 PM, Igor Drobiazko: >> >>> Hi, >>> >>> it works as expected. @Autobuild is a convenient way to invoke >>> ObjectLocator#autobuild. As mentioned in the Javadocs, autobuild >>> instantiates an object by invoking the public constructor with the most >>> parameters. No scopes are mentioned there. >>> >>> Because the buildMultipartDecoder is annotated >>> with @Scope(ScopeConstants.PERTHREAD), it's invoked for every new thread. >>> The consequence is that the injected MultipartDecoderImpl instance is >>> autobuild for every new request. >>> >>> I see no problems with that code. >>> >>> On Wed, Nov 30, 2011 at 1:27 PM, Denis Stepanov < >> [email protected]>wrote: >>> >>>> Hi, >>>> >>>> It seems that instance created with @Autobuild will have default scope, >>>> perthread is not honored at all, see folowing code from Upload project: >>>> >>>> @Scope(ScopeConstants.PERTHREAD) >>>> public static MultipartDecoder buildMultipartDecoder(PerthreadManager >>>> perthreadManager, >>>> >>>> >>>> RegistryShutdownHub shutdownHub, >>>> >>>> @Autobuild >>>> >>>> MultipartDecoderImpl multipartDecoder) >>>> { >>>> // This is proabably overkill since the FileCleaner should catch >>>> temporary files, but lets >>>> // be safe. >>>> perthreadManager.addThreadCleanupListener(multipartDecoder); >>>> >>>> if (needToAddShutdownListener.getAndSet(false)) >>>> { >>>> shutdownHub.addRegistryShutdownListener(new Runnable() >>>> { >>>> public void run() >>>> { >>>> FileCleaner.exitWhenFinished(); >>>> } >>>> }); >>>> } >>>> >>>> return multipartDecoder; >>>> } >>>> >>>> MultipartDecoder should be perthread but it isn't, if there is an upload >>>> exception every component event will throw that upload exception because >>>> service have not been recreated perthread. >>>> >>>> Everything start to work correctly when I change build method to not >> have >>>> the autobuild implementation. >>>> >>>> Denis >>>> >>>> >>>> >>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>>> >>> >>> >>> -- >>> Best regards, >>> >>> Igor Drobiazko >>> http://tapestry5.de >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >> > > > -- > Best regards, > > Igor Drobiazko > http://tapestry5.de
