Search in sources :

Example 6 with OutputWriter

use of com.googlecode.jmxtrans.model.OutputWriter in project jmxtrans by jmxtrans.

the class JmxTransformer method stopWriterAndClearMasterServerList.

/**
	 * Shut down the output writers and clear the master server list
	 * Used both during shutdown and when re-reading config files
	 */
private void stopWriterAndClearMasterServerList() {
    for (Server server : this.masterServersList) {
        for (OutputWriter writer : server.getOutputWriters()) {
            try {
                writer.close();
            } catch (LifecycleException ex) {
                log.error("Eror stopping writer: {}", writer);
            }
        }
        for (Query query : server.getQueries()) {
            for (OutputWriter writer : query.getOutputWriterInstances()) {
                try {
                    writer.close();
                    log.debug("Stopped writer: {} for query: {}", writer, query);
                } catch (LifecycleException ex) {
                    log.error("Error stopping writer: {} for query: {}", writer, query, ex);
                }
            }
        }
    }
    this.masterServersList = ImmutableList.of();
}
Also used : LifecycleException(com.googlecode.jmxtrans.exceptions.LifecycleException) MBeanServer(javax.management.MBeanServer) Server(com.googlecode.jmxtrans.model.Server) Query(com.googlecode.jmxtrans.model.Query) OutputWriter(com.googlecode.jmxtrans.model.OutputWriter)

Example 7 with OutputWriter

use of com.googlecode.jmxtrans.model.OutputWriter in project jmxtrans by jmxtrans.

the class JmxTransformer method validateSetup.

private void validateSetup(Server server, Query query) throws ValidationException {
    for (OutputWriter w : query.getOutputWriterInstances()) {
        injector.injectMembers(w);
        w.validateSetup(server, query);
    }
}
Also used : OutputWriter(com.googlecode.jmxtrans.model.OutputWriter)

Aggregations

OutputWriter (com.googlecode.jmxtrans.model.OutputWriter)7 Query (com.googlecode.jmxtrans.model.Query)6 Server (com.googlecode.jmxtrans.model.Server)6 Test (org.junit.Test)4 Result (com.googlecode.jmxtrans.model.Result)3 MBeanServer (javax.management.MBeanServer)3 LifecycleException (com.googlecode.jmxtrans.exceptions.LifecycleException)2 QueryFixtures.dummyQuery (com.googlecode.jmxtrans.model.QueryFixtures.dummyQuery)2 ResultFixtures.singleFalseResult (com.googlecode.jmxtrans.model.ResultFixtures.singleFalseResult)2 ResultFixtures.singleTrueResult (com.googlecode.jmxtrans.model.ResultFixtures.singleTrueResult)2 ServerFixtures.dummyServer (com.googlecode.jmxtrans.model.ServerFixtures.dummyServer)2 OutputWriterFactory (com.googlecode.jmxtrans.model.OutputWriterFactory)1 ServerFixtures.localServer (com.googlecode.jmxtrans.model.ServerFixtures.localServer)1 ValidationException (com.googlecode.jmxtrans.model.ValidationException)1 ResultTransformerOutputWriter (com.googlecode.jmxtrans.model.output.support.ResultTransformerOutputWriter)1 IntegrationTest (com.googlecode.jmxtrans.test.IntegrationTest)1 ParseException (java.text.ParseException)1 SchedulerException (org.quartz.SchedulerException)1