JmxUtils is still contained in : package org.neo4j.jmx

public class JmxUtils {
    private static final MBeanServer mbeanServer = 
ManagementFactory.getPlatformMBeanServer();

    public JmxUtils() {
    }

    public static ObjectName getObjectName(GraphDatabaseService db, String 
name) {
        if(!(db instanceof GraphDatabaseAPI)) {
            throw new IllegalArgumentException("Can only resolve object names 
for embedded Neo4j database instances, eg. instances created by 
GraphDatabaseFactory or HighlyAvailableGraphDatabaseFactory.");
        } else {
            ObjectName neoQuery = 
((Kernel)((JmxKernelExtension)((GraphDatabaseAPI)db).getDependencyResolver().resolveDependency(JmxKernelExtension.class)).getSingleManagementBean(Kernel.class)).getMBeanQuery();
            String instance = neoQuery.getKeyProperty("instance");
            String domain = neoQuery.getDomain();

            try {
                return new ObjectName(String.format("%s:instance=%s,name=%s", 
new Object[]{domain, instance, name}));
            } catch (MalformedObjectNameException var6) {
                throw new RuntimeException(var6);
            }
        }
    }

    public static <T> T getAttribute(ObjectName objectName, String attribute) {
        try {
            return mbeanServer.getAttribute(objectName, attribute);
        } catch (Exception var3) {
            throw new RuntimeException(var3);
        }
    }

    public static <T> T invoke(ObjectName objectName, String attribute, 
Object[] params, String[] signatur) {
        try {
            return mbeanServer.invoke(objectName, attribute, params, signatur);
        } catch (Exception var5) {
            throw new RuntimeException(var5);
        }
    }
}

> Am 12.05.2017 um 01:20 schrieb Bill Nicholson 
> <[email protected]>:
> 
>  
> 
> I found this example in the Neo4j documentation:
> 
> 
> 
> private static Date getStartTimeFromManagementBean(GraphDatabaseService 
> graphDbService )
> {
>     ObjectName objectName = JmxUtils.getObjectName( graphDbService, "Kernel" 
> );
>     Date date = JmxUtils.getAttribute( objectName, "KernelStartTime" );
>     return date;
> }
> 
> 
> 
> I downloaded neo4j-jmx-1.8.jar and installed it into the build path, the 
> class does not resolve. Where can I find it?
> 
> 
> 
> 
> 
> This is also posted on SO but no one has responded. 
> 
> 
> 
> 
> What I really need to do is programmatically read the config setting for the 
> import folder so I can put stuff in there. Hard-coding the path name is 
> clunky. 
> 
> -- 
> 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 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.

Reply via email to