Hi, Thank you for feedback. That is because you use separate db instance for each thread :-).
On Thu, Oct 2, 2014 at 6:44 PM, <[email protected]> wrote: > Hi Andrey, > > I am happy to report that I am not getting that message after refactoring > - I don't understand why but that is ok :) > > One issue was that I had not registered the classes so the query was > throwing an "not serializable" exception. Wish I had got a more meaning > message from Orientdb. > > I am attaching the refactored classes. I would still like to know what was > the problem with the earlier CustomerTest3 class. > > > Thanks > Arvind > > On Saturday, September 27, 2014 2:01:24 PM UTC-4, Andrey Lomakin wrote: >> >> Hi, >> Ok I will try meanwhile I noticed that you reused the same instance of db >> for every thread. db instance is like connection to data storage and you >> need to have new instance for each thread. >> I will try to repeat your test, meanwhile coudl you try to change code I >> suggested and try it too ? >> >> On Fri, Sep 26, 2014 at 5:20 PM, <[email protected]> wrote: >> >>> Sorry Andrey, no maven project, just playing with Orientdb. >>> But I am attaching the 4 java files that I used to get that bug, hope >>> that helps. >>> >>> On Friday, September 26, 2014 7:43:20 AM UTC-4, Andrey Lomakin wrote: >>>> >>>> Hi, >>>> Could you provide test which I can run, in form of may be maven project >>>> ? >>>> >>>> On Thu, Sep 25, 2014 at 7:41 AM, Andrey Lomakin <[email protected]> >>>> wrote: >>>> >>>>> Hi, >>>>> You should follow https://github.com/orientechnologies/orientdb/ >>>>> issues/2840 >>>>> >>>>> On Wed, Sep 24, 2014 at 10:57 PM, <[email protected]> wrote: >>>>> >>>>>> 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(O >>>>>> DatabaseRaw.java:288) >>>>>> at com.orientechnologies.orient.core.db.record.ODatabaseRecordA >>>>>> bstract.executeReadRecord(ODatabaseRecordAbstract.java:905) >>>>>> at com.orientechnologies.orient.core.tx.OTransactionNoTx.loadRe >>>>>> cord(OTransactionNoTx.java:70) >>>>>> at com.orientechnologies.orient.core.db.record.ODatabaseRecordT >>>>>> x.load(ODatabaseRecordTx.java:274) >>>>>> at com.orientechnologies.orient.core.db.record.ODatabaseRecordT >>>>>> x.load(ODatabaseRecordTx.java:40) >>>>>> at com.orientechnologies.orient.core.iterator.OIdentifiableIterator. >>>>>> readCurrentRecord(OIdentifiableIterator.java:285) >>>>>> at com.orientechnologies.orient.core.iterator.ORecordIteratorCl >>>>>> usters.begin(ORecordIteratorClusters.java:287) >>>>>> at com.orientechnologies.orient.core.iterator.ORecordIteratorCl >>>>>> usters.config(ORecordIteratorClusters.java:376) >>>>>> at com.orientechnologies.orient.core.iterator.ORecordIteratorCl >>>>>> ass.<init>(ORecordIteratorClass.java:72) >>>>>> at com.orientechnologies.orient.core.sql.OCommandExecutorSQLRes >>>>>> ultsetAbstract.searchInClasses(OCommandExecutorSQLResultsetAb >>>>>> stract.java:368) >>>>>> at com.orientechnologies.orient.core.sql.OCommandExecutorSQLSelect. >>>>>> searchInClasses(OCommandExecutorSQLSelect.java:657) >>>>>> at com.orientechnologies.orient.core.sql.OCommandExecutorSQLRes >>>>>> ultsetAbstract.assignTarget(OCommandExecutorSQLResultsetAbst >>>>>> ract.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.OCommandExecutorSQLDel >>>>>> egate.execute(OCommandExecutorSQLDelegate.java:60) >>>>>> at com.orientechnologies.orient.core.storage.OStorageEmbedded.e >>>>>> xecuteCommand(OStorageEmbedded.java:82) >>>>>> at com.orientechnologies.orient.core.storage.OStorageEmbedded.c >>>>>> ommand(OStorageEmbedded.java:71) >>>>>> at com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OS >>>>>> QLQuery.java:69) >>>>>> at com.orientechnologies.orient.core.sql.query.OSQLSynchQuery.r >>>>>> un(OSQLSynchQuery.java:80) >>>>>> at com.orientechnologies.orient.core.query.OQueryAbstract.execu >>>>>> te(OQueryAbstract.java:29) >>>>>> at com.orientechnologies.orient.core.db.record.ODatabaseRecordA >>>>>> bstract.query(ODatabaseRecordAbstract.java:664) >>>>>> at com.orientechnologies.orient.core.db.ODatabaseRecordWrapperA >>>>>> bstract.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(ThreadPool >>>>>> Executor.java:1142) >>>>>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoo >>>>>> lExecutor.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.un >>>>>> lockRecord(OTransactionAbstract.java:119) >>>>>> at com.orientechnologies.orient.core.id.ORecordId.unlock(ORecor >>>>>> dId.java:272) >>>>>> at com.orientechnologies.orient.core.storage.impl.local.OAbstra >>>>>> ctPaginatedStorage.readRecord(OAbstractPaginatedStorage.java:1304) >>>>>> at com.orientechnologies.orient.core.storage.impl.local.OAbstra >>>>>> ctPaginatedStorage.readRecord(OAbstractPaginatedStorage.java:661) >>>>>> at com.orientechnologies.orient.core.db.raw.ODatabaseRaw.read(O >>>>>> DatabaseRaw.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. >>>>>> >>>>> >>>>> >>>>> >>>>> -- >>>>> Best regards, >>>>> Andrey Lomakin. >>>>> >>>>> Orient Technologies >>>>> the Company behind OrientDB >>>>> >>>>> >>>> >>>> >>>> -- >>>> Best regards, >>>> Andrey Lomakin. >>>> >>>> Orient Technologies >>>> the Company behind OrientDB >>>> >>>> -- >>> >>> --- >>> 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. >>> >> >> >> >> -- >> Best regards, >> Andrey Lomakin. >> >> Orient Technologies >> the Company behind OrientDB >> >> -- > > --- > 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. > -- Best regards, Andrey Lomakin. Orient Technologies the Company behind OrientDB -- --- 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.
