You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jamie Orchard-Hays <ja...@dang.com> on 2004/10/27 18:39:41 UTC

clearing cache from application extension

I've got an application extension that loads a bunch of properties on 
startup. It has listeners that reset items when a message is sent. However, 
I need a way to reset the cache in Tapestry once this is done so its cached 
resources are cleared. AbstractEngine has clearCachedData(), which should 
work, but I don't see a way to access the engine from the extension.

Thanks,

Jamie 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: referencing the engine from an extension

Posted by Jamie Orchard-Hays <ja...@dang.com>.
you're right on both counts.

Haven't gotten the answer to the last question yet.


On Oct 27, 2004, at 9:11 PM, Erik Hatcher wrote:

> On Oct 27, 2004, at 5:18 PM, Jamie Orchard-Hays wrote:
>> 1. An extension is defined in the .application file, but where in the  
>> code is it attached to the engine?
>
> It is attached to the ApplicationSpecification (via  
> LibrarySpecification), not the engine.  Extensions are  
> application-centric.  Engines are not.
>
>> 2. Is there a way to insert a reference to the engine into the  
>> extension?
>
> That doesn't really make sense.  Engines either come from a pool or  
> are attached to a session if one has been started.  The lifecycles are  
> not the same between extensions and engines.
>
> You're on the wrong path here with your search for why (custom)  
> message resources are not being cleared.  I'm interested to learn what  
> the issue is, though, as I'm the one that created that custom  
> implementation :)
>
> 	Erik
>
>
>>
>> Thanks,
>>
>> Jamie
>> ----- Original Message ----- From: "Bryan Lewis" <br...@maine.rr.com>
>> To: "Tapestry users" <ta...@jakarta.apache.org>
>> Sent: Wednesday, October 27, 2004 2:54 PM
>> Subject: Re: clearing cache from application extension
>>
>>
>>> I had a similar desire.  I worked around it by keeping a static list  
>>> of all
>>> the engine instances in my custom Engine class.
>>>
>>>    private static transient List allEngines;
>>>
>>>    protected Object createVisit(IRequestCycle cycle)
>>>    {
>>>        // Remember this engine in the allEngines list.
>>>        if (allEngines == null) {
>>>            allEngines = new ArrayList();
>>>        }
>>>        allEngines.add(this);
>>>    }
>>>
>>>    public static void clearCaches()
>>>    {
>>>        if (allEngines == null) return;
>>>        for (Iterator it = allEngines.iterator(); it.hasNext(); ) {
>>>            Engine engine = (Engine) it.next();
>>>            engine.clearCachedData();
>>>        }
>>>    }
>>>
>>>
>>>
>>>
>>> ----- Original Message ----- From: "Jamie Orchard-Hays"  
>>> <ja...@dang.com>
>>> To: "Tapestry users" <ta...@jakarta.apache.org>
>>> Sent: Wednesday, October 27, 2004 12:39 PM
>>> Subject: clearing cache from application extension
>>>
>>>
>>>> I've got an application extension that loads a bunch of properties  
>>>> on
>>>> startup. It has listeners that reset items when a message is sent.
>>> However,
>>>> I need a way to reset the cache in Tapestry once this is done so its
>>> cached
>>>> resources are cleared. AbstractEngine has clearCachedData(), which  
>>>> should
>>>> work, but I don't see a way to access the engine from the extension.
>>>>
>>>> Thanks,
>>>>
>>>> Jamie
>>>>
>>>>
>>>> -------------------------------------------------------------------- 
>>>> -
>>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail:  
>>>> tapestry-user-help@jakarta.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail:  
>>> tapestry-user-help@jakarta.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: referencing the engine from an extension

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Oct 27, 2004, at 5:18 PM, Jamie Orchard-Hays wrote:
> 1. An extension is defined in the .application file, but where in the 
> code is it attached to the engine?

It is attached to the ApplicationSpecification (via 
LibrarySpecification), not the engine.  Extensions are 
application-centric.  Engines are not.

> 2. Is there a way to insert a reference to the engine into the 
> extension?

That doesn't really make sense.  Engines either come from a pool or are 
attached to a session if one has been started.  The lifecycles are not 
the same between extensions and engines.

You're on the wrong path here with your search for why (custom) message 
resources are not being cleared.  I'm interested to learn what the 
issue is, though, as I'm the one that created that custom 
implementation :)

	Erik


>
> Thanks,
>
> Jamie
> ----- Original Message ----- From: "Bryan Lewis" <br...@maine.rr.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, October 27, 2004 2:54 PM
> Subject: Re: clearing cache from application extension
>
>
>> I had a similar desire.  I worked around it by keeping a static list 
>> of all
>> the engine instances in my custom Engine class.
>>
>>    private static transient List allEngines;
>>
>>    protected Object createVisit(IRequestCycle cycle)
>>    {
>>        // Remember this engine in the allEngines list.
>>        if (allEngines == null) {
>>            allEngines = new ArrayList();
>>        }
>>        allEngines.add(this);
>>    }
>>
>>    public static void clearCaches()
>>    {
>>        if (allEngines == null) return;
>>        for (Iterator it = allEngines.iterator(); it.hasNext(); ) {
>>            Engine engine = (Engine) it.next();
>>            engine.clearCachedData();
>>        }
>>    }
>>
>>
>>
>>
>> ----- Original Message ----- From: "Jamie Orchard-Hays" 
>> <ja...@dang.com>
>> To: "Tapestry users" <ta...@jakarta.apache.org>
>> Sent: Wednesday, October 27, 2004 12:39 PM
>> Subject: clearing cache from application extension
>>
>>
>>> I've got an application extension that loads a bunch of properties on
>>> startup. It has listeners that reset items when a message is sent.
>> However,
>>> I need a way to reset the cache in Tapestry once this is done so its
>> cached
>>> resources are cleared. AbstractEngine has clearCachedData(), which 
>>> should
>>> work, but I don't see a way to access the engine from the extension.
>>>
>>> Thanks,
>>>
>>> Jamie
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>>> For additional commands, e-mail: 
>>> tapestry-user-help@jakarta.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


referencing the engine from an extension

Posted by Jamie Orchard-Hays <ja...@dang.com>.
Let me ask my question in a different way:

1. An extension is defined in the .application file, but where in the code 
is it attached to the engine?

2. Is there a way to insert a reference to the engine into the extension?

Thanks,

Jamie
----- Original Message ----- 
From: "Bryan Lewis" <br...@maine.rr.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, October 27, 2004 2:54 PM
Subject: Re: clearing cache from application extension


>I had a similar desire.  I worked around it by keeping a static list of all
> the engine instances in my custom Engine class.
>
>    private static transient List allEngines;
>
>    protected Object createVisit(IRequestCycle cycle)
>    {
>        // Remember this engine in the allEngines list.
>        if (allEngines == null) {
>            allEngines = new ArrayList();
>        }
>        allEngines.add(this);
>    }
>
>    public static void clearCaches()
>    {
>        if (allEngines == null) return;
>        for (Iterator it = allEngines.iterator(); it.hasNext(); ) {
>            Engine engine = (Engine) it.next();
>            engine.clearCachedData();
>        }
>    }
>
>
>
>
> ----- Original Message ----- 
> From: "Jamie Orchard-Hays" <ja...@dang.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Wednesday, October 27, 2004 12:39 PM
> Subject: clearing cache from application extension
>
>
>> I've got an application extension that loads a bunch of properties on
>> startup. It has listeners that reset items when a message is sent.
> However,
>> I need a way to reset the cache in Tapestry once this is done so its
> cached
>> resources are cleared. AbstractEngine has clearCachedData(), which should
>> work, but I don't see a way to access the engine from the extension.
>>
>> Thanks,
>>
>> Jamie
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: clearing cache from application extension

Posted by Bryan Lewis <br...@maine.rr.com>.
I had a similar desire.  I worked around it by keeping a static list of all
the engine instances in my custom Engine class.

    private static transient List allEngines;

    protected Object createVisit(IRequestCycle cycle)
    {
        // Remember this engine in the allEngines list.
        if (allEngines == null) {
            allEngines = new ArrayList();
        }
        allEngines.add(this);
    }

    public static void clearCaches()
    {
        if (allEngines == null) return;
        for (Iterator it = allEngines.iterator(); it.hasNext(); ) {
            Engine engine = (Engine) it.next();
            engine.clearCachedData();
        }
    }




----- Original Message ----- 
From: "Jamie Orchard-Hays" <ja...@dang.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Wednesday, October 27, 2004 12:39 PM
Subject: clearing cache from application extension


> I've got an application extension that loads a bunch of properties on
> startup. It has listeners that reset items when a message is sent.
However,
> I need a way to reset the cache in Tapestry once this is done so its
cached
> resources are cleared. AbstractEngine has clearCachedData(), which should
> work, but I don't see a way to access the engine from the extension.
>
> Thanks,
>
> Jamie
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org