Prev |  | Next

## 4.8. Reading a management attribute

The EmbeddedGraphDatabase class includes a convenience method to get instances of Neo4j management beans. The common JMX service can be used as well, but from your code you probably rather want to use the approach outlined here.

| Tip
The source code of the example is found here: JmxTest.java

This example shows how to get the start time of a database:

    private static Date getStartTimeFromManagementBean(
            GraphDatabaseService graphDbService )
    {
        GraphDatabaseAPI graphDb = (GraphDatabaseAPI) graphDbService;
        Kernel kernel = graphDb.getSingleManagementBean( Kernel.class );
        Date startTime = kernel.getKernelStartTime();
        return startTime;
    }

Depending on which Neo4j edition you are using different sets of management beans are available.

- For all editions, see the org.neo4j.jmx package.
- For the Advanced and Enterprise editions, see the org.neo4j.management package as well.

Copyright © 2013 Neo Technology

Prev | Up | Next
| Home |