/*
 * Copyright 2015 Cloudius Systems
 */
package com.scylladb.jmx.main;

import com.scylladb.jmx.api.APIConfig;

import org.apache.cassandra.db.ColumnFamilyStore;
import org.apache.cassandra.db.commitlog.CommitLog;
import org.apache.cassandra.db.compaction.CompactionManager;
import org.apache.cassandra.gms.Gossiper;
import org.apache.cassandra.gms.FailureDetector;
import org.apache.cassandra.locator.EndpointSnitchInfo;
import org.apache.cassandra.metrics.StreamingMetrics;
import org.apache.cassandra.net.MessagingService;
import org.apache.cassandra.service.CacheService;
import org.apache.cassandra.service.GCInspector;
import org.apache.cassandra.service.StorageProxy;
import org.apache.cassandra.service.StorageService;

public class Main {

    public static void main(String[] args) throws Exception {
        APIConfig.setConfig();
        System.out.println("Connecting to " + APIConfig.getBaseUrl());
        System.out.println("Starting the JMX server");
        StorageService.getInstance();
        StorageProxy.getInstance();
        MessagingService.getInstance();
        CommitLog.getInstance();
        Gossiper.getInstance();
        EndpointSnitchInfo.getInstance();
        FailureDetector.getInstance();
        ColumnFamilyStore.register_mbeans();
        CacheService.getInstance();
        CompactionManager.getInstance();
        GCInspector.register();
        StreamingMetrics.register_mbeans();
        Thread.sleep(Long.MAX_VALUE);
    }

}

@@ -105,16 +105,74 @@
 IConfig;
+%0Aimport com.scylladb.jmx.utils.RMIServerSocketFactoryImpl;
 %0A%0Aimport
@@ -1021,16 +1021,67 @@
 rver%22);%0A
+        RMIServerSocketFactoryImpl.maybeInitJmx();%0A
         

use the RMIServerSocketFactoryImp jmx init