[JBossCache] - LRU Eviction policy question
by darshanbildikar
Hello All,
I'm new to JBoss cache and sorry if this question has already been asked before. I tried to find answers on the list with no success.
My problem is like this:-
I want to configure my cache such that
1) It contains no more than 10K objects at any given time
2) An object remains in the cache (either in memory / PERSISTENT store) for MAX 200 seconds. It must be automatically REMOVED from the cache after 200 seconds lapse.
I am using an LRU eviction policy with a File cache loader. I have the following question.
My region configuration looks like this
10000
100
200
I assume that this means "Evict my object to persistent store if maxNodes > 10000 OR maxAgeSeconds > 200"
What I however want is: After 10000 entries any new entry it is serialized to the persistent store. However, after 200 seconds (irrespective of whether it's in the persistent store or in memory) it needs to be REMOVED from the cache. Is there a configuration that will help me do this?
I'm sorry if this question has been asked before. Appreciate any pointers.
BR
Darshan
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997159#3997159
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997159
17 years, 11 months
[JBoss jBPM] - A Bug or Newbie Error?
by gwzoller
Hello,
I was playing around learning jBPM and wrote a simple test program that gave me unexpected results. Process def and test code given below, but here's the problem in a nutshell. I have a task node "Collect Canditate Info" with 1 task that when complete transitions the node to the next task node "Check Background" which has 2 tasks. My sample program walks the process and prints the number and names of the tasks for these two nodes. The first node, Collect Candidate Info, is fine--1 task correctly named is shown.
But... after successfully transitioning to "Check Background" my program shows 3 tasks--the one left over from the previous node plus the 2 I expect to see in the now-current node. For some reason the previous task nodes tasks aren't getting cleared out.
I would expect that after moving to the next node the previous node's tasks should no longer be visible, or at least certainly not mixed in with the current nodes tasks.
Am I doing something wrong, or is my expectation of correct operation incomplete, or is this just an 'ol fashion bug?
I'm using the jbpm starters kit 3.1.2.
Thanks in advance for any replies!
Greg
Here's the process definition:
<?xml version="1.0" encoding="UTF-8"?>
<process-definition
xmlns="urn:jbpm.org:jpdl-3.1" name="Hire New Employee">
<start-state name="start">
</start-state>
<task-node name="Check Background">
</task-node>
<task-node name="Collect Candidate Info">
</task-node>
<task-node name="Interview Candidate">
</task-node>
<end-state name="Hire"></end-state>
<end-state name="Pass"></end-state>
</process-definition>
Here's the test program:
package com.sample;
import java.io.FileInputStream;
import junit.framework.TestCase;
import org.jbpm.graph.def.ProcessDefinition;
import org.jbpm.graph.exe.ProcessInstance;
import org.jbpm.taskmgmt.exe.TaskInstance;
public class GregsTest extends TestCase {
public void testSimpleProcess() throws Exception {
// Extract a process definition from the processdefinition.xml file.
FileInputStream fis = new FileInputStream("processes/Hire New Employee/processdefinition.xml");
ProcessDefinition processDefinition = ProcessDefinition.parseXmlInputStream(fis);
assertNotNull("Definition should not be null", processDefinition);
// Create an instance of the process definition.
ProcessInstance instance = new ProcessInstance(processDefinition);
assertEquals(
"Instance is in start state",
instance.getRootToken().getNode().getName(),
"start");
assertNull(
"Message variable should not exist yet",
instance.getContextInstance().getVariable("message"));
// Move the process instance from its start state to the first state.
// The configured action should execute and the appropriate message
// should appear in the message process variable.
instance.signal();
assertEquals(
"Collecting candidate information",
instance.getRootToken().getNode().getName(),
"Collect Candidate Info");
// Move the process instance to the end state. The configured action
// should execute again. The message variable contains a new value.
System.out.println("YYY: Number of Tasks in node is "
+ instance.getTaskMgmtInstance().getTaskInstances().size());
TaskInstance taskInstance = (TaskInstance)
instance.getTaskMgmtInstance().getTaskInstances().iterator().next();
System.out.println("ZZZ: Node Now is "+ instance.getRootToken().getNode().getName());
System.out.println("ZZZ: Task now is "+taskInstance.getName());
taskInstance.end();
System.out.println("ZZZ: Node Now is "+ instance.getRootToken().getNode().getName());
assertEquals(
"Instance is in Check Background state",
instance.getRootToken().getNode().getName(),
"Check Background");
System.out.println("YYY: Number of Tasks in node is "
+ instance.getTaskMgmtInstance().getTaskInstances().size());
java.util.Iterator taskScan = instance.getTaskMgmtInstance().getTaskInstances().iterator();
while(taskScan.hasNext()) {
TaskInstance aTask = (TaskInstance) taskScan.next();
// System.out.println("ZZZ: Node Now is "+ instance.getRootToken().getNode().getName());
System.out.println("ZZZ: Task now is "+aTask.getName());
//aTask.end();
}
}
}
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997150#3997150
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997150
17 years, 11 months