[JBoss Seam] - Re: JBoss AS 4.2.2 & Seam shutdown exception
by msystems
| package com.mediatorsystems.workoutjournal.service;
|
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.international.LocaleSelector;
| import org.jboss.seam.annotations.*;
| import org.jboss.seam.log.Log;
|
| import javax.ejb.EJB;
| import javax.ejb.Remove;
| import javax.ejb.Stateful;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import javax.persistence.PersistenceContextType;
| import javax.persistence.Query;
| import java.util.List;
|
| /**
| * @author Kenneth Christensen
| * Copyright (c) 2006, 2007 Mediator Systems ApS. All rights reserved.
| */
| @Stateful
| @Name("commonBean")
| @Scope(ScopeType.SESSION)
| public class CommonBean implements CommonLocal {
| @Logger
| private Log log;
|
| @PersistenceContext(type = PersistenceContextType.EXTENDED)
| private EntityManager em;
|
| @In
| private LocaleSelector localeSelector;
|
| @EJB
| private UserLocal userBean;
|
| public boolean existByName(String queryName, String name) {
| Query query = em.createNamedQuery(queryName);
| query.setParameter("userId", userBean.getUserFromSession().getId())
| .setParameter("language", localeSelector.getLanguage())
| .setParameter("nameLowercase", name.toLowerCase());
|
| return (Long) query.getSingleResult() > 0;
| }
|
| public Object loadByName(String queryName, String name) {
| return em.createNamedQuery(queryName)
| .setParameter("name", name)
| .setParameter("nameLowercase", name.toLowerCase())
| .setParameter("userId", userBean.getUserFromSession().getId())
| .getSingleResult();
| }
|
| public Object[] findName(String queryPrefixName, boolean ownByUser, String prefix, Object category,
| int fetchDataSize, int pagingIndex) {
| log.debug("Prefix: #0 Category: #1 Fetch Data Size: #2 Paging Index: #3",
| prefix, category, fetchDataSize, pagingIndex);
|
| Query query;
| Object result[] = new Object[2];
|
| if (pagingIndex > -1) {
| StringBuffer queryName = new StringBuffer();
| queryName.append(queryPrefixName);
|
| if (category != null) {
| queryName.append(".countByLanguageAndCategoryAndName");
| if (ownByUser) {
| queryName.append("AndOwnByUser");
| }
|
| query = em.createNamedQuery(queryName.toString()).setParameter("category", category);
| } else {
| queryName.append(".countByLanguageAndName");
| if (ownByUser) {
| queryName.append("AndOwnByUser");
| }
|
| query = em.createNamedQuery(queryName.toString());
| }
|
| query.setParameter("userId", userBean.getUserFromSession().getId())
| .setParameter("language", localeSelector.getLanguage())
| .setParameter("nameLowercase",
| prefix.trim().length() > 0 ? prefix.toLowerCase() + "%" : prefix);
|
| result[0] = query.getSingleResult();
| } else {
| pagingIndex = 0;
| }
|
| StringBuffer queryName = new StringBuffer();
| queryName.append(queryPrefixName);
|
| if (category != null) {
| queryName.append(".findByLanguageAndCategoryAndName");
| if (ownByUser) {
| queryName.append("AndOwnByUser");
| }
|
| query = em.createNamedQuery(queryName.toString()).setParameter("category", category);
| } else {
| queryName.append(".findByLanguageAndName");
| if (ownByUser) {
| queryName.append("AndOwnByUser");
| }
|
| query = em.createNamedQuery(queryName.toString());
| }
|
| query.setParameter("userId", userBean.getUserFromSession().getId())
| .setParameter("language", localeSelector.getLanguage())
| .setParameter("nameLowercase",
| prefix.trim().length() > 0 ? prefix.toLowerCase() + "%" : prefix)
| .setFirstResult(fetchDataSize * pagingIndex)
| .setMaxResults(fetchDataSize);
|
| result[1] = query.getResultList();
|
| log.debug("Found #0 name(s) with prefix: #1 Category: #2",
| result[0] != null ? result[0] : ((List) result[1]).size(), prefix, category);
|
| return result;
| }
|
| public void detach() {
| em.clear();
| }
|
| @Remove @Destroy
| public void destroy() {
| }
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4100879#4100879
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4100879
17Â years, 2Â months
Expired Sessions Not Being Cleaned-Up
by Brandon Harper
Hello all,
While I've used Tomcat in the past, JBoss is still pretty new to me so
hopefully I'm going down the right path here with troubleshooting as
well as my questions.
My team is in the process of wrapping-up a new website implemented in
Apache Wicket 1.3b, Spring, and Hibernate. Each time a Wicket session
is initiated, it creates a new one under:
server/default/work/jboss.web/localhost/_/Website-filestore
Under this path a directory gets created with the id of each session,
of which each dir contains a file called pm-null.
The problem we're seeing is that nothing is cleaning-up the session
created directories once they have expired. Each session should
expire after an hour, yet I see sessions sticking around since over 5
days ago— even if the server has been stopped and restarted, runs for
days straight, gets new WAR's deployed, etc.
Being new to JBoss and after searching various mailing lists, etc, I'm
not finding much information about this. I also greped through all of
the JBoss config files but was unable to find anything of substance,
but most likely I missed something. Any suggestions on where to look
/ why I'm seeing this behavior?
Thanks,
- Brandon
--
http://bharper.com
http://devnulled.com
17Â years, 2Â months