06-19-2012 12:39 PM
06-20-2012 03:16 AM
06-20-2012 12:47 PM
06-21-2012 04:24 AM
06-21-2012 04:50 AM
06-21-2012 05:14 AM
//assertTrue("Second complete() failed.", thread2.isSucceeded());
assertFalse("Second complete() didn't fail as expected. ", thread2.isSucceeded());
06-21-2012 03:34 PM
org.activiti.engine.ActivitiOptimisticLockingException: ExecutionEntity[5] was updated by another transaction concurrently
at org.activiti.engine.impl.db.DbSqlSession.flushUpdates(DbSqlSession.java:476)
at org.activiti.engine.impl.db.DbSqlSession.flush(DbSqlSession.java:372)
06-22-2012 10:22 AM
06-22-2012 10:45 AM
public class YourCompanyService {
private Set<String> processLocks = new HashSet<…>;
…
public boolean printTheCard(String cardIdentifier) {
// Correlate between card-id and task/process to use
String processId = runtimeService.createtaskQuery()……singleResult();
// JVM-wide lock for this specific use-case.
boolean isSafe = false;
synchronized(this) {
isSafe = processLocks.contains(processId);
if(isSafe) {
processLocks.add(processId);
}
}
if(!isSafe) {
throw new MyCompanyException("looks like you're too late…");
}
// important, release the lock in "finally"
try {
// Finish task
taskService……
….
}
finally
{
synchronized(this) {
processLocks.remove(processId);
}
}
}
}
06-22-2012 11:34 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.