以编程方式创建远程 jvm 的线程转储

Creating thread dumps of a remote jvm programatically

我一直在尝试在远程 jvm 中对 ThreadMXBean 调用操作。我用来调用该操作的代码片段在

下面
bean = new ObjectName("java.lang:type=Threading");
        memoryInfo = RemoteConnector.getRemote().getMBeanInfo(bean);
        RemoteConnector.getRemote().getObjectInstance(bean);
        MBeanOperationInfo [] mBeanAttributeInfos = memoryInfo.getOperations();
        for(MBeanOperationInfo mBeanAttributeInfo : mBeanAttributeInfos){
            System.out.println(mBeanAttributeInfo.getName());
        }
        long [] allThreadIds = (long [])RemoteConnector.getRemote().getAttribute(bean,"AllThreadIds");
        Object [] params = new Object[2];
        int maxDepth = 100;
        params[0] = allThreadIds;
        params[1] = maxDepth;
        String [] opSigs = {allThreadIds.getClass().getName(),"I"};
        RemoteConnector.getRemote().invoke(bean,"getThreadInfo",params,opSigs);

注意 getRemote() 方法 returns 一个 mbeanserverconnection

我无法在存根上调用方法 getThreadInfo()。我收到这条消息

2016-05-05 00:17:37 ERROR ThreadDumpCreator:67 - Operation getThreadInfo exists but not with this signature: ([J, I)

请帮我解决这个问题:)

下面是我用来连接远程 mbeanserver 的方法

public class RemoteConnector {

private static MBeanServerConnection remote = null;
private static JMXConnector connector = null;

public static void defaultConnector(){
    try {
        JMXServiceURL target = new JMXServiceURL
                ("service:jmx:rmi://localhost:11111/jndi/rmi://localhost:9999/jmxrmi");
        //for passing credentials for password
        Map<String, String[]> env = new HashMap<String, String[]>();
        String[] credentials = {"admin", "admin"};
        env.put(JMXConnector.CREDENTIALS, credentials);

        connector = JMXConnectorFactory.connect(target, env);
        remote = connector.getMBeanServerConnection();

    }catch (MalformedURLException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
}

public static MBeanServerConnection getRemote() {
    return remote;
}

public static void setRemote(MBeanServerConnection remote) {
    RemoteConnector.remote = remote;
}

public static void closeConnection() throws IOException {
    if(connector != null){
        connector.close();
    }
}

}

显然我应该使用 int.class.getName() 因为方法签名需要调用方法