On 16 April 2012 21:09, Rob Schroder <[email protected]> wrote:
> Hi,
>
> I've written a simple custom visualizer that gets initialized and works 
> properly when I run in GUI mode.  But, when I run the script from the 
> command-line in non-GUI mode, it never gets initialized and run.  Anybody 
> know what I'm failing to do properly here?
>
> ------------ Code Snippet Below --------------------
>
> public class StatsdWriter extends AbstractVisualizer {

Visualizers - as the name suggests - are for creating GUIs.
They are deliberately not invoked for non-GUI runs.

You should create a Listener instead.

>    private static final long serialVersionUID = 240L;
>    private static final Logger log = LoggingManager.getLoggerForClass();
>
>
>    public StatsdWriter() {
>        super();
>        init();
>        setName(getStaticLabel());
>
>    }
>
>    public String getLabelResource() {
>        return "statsd_data_writer_title"; // $NON-NLS-1$
>    }
>
>
>    private void init() {
>        setLayout(new BorderLayout());
>        setBorder(makeBorder());
>        add(makeTitlePanel(), BorderLayout.NORTH);
>        log.debug("StatsdWriter seems to initialized when running in GUI mode 
> only");
>    }
>
>    /**
>     * This method is called by sampling thread to inform the visualizer about
>     * the arrival of a new sample.  And, in this case, data is passed along 
> to the statsd server.
>     */
>    public void add(SampleResult resp) {
>
>        log.debug("Sending response data to statsd client");
>        StatsdData statsdData = new 
> StatsdData.Builder().label(resp).numberOfFailures(resp).numberOfRunningThreads(resp).responseCode(resp).responseTime(resp).serverLatency(resp).totalBytes(resp).url(resp).build();
>        statsdData.sendToStatsdServer();
>
>    }
>
>    public void clearData() {
>    }
>
>
> }
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to