cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe Baldwin <jfbald...@earthlink.net>
Subject Re: Memory Management using Tomcat
Date Thu, 17 Sep 2009 13:42:45 GMT
Michael,

I just checked my web.xml and it appears am using the same filter

<!-- Cayenne -->
  <context-param>
	 <param-name>cayenne.configuration.path</param-name>
	 <param-value>/WEB-INF/config/cayenne-files</param-value>
  </context-param>
  <filter>
	 <filter-name>CayenneFilter</filter-name>
	 <filter-class>org.apache.cayenne.conf.WebApplicationContextFilter</ 
filter-class>
  </filter>
  <filter-mapping>
	 <filter-name>CayenneFilter</filter-name>
	 <url-pattern>/*</url-pattern>
  </filter-mapping>

In the code I am accessing the BaseContext via the following call:
	ObjectContext oc = BaseContext.getThreadObjectContext();

So, unless I have misread, it appears we are using almost exactly the  
same code.

Questions:
1. I am not sure what you mean by "you could do a cast there".
2. Should I release this BaseContext and create a new one (as has been  
suggested) or should I simple rely on the BaseContext to manage the  
memory?
3. Is there some way to message the BaseContext to determine if it has  
properly released memory after a session is complete?

Thanks,
Joe





On Sep 17, 2009, at 9:18 AM, Michael Gentry wrote:

> Hi Joe,
>
> The fact that you are seeing a spike with 50-100 concurrent users
> doesn't surprise me.  After your sessions timeout, the memory usage
> goes back down.  This seems expected to me.
>
> As for my session-based filter, I'm pretty much using what Cayenne
> provides.  In my web.xml file for the servlet engine (Tomcat in your
> case), I have:
>
>    <filter>
>        <filter-name>Cayenne Filter</filter-name>
>        <filter- 
> class>org.apache.cayenne.conf.WebApplicationContextFilter</filter- 
> class>
>    </filter>
>    <filter-mapping>
>        <filter-name>Cayenne Filter</filter-name>
>        <url-pattern>/*</url-pattern>
>    </filter-mapping>
>
> To get your context after that:
>
>    private ObjectContext objectContext =  
> BaseContext.getThreadObjectContext();
>
> I think the filter actually creates a DataContext, so you could do a  
> cast there.
>


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message