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 <denis.stepa...@gmail.com>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: dev-unsubscr...@tapestry.apache.org > For additional commands, e-mail: dev-h...@tapestry.apache.org > > -- Best regards, Igor Drobiazko http://tapestry5.de