Hi,
I wrote this snippet of code to restart the database, but it's throwing
errors.
> private void restartDatabase(){
> if(graphDb != null && graphDb.isAvailable(0)){
> graphDb.shutdown();
> }
> graphDb = new GraphDatabaseFactory()
> .newEmbeddedDatabaseBuilder( new File(PATH_TO_DATABASE ))
> .setConfig(GraphDatabaseSettings.allow_store_upgrade,
> "true")
> .newGraphDatabase();
> registerShutdownHook( graphDb );
> }
private void registerShutdownHook( final GraphDatabaseService graphDb )
> {
> // Registers a shutdown hook for the Neo4j instance so that it
> // shuts down nicely when the VM exits (even if you "Ctrl-C" the
> // running application).
> Runtime.getRuntime().addShutdownHook( new Thread()
> {
> @Override
> public void run()
> {
> graphDb.shutdown();
> }
> } );
> }
Stacktrace:
> Exception in thread "main"
> org.neo4j.kernel.impl.core.ThreadToStatementContextBridge$BridgeDatabaseShutdownException:
> This database is shutdown.
> at
> org.neo4j.kernel.impl.core.ThreadToStatementContextBridge.checkIfShutdown(ThreadToStatementContextBridge.java:96)
> at
> org.neo4j.kernel.impl.core.ThreadToStatementContextBridge.hasTransaction(ThreadToStatementContextBridge.java:43)
> at
> org.neo4j.kernel.impl.factory.ClassicCoreSPI.isInOpenTransaction(ClassicCoreSPI.java:199)
> at
> org.neo4j.kernel.impl.factory.GraphDatabaseFacade.beginTransaction(GraphDatabaseFacade.java:335)
> at
> org.neo4j.kernel.impl.factory.GraphDatabaseFacade.beginTx(GraphDatabaseFacade.java:330)
> ....
Any idea why the database is still shutdown instead of restarted? Thanks.
Kind regards,
Cherie
On 4 June 2016 at 15:34, 'Michael Hunger' via Neo4j <[email protected]>
wrote:
> Shutdown and create new, yes
>
> Von meinem iPhone gesendet
>
> Am 04.06.2016 um 14:17 schrieb Cherie Pun <[email protected]>:
>
> If I am using java GraphDatabaseService, do I need to create a new
> embedded database to restart it? Thanks.
>
> Kind regards,
> Cherie
>
> On 4 June 2016 at 03:01, 'Michael Hunger' via Neo4j <
> [email protected]> wrote:
>
>> Just restart the db after deleting a lot of relationships will enable
>> record-reuse.
>>
>> > Am 04.06.2016 um 01:49 schrieb Cherie Pun <[email protected]>:
>> >
>> > Hi,
>> >
>> > I have seen a few questions that were posted from before that it does
>> not free the space up immediately. My application is running analysis over
>> the database repeatedly but each time inserting different number of
>> relationships so I have to remove them before I run the next iteration. The
>> database size seems to be growing continuously even when the relationships
>> are removed. I am wondering if the size of the database will slow my
>> application down because there are so many unused ids.
>> >
>> > Thanks!
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> Groups "Neo4j" 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 a topic in the
>> Google Groups "Neo4j" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/neo4j/LiHC2zrN458/unsubscribe.
>> To unsubscribe from this group and all its topics, 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
> "Neo4j" 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 a topic in the
> Google Groups "Neo4j" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/neo4j/LiHC2zrN458/unsubscribe.
> To unsubscribe from this group and all its topics, 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
"Neo4j" 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.