Is also the try-with-resources syntax supported (
http://docs.oracle.com/javase/tutorial/essential/exceptions/tryResourceClose.html
)
?

try(ODatabaseDocumentTx db = pool.acquire()) {
...
}


2014-04-09 12:18 GMT+02:00 Andrey Lomakin <[email protected]>:

> HI,
> Ricardo is right.
>
> You do not need to close storage.
> Or even pool, just close database and pool if you wish.
>
>
> On Wed, Apr 9, 2014 at 9:34 AM, Riccardo Tasso 
> <[email protected]>wrote:
>
>> Hi,
>> In my application I first open the pool:
>> ODatabaseDocumentPool pool = new ODatabaseDocumentPool(cbookDbUrl,
>> cbookDbUsername, cbookDbPassword);
>> then I acquire the database:
>> ODatabaseDocumentTx db = pool.acquire();
>> then wrap the database into the graph (if I just have to perform a query
>> is not required):
>> OrientGraph graph = new OrientGraph(db);
>>
>>  I do some work and finally I close the database:
>> db.close();
>> and close the connection pool:
>> pool.close();
>>
>> I never had your problem. Is this considered a good practise?
>>
>> Cheers,
>>    Riccardo
>>
>>
>> 2014-04-08 23:22 GMT+02:00 Odysseas <[email protected]>:
>>
>>
>>> During redeployment of an application that uses OrientDB in embedded
>>> mode, the connection pool is unable to start properly because it was not
>>> shutdown properly. When shutting down the database we first close the pool
>>> and the shutdown the storage. The following excerpt shows what we do during
>>> shutdown. Are we missing something else that should be done during
>>> shutdown? This is with 1.7-rc2. Thanks.
>>>
>>>         OrientGraphFactory pool = connectionPoolByEntity.get(entityName);
>>>         if (pool != null) {
>>>             log.info("Shutting down the connection pool to OrientDB for
>>> entity " + entityName);
>>>             pool.close();
>>>         }
>>>
>>>             final OStorage stg =
>>> Orient.instance().getStorage(storageName);
>>>             if (stg != null) {
>>>                 stg.close();
>>>             }
>>>
>>> The error message we see is:
>>>
>>> aManagerAbstract.initializeSchema(SchemaManagerAbstract.java:87) -
>>> Failed while initializing the store:
>>> com.orientechnologies.orient.core.exception.OStorageException: Cannot open
>>> local storage 'person-db' with mode=rw
>>> com.orientechnologies.orient.core.exception.OStorageException: Cannot
>>> open local storage 'person-db' with mode=rw
>>> at
>>> com.orientechnologies.orient.core.storage.impl.local.paginated.OLocalPaginatedStorage.open(OLocalPaginatedStorage.java:254)
>>>  at
>>> com.orientechnologies.orient.core.db.raw.ODatabaseRaw.open(ODatabaseRaw.java:101)
>>> at
>>> com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:54)
>>>  at
>>> com.orientechnologies.orient.core.db.record.ODatabaseRecordAbstract.open(ODatabaseRecordAbstract.java:265)
>>> at
>>> com.orientechnologies.orient.core.db.ODatabaseWrapperAbstract.open(ODatabaseWrapperAbstract.java:54)
>>>  at
>>> com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.openOrCreate(OrientBaseGraph.java:878)
>>> at
>>> com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.<init>(OrientBaseGraph.java:103)
>>>  at
>>> com.tinkerpop.blueprints.impls.orient.OrientGraphNoTx.<init>(OrientGraphNoTx.java:34)
>>>
>>>  --
>>>
>>> ---
>>> 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.
>>>
>>
>>  --
>>
>> ---
>> 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.
>

-- 

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