[JBossCache] - Re: What is the relation between in-memory nodes and nodes i
by manik.surtani@jboss.com
"sg283" wrote : Please confirm if I understand this correctly:-
| 1- Suppose I have defined maxNodes in region X to be 4500, and my application tries to put 1000 more nodes in region X then there would be 5500 nodes in total; 4500 in region X and 1000 nodes in region _default_. All 4500 nodes in region X would be evicted as per eviction defined in region X and all 1000 nodes in region _default_ would be evicted by the eviction time defined in region _default_.
|
This is wrong.
A region is just a subtree. So if you have a region defined as /a/b/c, anything you put under /a/b/c is counted towards the number of nodes in the region (e.g., /a/b/c/d or /a/b/c/e or even /a/b/c/d/e/f/g).
If you have > MaxNodes nodes in the region, they will still exist in the DB, just not in memory.
Your ideas around eviction are all wrong as well. Only nodes exceeding MaxNodes are evicted.
"sg283" wrote :
| 2- If I have tree cache nodes a,b, and c , a being the root node and c being the leaf node and b being the intemediate node, suppose for some reason, node a and c are in region X and node b is in region _default_.
| Eviction time in region X is 10 minutes and in _default_ is 5 minutes.
| If node b expires after 5 minutes, what would happen to node c? Would node c be lost?
|
No - eviction only REMOVES a node if it doesn't have any children. If a node has children it just empties all the data in the node, marks it as uninitialized, but keeps the node as it has a structural role to play.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085030#4085030
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085030
18 years, 9 months
[JBoss Seam] - Batch removing, conversations and transactions managment
by v.masterov@gmail.com
I have a question concerning batch entity deletion. I need to delete multiple entities at once, while some of them have references to other entities. When I try to delete a group of entities without any references, the operation is successful. But if at least one of the entities in the batch has references, the transaction is rolled back entirely. What I am trying to do is to delete all the entities without references, while the others (entites in the batch with references) can be left unchanged. I am trying to delete entities using separate transactions for each entity, but still fail. JBoss Seam tutorial mentions manual transaction management through conversation management (using the annotations @Begin(flushMode = FlushModeType.MANUAL) and @End).
I am trying to perform deletion using the two beans. The first bean implies cycle iteration with all ids and EntityManager is not injected into this bean. A separate deletion is performed within the second bean, this one injects EntityManager. It is not clear how to manage conversations. Both beans are conversation beans. After the first iteration the first bean is performed in the conversation context declared in the second bean, i.e. "join = true". If I declare "join = false" the first iteration returns exception:"java.lang.IllegalStateException: begin method invoked from a long running conversation, try using @Begin(join=true) on method: remove". With "join = true" each next iteration is performed within the same conversation, and as far as I understand in the same transaction. This results in entire rollback of all deletion operations. Please, help me !!! What is the right way to do this ?
| import java.util.*;
| import org.jboss.seam.Component;
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.*;
| import org.jboss.seam.contexts.Contexts;
| import org.jboss.seam.core.Conversation;
| import org.jboss.seam.log.Log;
|
| @Name("entityGroupRemover")
| @Scope(ScopeType.CONVERSATION)
| public class EntityGroupRemover {
|
|
| @Create
| @Begin(id = "groupRemoverConversation", join = true)
| public void remove(Long[] ids, Class entityClass) {
| for (int i = 0; i < ids.length; i++) {
| try {
| log.info("conversationId = " + Conversation.instance().getId());
| SingleEntityRemover remover = (SingleEntityRemover)Component.getInstance("singleEntityRemover",
| ScopeType.CONVERSATION, true);
| remover.removeSingleEntity(ids, entityClass);
| remover.commit();
| } catch(Exception e) {
| e.printStackTrace();
| }
| }
| Conversation.instance().end(true);
| }
|
|
| }
|
| import javax.persistence.EntityManager;
| import org.jboss.seam.ScopeType;
| import org.jboss.seam.annotations.*;
| import org.jboss.seam.contexts.Contexts;
| import org.jboss.seam.core.Conversation;
| import org.jboss.seam.core.Messages;
| import org.jboss.seam.log.Log;
|
| @Name("singleEntityRemover")
| @Scope(ScopeType.CONVERSATION)
| public class SingleEntityRemover {
|
| @Logger
| Log log;
|
| @In(value = "entityManager")
| EntityManager em;
|
| @Begin(id = "singleRemoverConversation", flushMode = FlushModeType.MANUAL, join = false, nested = true)
| public void removeSingleEntity(Long id, Class entityClass) {
| log.info("conversationId = " + Conversation.instance().getId());
| Object entity = em.find(entityClass, id);
| em.remove(entity);
| }
|
| @End
| public void commit() throws Exception {
| try {
| em.flush();
| log.info("transaction successed !!!");
| } catch(Exception e) {
| log.info("transaction failed !!!");
| throw e;
| }
| }
|
| }
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085027#4085027
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085027
18 years, 9 months
[Management, JMX/JBoss] - Problem in web-console (HTTP 500)
by andber
web-console -> J2EE domains -> jboss.management.local -> JBOSS -> myapp.ear -> myejbmodule.jar -> MyBean
Clicking on "MyBean" gives this error in the right frame of the browser:
javax.servlet.jsp.JspTagException: org.jboss.mx.util.MBeanProxyCreationException: Object name jboss.j2ee:jndiName=MyBean,service=EJB not found: javax.management.InstanceNotFoundException: jboss.j2ee:jndiName=MyBean,service=EJB is not registered.
org.jboss.console.plugins.helpers.servlet.MBeanTag.doStartTag(MBeanTag.java:95)
org.apache.jsp.StatelessEjb_jsp._jspService(StatelessEjb_jsp.java:110)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
Any ideas?
Thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4085023#4085023
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4085023
18 years, 9 months