@Override public void testEnded() { testEnded("local"); //$NON-NLS-1$ }
@Override public void testStarted() { testStarted("local"); //$NON-NLS-1$ }
@Override public Object clone() { LoadosophiaUploader clone = (LoadosophiaUploader) super.clone(); clone.gui = this.gui; return clone; }
private Class<?> initClass() { String name = getClassname().trim(); try { return Class.forName(name, false, Thread.currentThread().getContextClassLoader()); } catch (Exception e) { log.error("{}\tException initialising: {}", whoAmI(), name, e); } return null; }
@Override public void testStarted(String host) { if (log.isDebugEnabled()) { log.debug("{}\ttestStarted({})", whoAmI(), host); final String size = getQueueSize(); try { queueSize = Integer.parseInt(size); myName = getName(); listenerClientData = queuesByTestElementName.get(myName); if (listenerClientData == null){ clientClass = initClass(); // may be null BackendListenerClient backendListenerClient = createBackendListenerClientImpl(clientClass); BackendListenerContext context = new BackendListenerContext((Arguments)getArguments().clone()); listenerClientData.client = backendListenerClient; if (log.isInfoEnabled()) { log.info("{}: Starting worker with class: {} and queue capacity: {}", getName(), clientClass, getQueueSize()); Worker worker = new Worker(backendListenerClient, (Arguments) getArguments().clone(), listenerClientData); worker.setDaemon(true); worker.start(); if (log.isInfoEnabled()) { log.info("{}: Started worker with class: {}", getName(), clientClass);
/** * Generate a String identifier of this instance for debugging purposes. * * @return a String identifier for this sampler instance */ private String whoAmI() { StringBuilder sb = new StringBuilder(); sb.append(Thread.currentThread().getName()); sb.append("@"); sb.append(Integer.toHexString(hashCode())); sb.append("-"); sb.append(getName()); return sb.toString(); }
@Override public void sampleOccurred(SampleEvent event) { Arguments args = getArguments(); BackendListenerContext context = new BackendListenerContext(args); SampleResult sr = listenerClientData.client.createSampleResult(context, event.getResult()); if(sr == null) { if (log.isDebugEnabled()) { log.debug("{} => Dropping SampleResult: {}", getName(), event.getResult()); } return; } try { if (!listenerClientData.queue.offer(sr)){ // we failed to add the element first time listenerClientData.queueWaits.add(1L); long t1 = System.nanoTime(); listenerClientData.queue.put(sr); long t2 = System.nanoTime(); listenerClientData.queueWaitTime.add(t2-t1); } } catch (Exception err) { log.error("sampleOccurred, failed to queue the sample", err); } }
/** * Gets the Classname of the BackendListenerClient object * * @return the Classname value */ public String getClassname() { return getPropertyAsString(CLASSNAME); }
/** * Get the arguments (parameters) for the BackendListenerClient to be executed * with. * * @return the arguments */ public Arguments getArguments() { return (Arguments) getProperty(ARGUMENTS).getObjectValue(); }
/** {@inheritDoc} */ @Override public TestElement createTestElement() { BackendListener config = new BackendListener(); modifyTestElement(config); return config; }
BackendListenerContext context = new BackendListenerContext(getArguments()); listenerClientData.client.teardownTest(context); } catch (Exception e) {
/** * Gets the queue size * * @return int queueSize */ public String getQueueSize() { return getPropertyAsString(QUEUE_SIZE, DEFAULT_QUEUE_SIZE); } }
@Override public void testEnded(String host) { super.testEnded(host); isTestStarted.set(false); }
@Override public void testStarted(String host) { setArguments(createArguments()); super.testStarted(host); if (!isTestStarted.getAndSet(true)) { initClient(); } }
@Override public Object clone() { BlazeMeterUploader clone = (BlazeMeterUploader) super.clone(); clone.gui = this.gui; return clone; }
@Override public void testEnded(String host) { super.testEnded(host); resultCollector.testEnded(host); isTestStarted.set(false); }
@Override public void testStarted(String host) { final boolean isStarted = isTestStarted.getAndSet(true); if (!isStarted) { try { resultCollector = new CorrectedResultCollector(); setupSaving(); } catch (IOException ex) { log.error("Unable to set up saving config", ex); } } setArguments(createArguments()); super.testStarted(host); if (!isStarted) { initClient(); } resultCollector.testStarted(host); }