cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: ServerRuntime Best Practice? [3.1]
Date Thu, 28 Feb 2013 18:20:35 GMT
ServerRuntime is the "root" object of Cayenne. So there's no other place to store it as far
as Cayenne is concerned and this is by design. 

The whole point of the recent Cayenne evolution was to make Cayenne 100% embeddable and manageable
in any environment. Introducing a static singleton in Cayenne (not in your code) is contrary
to that goal.

Andrus

On Feb 28, 2013, at 9:10 PM, Michael Gentry <mgentry@masslight.net> wrote:

> Hi Andrus,
> 
> I thought about using the ServletContext, but that felt a bit "dirty", so
> I'll probably create a singleton to store the runtime.  I just thought
> maybe there was already a place in 3.1 that I didn't see for the most
> common case where you only have one runtime to save.
> 
> Thanks,
> 
> mrg
> 
> 
> On Thu, Feb 28, 2013 at 12:45 PM, Andrus Adamchik <andrus@objectstyle.org>wrote:
> 
>> Either your own singleton, or ServletContext. ServletContext is
>> essentially a designated place for app-scoped objects in a webapp.
>> 
>> Of course if you have Tapestry or Spring (that are themselves internally
>> attached to ServletContext), you can use those for ServerRuntime access via
>> injection.
>> 
>> Andrus
>> 
>> On Feb 28, 2013, at 5:43 PM, Michael Gentry <mgentry@masslight.net> wrote:
>> 
>>> Is there an existing place (class) in 3.1 to stuff a ServerRuntime
>> instance
>>> for global use or is it expected that you'll create a separate class to
>>> hold a static instance variable of ServerRuntime?
>>> 
>>> Thanks,
>>> 
>>> mrg
>> 
>> 


Mime
View raw message