jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: custom component not getting initialized
Date Mon, 16 Apr 2012 21:38:33 GMT
On 16 April 2012 21:09, Rob Schroder <rob@manilla.com> 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: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org


Mime
View raw message