Search in sources :

Example 1 with RemoteSampleListener

use of org.apache.jmeter.samplers.RemoteSampleListener in project jmeter by apache.

the class ConvertListeners method addNode.

/**
     * {@inheritDoc}
     */
@Override
public void addNode(Object node, HashTree subTree) {
    for (Object item : subTree.list()) {
        if (item instanceof AbstractThreadGroup) {
            if (log.isDebugEnabled()) {
                log.debug("num threads = {}", ((AbstractThreadGroup) item).getNumThreads());
            }
        }
        if (item instanceof Remoteable) {
            if (item instanceof RemoteThreadsListenerTestElement) {
                // Used for remote notification of threads start/stop,see BUG 54152
                try {
                    RemoteThreadsListenerWrapper wrapper = new RemoteThreadsListenerWrapper(new RemoteThreadsListenerImpl());
                    subTree.replaceKey(item, wrapper);
                } catch (RemoteException e) {
                    log.error("Error replacing {} by wrapper: {}", RemoteThreadsListenerTestElement.class, RemoteThreadsListenerWrapper.class, e);
                }
                continue;
            }
            if (item instanceof ThreadListener) {
                // TODO Document the reason for this
                log.error("Cannot handle ThreadListener Remotable item: {}", item.getClass());
                continue;
            }
            try {
                RemoteSampleListener rtl = new RemoteSampleListenerImpl(item);
                if (item instanceof TestStateListener && item instanceof SampleListener) {
                    // TL - all
                    RemoteListenerWrapper wrap = new RemoteListenerWrapper(rtl);
                    subTree.replaceKey(item, wrap);
                } else if (item instanceof TestStateListener) {
                    RemoteTestListenerWrapper wrap = new RemoteTestListenerWrapper(rtl);
                    subTree.replaceKey(item, wrap);
                } else if (item instanceof SampleListener) {
                    RemoteSampleListenerWrapper wrap = new RemoteSampleListenerWrapper(rtl);
                    subTree.replaceKey(item, wrap);
                } else {
                    if (log.isWarnEnabled()) {
                        log.warn("Could not replace Remotable item: {}", item.getClass());
                    }
                }
            } catch (RemoteException e) {
                // $NON-NLS-1$
                log.error("RemoteException occurred while replacing Remotable item.", e);
            }
        }
    }
}
Also used : RemoteThreadsListenerWrapper(org.apache.jmeter.threads.RemoteThreadsListenerWrapper) ThreadListener(org.apache.jmeter.testelement.ThreadListener) AbstractThreadGroup(org.apache.jmeter.threads.AbstractThreadGroup) Remoteable(org.apache.jmeter.samplers.Remoteable) RemoteThreadsListenerTestElement(org.apache.jmeter.threads.RemoteThreadsListenerTestElement) TestStateListener(org.apache.jmeter.testelement.TestStateListener) RemoteTestListenerWrapper(org.apache.jmeter.samplers.RemoteTestListenerWrapper) RemoteSampleListener(org.apache.jmeter.samplers.RemoteSampleListener) RemoteSampleListenerWrapper(org.apache.jmeter.samplers.RemoteSampleListenerWrapper) SampleListener(org.apache.jmeter.samplers.SampleListener) RemoteSampleListener(org.apache.jmeter.samplers.RemoteSampleListener) RemoteListenerWrapper(org.apache.jmeter.samplers.RemoteListenerWrapper) RemoteException(java.rmi.RemoteException) RemoteSampleListenerImpl(org.apache.jmeter.samplers.RemoteSampleListenerImpl) RemoteThreadsListenerImpl(org.apache.jmeter.threads.RemoteThreadsListenerImpl)

Aggregations

RemoteException (java.rmi.RemoteException)1 RemoteListenerWrapper (org.apache.jmeter.samplers.RemoteListenerWrapper)1 RemoteSampleListener (org.apache.jmeter.samplers.RemoteSampleListener)1 RemoteSampleListenerImpl (org.apache.jmeter.samplers.RemoteSampleListenerImpl)1 RemoteSampleListenerWrapper (org.apache.jmeter.samplers.RemoteSampleListenerWrapper)1 RemoteTestListenerWrapper (org.apache.jmeter.samplers.RemoteTestListenerWrapper)1 Remoteable (org.apache.jmeter.samplers.Remoteable)1 SampleListener (org.apache.jmeter.samplers.SampleListener)1 TestStateListener (org.apache.jmeter.testelement.TestStateListener)1 ThreadListener (org.apache.jmeter.testelement.ThreadListener)1 AbstractThreadGroup (org.apache.jmeter.threads.AbstractThreadGroup)1 RemoteThreadsListenerImpl (org.apache.jmeter.threads.RemoteThreadsListenerImpl)1 RemoteThreadsListenerTestElement (org.apache.jmeter.threads.RemoteThreadsListenerTestElement)1 RemoteThreadsListenerWrapper (org.apache.jmeter.threads.RemoteThreadsListenerWrapper)1