[JBoss Seam] - Re: EntityQuery.refresh() doesn't clear the result list??
by ASavitsky
Indeed, it does :(
Tracing code in ManagedEntityIdentityInterceptor:
private static final Log log = LogFactory.getLog(ManagedEntityIdentityInterceptor.class);
| private void getFromWrapper(Object bean, Field field, Object dataModel)
| throws Exception {
| Object value = Contexts.getConversationContext().get(getFieldId(field));
| if (value != null) {
| if (dataModel == null) {
| if (field.getName().equals("resultList"))
| log.warn("getFromWrapper: "
| + bean.getClass().getSimpleName() + "."
| + field.getName() + " = " + value);
| Reflections.set(field, bean, value);
| } else {
| setWrappedData(dataModel, value);
| }
| }
| }
| private void saveWrapper(Object bean, Field field, Object dataModel,
| Object value) throws Exception {
| if (field.getName().equals("resultList"))
| log.warn("saveWrapper: conversation." + getFieldId(field) + " = "
| + value);
| Contexts.getConversationContext().set(getFieldId(field), value);
| if (dataModel == null) {
| if (field.getName().equals("resultList"))
| log.warn("saveWrapper: " + bean.getClass().getSimpleName()
| + "." + field.getName() + " = null");
| Reflections.set(field, bean, null);
| } else {
| setWrappedData(dataModel, null);
| }
| }
|
Tracing in EntityQuery:
private void initResultList() {
| if (getEjbql() != null && getEjbql().startsWith("FROM Account")) {
| log.warn("Entered initResultList: hashcode " + this.hashCode()
| + ", list = " + resultList);
| }
| if (resultList == null) {
| javax.persistence.Query query = createQuery();
| resultList = query == null ? null : query.getResultList();
| }
| if (getEjbql() != null && getEjbql().startsWith("FROM Account")) {
| log.warn("Exited initResultList: hashcode " + this.hashCode()
| + ", list = " + resultList);
| }
| }
| @Transactional
| @Override
| public List getResultList() {
| if (getEjbql() != null && getEjbql().startsWith("FROM Account")) {
| log.warn("Entered getResultList: hashcode " + this.hashCode()
| + ", list = " + resultList);
| }
| if (isAnyParameterDirty()) {
| refresh();
| }
| initResultList();
| try {
| return truncResultList(resultList);
| } finally {
| if (getEjbql() != null && getEjbql().startsWith("FROM Account")) {
| log.warn("Exited getResultList: hashcode " + this.hashCode()
| + ", list = " + resultList);
| }
| }
| }
| @Override
| public void refresh() {
| if (getEjbql() != null && getEjbql().startsWith("FROM Account")) {
| log.warn("Entered refresh: hashcode " + this.hashCode()
| + ", list = " + resultList);
| }
| super.refresh();
| resultCount = null;
| resultList = null;
| singleResult = null;
| if (getEjbql() != null && getEjbql().startsWith("FROM Account")) {
| log.warn("Exited refresh: hashcode " + this.hashCode()
| + ", list = " + resultList);
| }
| }
|
Tracing in AccountController (my code):
@Transactional
| public void save() {
| log.warn("save: before persist");
| em.persist(selectedAccount);
| log.warn("save: before flush");
| em.flush();
| selectedAccount = null;
| log.warn("save: before refresh");
| userAccounts.refresh();
| log.warn("save: after refresh");
| }
|
Log output on new record insert (resultList is supposed to go from one item to two):
WARN [com.tdam.ptss.controller.AccountController] - save: before persist
| Hibernate: select SEQ_ACCOUNT.nextval from dual
| WARN [com.tdam.ptss.controller.AccountController] - save: before flush
| Hibernate: insert into Account (CREATED_BY, CREATED_ON, MODIFIED_BY, MODIFIED_ON, ACCOUNT_NUMBER, closed, DEALER_NAME, discretionary, FAMILY_EXEMPTION, NAME_ON_STATEMENT, USER_ID, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
| WARN [com.tdam.ptss.controller.AccountController] - save: before refresh
| WARN [org.jboss.seam.persistence.ManagedEntityIdentityInterceptor] - getFromWrapper: EntityQuery.resultList = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Entered refresh: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Exited refresh: hashcode 27469166, list = null
| WARN [com.tdam.ptss.controller.AccountController] - save: after refresh
| WARN [org.jboss.seam.persistence.ManagedEntityIdentityInterceptor] - getFromWrapper: EntityQuery.resultList = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Entered getResultList: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Entered initResultList: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Exited initResultList: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Exited getResultList: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.persistence.ManagedEntityIdentityInterceptor] - saveWrapper: conversation.userAccounts.resultList = [Account[87]]
| WARN [org.jboss.seam.persistence.ManagedEntityIdentityInterceptor] - saveWrapper: EntityQuery.resultList = null
| WARN [org.jboss.seam.persistence.ManagedEntityIdentityInterceptor] - getFromWrapper: EntityQuery.resultList = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Entered getResultList: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Entered initResultList: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Exited initResultList: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.framework.EntityQuery] - Exited getResultList: hashcode 27469166, list = [Account[87]]
| WARN [org.jboss.seam.persistence.ManagedEntityIdentityInterceptor] - saveWrapper: conversation.userAccounts.resultList = [Account[87]]
| WARN [org.jboss.seam.persistence.ManagedEntityIdentityInterceptor] - saveWrapper: EntityQuery.resultList = null
|
Indeed, it does gets reset to old value right after I try to set it to null, and, as it uses reflection, it's no wonder why debugger wasn't catching it :(.
Now, is that considered to be the normal behavior (in which case - are there any ways to disable this interception?), or is this a bug (in which case I'll submit it to JIRA)?
Thanks,
Alex
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066216#4066216
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066216
18Â years, 9Â months
[Messaging, JMS & JBossMQ] - OutOfMemory because of too many threads and not sure what to
by zooxmusic
Hi all,
I have a problem that I am not quite sure how to solve and if it is something obvious please accept my apology early.
We are using durable topic JMS clients on a wireless network that drops out periodically and because of this they do not close all connections/threads gracefully
when we try to reconnect we get "Client Id is already registered" as we should
the problem is that every time this client tries to connect even though they receive this exception it is still creating 4 threads per occurrence.
with 180 clients quite a few have over 300 threads allocated to them and they still aren't connected which drops JBoss once we run out of memory
What can I do?
Is there anyway to detect a broken connection on the server side and kill the threads?
I am almost thinking that this architecture doesn't fit what we need to do since they do drop out and we definitely need a durable topic.
Brian
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4066214#4066214
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4066214
18Â years, 9Â months