Hi,
I get this error - any help on this?
This is the code that is causing the exception:
package test;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;
import com.orientechnologies.orient.core.sql.query.OSQLSynchQuery;
import com.orientechnologies.orient.object.db.OObjectDatabaseTx;
public class CustomerTest3 {
int corePoolSize = 2;
int maxPoolSize = 3;
long keepAliveTime = 500;
public OObjectDatabaseTx db = new OObjectDatabaseTx(
"plocal:c:/java/dbs/person").open("admin", "admin");
public ExecutorService threadPoolExecutor = new ThreadPoolExecutor(
corePoolSize,
maxPoolSize,
keepAliveTime,
TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>()
);
public CustomerTest3() {
}
public static void main(String[] args) {
CustomerTest3 ct3 = new CustomerTest3();
ct3.db.getEntityManager().registerEntityClasses("test");
Future f1 = ct3.threadPoolExecutor.submit(new FutureTask<String>(
new Callable<String>()
{
public String call() {
ct3.updateCust3();
return "done";
}
}));
Future f2 = ct3.threadPoolExecutor.submit(new FutureTask<String>(
new Callable<String>()
{
public String call() {
ct3.updateCust4();
return "done";
}
}));
// try {
// if (f1.get().equals("done") && f1.get().equals("done"))
// ct3.db.close();
// } catch (InterruptedException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// } catch (ExecutionException e) {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
}
private void updateCust3() {
List<Customer> result = db.query(new OSQLSynchQuery<Customer>(
"select * from Customer where address.city like '%98%'"));
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");
for (Customer p : result) {
//db.begin();
p.setName("updated name " + sdf.format(new
Date(System.currentTimeMillis())));
System.out.println(sdf.format(new
Date(System.currentTimeMillis())));
System.out.println(p.getAddress().getCity());
System.out.println(p.getName());
db.save(p);
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//db.commit();
}
}
private void updateCust4() {
List<Customer> result = db.query(new OSQLSynchQuery<Customer>(
"select * from Customer where address.city like '%99%'"));
SimpleDateFormat sdf = new SimpleDateFormat("MMM dd,yyyy HH:mm");
for (Customer p : result) {
p.setName("updated name " + sdf.format(new
Date(System.currentTimeMillis())));
System.out.println(sdf.format(new
Date(System.currentTimeMillis())));
System.out.println(p.getAddress().getCity());
System.out.println(p.getName());
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//db.begin();
db.save(p);
//db.commit();
}
}
}
/////////////////////////////////////////////////////////////////
Sep 24, 2014 3:48:31 PM com.orientechnologies.common.log.OLogManager log
SEVERE: Error on fetching record during browsing. The record has been
skipped
com.orientechnologies.orient.core.exception.ODatabaseException: Error on
retrieving record #10:0 (cluster: customer)
at
com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:288)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.executeReadRecord(ODatabaseRecordAbstract.java:905)
at
com.orientechnologies.orient.core.tx.OTransactionNoTx.loadRecord(OTransactionNoTx.java:70)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.load(ODatabaseRecordTx.java:274)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordTx.load(ODatabaseRecordTx.java:40)
at
com.orientechnologies.orient.core.iterator.OIdentifiableIterator.readCurrentRecord(OIdentifiableIterator.java:285)
at
com.orientechnologies.orient.core.iterator.ORecordIteratorClusters.begin(ORecordIteratorClusters.java:287)
at
com.orientechnologies.orient.core.iterator.ORecordIteratorClusters.config(ORecordIteratorClusters.java:376)
at
com.orientechnologies.orient.core.iterator.ORecordIteratorClass.<init>(ORecordIteratorClass.java:72)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.searchInClasses(OCommandExecutorSQLResultsetAbstract.java:368)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.searchInClasses(OCommandExecutorSQLSelect.java:657)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLResultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbstract.java:128)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.assignTarget(OCommandExecutorSQLSelect.java:398)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.executeSearch(OCommandExecutorSQLSelect.java:382)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect.execute(OCommandExecutorSQLSelect.java:349)
at
com.orientechnologies.orient.core.sql.OCommandExecutorSQLDelegate.execute(OCommandExecutorSQLDelegate.java:60)
at
com.orientechnologies.orient.core.storage.OStorageEmbedded.executeCommand(OStorageEmbedded.java:82)
at
com.orientechnologies.orient.core.storage.OStorageEmbedded.command(OStorageEmbedded.java:71)
at
com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:69)
at
com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.run(OSQLSynchQuery.java:80)
at
com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:29)
at
com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.query(ODatabaseRecordAbstract.java:664)
at
com.orientechnologies.orient.core.db.ODatabaseRecordWrapperAbstract.query(ODatabaseRecordWrapperAbstract.java:192)
at
com.orientechnologies.orient.object.db.ODatabasePojoAbstract.query(ODatabasePojoAbstract.java:238)
at test.CustomerTest3.updateCust3(CustomerTest3.java:75)
at test.CustomerTest3.access$0(CustomerTest3.java:73)
at test.CustomerTest3$1.call(CustomerTest3.java:43)
at test.CustomerTest3$1.call(CustomerTest3.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:744)
Caused by: com.orientechnologies.common.concur.lock.OLockException: Cannot
unlock a never acquired lock
at
com.orientechnologies.orient.core.tx.OTransactionAbstract.unlockRecord(OTransactionAbstract.java:119)
at
com.orientechnologies.orient.core.id.ORecordId.unlock(ORecordId.java:272)
at
com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.readRecord(OAbstractPaginatedStorage.java:1304)
at
com.orientechnologies.orient.core.storage.impl.local.OAbstractPaginatedStorage.readRecord(OAbstractPaginatedStorage.java:661)
at
com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(ODatabaseRaw.java:282)
... 33 more
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.