Skip to content

Instantly share code, notes, and snippets.

@justinedelson
Created February 21, 2013 20:21
Show Gist options
  • Save justinedelson/5007864 to your computer and use it in GitHub Desktop.
Save justinedelson/5007864 to your computer and use it in GitHub Desktop.
Groovy script to quiesce a CRX/CQ instance
import javax.management.remote.JMXServiceURL;
import javax.management.remote.JMXConnectorFactory;
import javax.management.ObjectName;
// assuming that CQ is started with -Dcom.sun.management.jmxremote.port=9000
def jmxUrl = "service:jmx:rmi:///jndi/rmi://localhost:9000/jmxrmi";
def serviceUrl = new JMXServiceURL(jmxUrl);
def jmxConnector = JMXConnectorFactory.connect(serviceUrl);
def mbeanConn = jmxConnector.getMBeanServerConnection();
def repositoryName = new ObjectName("com.adobe.granite:type=Repository");
mbeanConn.invoke(repositoryName, "blockRepositoryWrites", new Object[0], new String[0]);
System.out.println("The System is now quiesced.");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment