List of usage examples for org.apache.cassandra.service StorageServiceMBean forceTerminateAllRepairSessions
public void forceTerminateAllRepairSessions();
From source file:com.spotify.cassandra.opstools.AbortRepairs.java
License:Apache License
public static void main(String[] args) throws IOException, InterruptedException { JMXServiceURL jmxUrl;/*from w w w. j av a 2 s . c o m*/ JMXConnector jmxc = null; try { jmxUrl = new JMXServiceURL(String.format("service:jmx:rmi:///jndi/rmi://%s:%d/jmxrmi", InetAddress.getLocalHost().getCanonicalHostName(), 7199)); jmxc = JMXConnectorFactory.connect(jmxUrl); MBeanServerConnection mbeanServerConn = jmxc.getMBeanServerConnection(); ObjectName name = new ObjectName("org.apache.cassandra.db:type=StorageService"); StorageServiceMBean ssProxy = JMX.newMBeanProxy(mbeanServerConn, name, StorageServiceMBean.class); ssProxy.forceTerminateAllRepairSessions(); System.out.println("All repair sessions terminated"); } catch (Exception e) { System.err.println("Failed to stop all repair sessions: " + e); } finally { if (jmxc != null) { jmxc.close(); } } }