Beanfactory in the server scope

5 views
Skip to first unread message

Justice

unread,
Sep 9, 2009, 8:45:31 AM9/9/09
to ColdSpring-Users
I am working on some existing code that makes use of a coldspring
beanfactory to handle dependancies. The code gets called many
different ways, some remote methods called, some cfinvoke calls, and
some with createObject. The issue arises when many of these requests
do not share an application scope name (or an application scope at
all). I would like to have only a single instance of the beanfactory,
so I attempted to load it into the server scope.

Everything seemed fine until I was running some test requests using
jmeter, and I tried to run a reload of the beanfactory at the same
time. I have readOnly locks around my method that returns the
beanfactory from the server scope, and my re-init method wraps the re-
create code in an exclusive lock. I got a coldspring error that looks
like:

Cache error, myBean already exists in cache

Can anyone offer some advice on how to structure the create / init /
getBeanFactory code such that the coldspring cache would get cleared
out and the factory re-created in the server scope without causing
beanfactory requests to error out ?

Tom Chiverton

unread,
Sep 9, 2009, 10:55:51 AM9/9/09
to coldspri...@googlegroups.com
2009/9/9 Justice <overr...@gmail.com>:

> Can anyone offer some advice on how to structure the create / init /
> getBeanFactory code such that the coldspring cache would get cleared
> out and the factory re-created in the server scope without causing
> beanfactory requests to error out ?

The brute force approach would be to use a single named lock around
create/init, and a read lock around each getBeanFactory.

--
Tom

Dan Wilson

unread,
Sep 9, 2009, 11:01:51 AM9/9/09
to coldspri...@googlegroups.com
Paste your factory creation code at http://coldspring.pastebin.com



DW
--
“Come to the edge, he said. They said: We are afraid. Come to the edge, he said. They came. He pushed them and they flew.”

Guillaume Apollinaire quotes

Tom Chiverton

unread,
Sep 9, 2009, 11:07:40 AM9/9/09
to coldspri...@googlegroups.com

Chris Peterson

unread,
Sep 9, 2009, 11:32:13 AM9/9/09
to coldspri...@googlegroups.com
Actually, after banging my head against it for a long time, I got the suggestion to check the version of coldspring, I downloaded the latest release from the site (1.2 stable) and bam its working perfectly now!

Thanks for the feedback and idea’s all, I think the code looks tight now!

Chris Peterson




On 9/9/09 11:01 AM, "Dan Wilson" <sipa...@gmail.com> wrote:

Reply all
Reply to author
Forward
0 new messages