I would also like to know how to do async non blocking queries in orientdb 
(for vert.x)
I tried using OSQLNonBlockingQuery but i get different errors when actually 
using the returned odocument  (see below).
Should I make a github issue or am I just using orientdb the wrong way?
If I dont do a graph.shutdown() it will print the fieldnames and not throw 
the last exception but then how do I release my resources? 
Last question, in the event I get the non-blocking query working is it 
possible to return results in batches (I suspect otherwise I will get into 
trouble with latency given Im using a remote connection)?

        OrientGraph graph = graphFactory.getTx();            
        try {
            
            OSQLNonBlockingQuery<Object> test = new 
OSQLNonBlockingQuery<Object>("select * from Prod where pid = '421'", new 
OCommandResultListener() {
                  int resultCount = 0;
                  @Override
                  public boolean result(Object iRecord) {
                    resultCount++;
                   
                    ODocument odoc = ((ODocument)iRecord);

                    for(String name : odoc.fieldNames()) {     //  
<----------- PROBLEM
                        System.out.println("Name:"+name);
                    }
                    
                    System.out.println("callback "+resultCount+" invoked");
                    return resultCount > 20 ? false : true;
                  }

                  @Override
                  public void end() {
                  }
                });
            
            Future future = graph.command(test).execute();
                System.out.println("query executed");
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            
            if (graph != null) {
                graph.shutdown(); // <------- If i remove this bit it wont 
throw the last exception but how do I then release resources
            }
        }

java.lang.UnsupportedOperationException: Trying to iterate over a 
non-blocking query result
    at 
com.orientechnologies.orient.core.sql.query.OSQLNonBlockingQuery$ONonBlockingQueryFuture.iterator(OSQLNonBlockingQuery.java:102)
    at 
com.tinkerpop.blueprints.impls.orient.OrientGraphCommand.execute(OrientGraphCommand.java:51)
    at com.myapp.Endpoint.main(Endpoint.java:57)

May 17, 2016 11:14:40 AM com.orientechnologies.common.log.OLogManager log
WARNING: Error deserializing record with id #38:235 send this data for 
debugging: 
ABpEYXRhX1Byb2R1Y3RzRwAAANdNAAAA20kAAADvSwAAASVFAAAC1kMAAALZFGVnZW5za2FiZXIAAAMaCgxncm91cHMAAAMcChRhbnZlbmRlbHNlAAADUgoYcHJvZHVjdF9uYW1lAAADVAcGdXJsAAADaAcMSU1QT1JUAAADmQ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TkFMSU1fSU1QT1JUXzIwMTYtMjgtMTIgMTE6MjgGFwwEBwZhbHQAAAPRBwcGdXJsAAAD5AckUHJvZHVrdGluZm9ybWF0aW9uPC9wcm9kdWt0aW5mb3JtYXRpb24vc2UvNDIxLnBkZgwEBwZhbHQAAAQZBwcGdXJsAAAELAckU8Oka2VyaGV0c2RhdGFibGFkPC9zaWtrZXJoZWRzZGF0YWJsYWQvc2UvNDIxLnBkZgwEBwZhbHQAAARhBwcGdXJsAAAEdQcmQnlnZ3ZhcnVkZWtsYXJhdGlvbjovYnlnZ3ZhcnVkZWtsYXRpb24vc2UvNDIxLnBkZgAXAhcMBAcEdjEAAASrBwcEdjIAAATdB2Jwcm9kdWt0a2F0YWxvZy9ieWdnL3RyYWVsaW0vdHJhZWxpbS1wdS1tb2Vyay00MjIvKFRyw6RsaW0gUFUgTcO2cmsgNDIyCGJ5Z2cOdHJhZWxpbQAA
 

Exception in thread "Thread-3" 
com.orientechnologies.orient.core.exception.ODatabaseException: Database 
'remote:orientdb:2424/mydb' is closed
    at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.checkOpeness(ODatabaseDocumentTx.java:2920)
    at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.getMetadata(ODatabaseDocumentTx.java:793)
    at 
com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx.getMetadata(ODatabaseDocumentTx.java:121)
    at 
com.orientechnologies.orient.core.record.impl.ODocument.setClassNameIfExists(ODocument.java:1917)
    at 
com.orientechnologies.orient.core.record.impl.ODocument.fillClassIfNeed(ODocument.java:2180)
    at 
com.orientechnologies.orient.core.record.impl.ODocumentInternal.fillClassNameIfNeeded(ODocumentInternal.java:64)
    at 
com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinaryV0.deserialize(ORecordSerializerBinaryV0.java:159)
    at 
com.orientechnologies.orient.core.serialization.serializer.record.binary.ORecordSerializerBinary.fromStream(ORecordSerializerBinary.java:74)
    at 
com.orientechnologies.orient.core.record.impl.ODocument.deserializeFields(ODocument.java:1817)
    at 
com.orientechnologies.orient.core.record.impl.ODocument.checkForFields(ODocument.java:2416)
    at 
com.orientechnologies.orient.core.record.impl.ODocument.fieldNames(ODocument.java:736)
    at com.myapp.Endpoint$1.result(Endpoint.java:42)
    at 
com.orientechnologies.orient.client.remote.OStorageRemote.command(OStorageRemote.java:1214)
    at 
com.orientechnologies.orient.client.remote.OStorageRemoteThread.command(OStorageRemoteThread.java:453)
    at 
com.orientechnologies.orient.core.sql.query.OSQLQuery.run(OSQLQuery.java:72)
    at 
com.orientechnologies.orient.core.query.OQueryAbstract.execute(OQueryAbstract.java:33)
    at 
com.orientechnologies.orient.core.sql.query.OSQLNonBlockingQuery.access$001(OSQLNonBlockingQuery.java:47)
    at 
com.orientechnologies.orient.core.sql.query.OSQLNonBlockingQuery$1.run(OSQLNonBlockingQuery.java:258)
    at java.lang.Thread.run(Thread.java:745)

-- 

--- 
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.

Reply via email to