1 18 19 package org.apache.jmeter.engine; 20 21 import java.rmi.RemoteException ; 22 import java.util.Iterator ; 23 24 import org.apache.jmeter.samplers.RemoteListenerWrapper; 25 import org.apache.jmeter.samplers.RemoteSampleListener; 26 import org.apache.jmeter.samplers.RemoteSampleListenerImpl; 27 import org.apache.jmeter.samplers.RemoteSampleListenerWrapper; 28 import org.apache.jmeter.samplers.RemoteTestListenerWrapper; 29 import org.apache.jmeter.samplers.Remoteable; 30 import org.apache.jmeter.samplers.SampleListener; 31 import org.apache.jmeter.testelement.TestListener; 32 import org.apache.jmeter.threads.ThreadGroup; 33 import org.apache.jorphan.collections.HashTree; 34 import org.apache.jorphan.collections.HashTreeTraverser; 35 import org.apache.jorphan.logging.LoggingManager; 36 import org.apache.log.Logger; 37 38 41 public class ConvertListeners implements HashTreeTraverser 42 { 43 transient private static Logger log = LoggingManager.getLoggerForClass(); 44 45 48 public void addNode(Object node, HashTree subTree) 49 { 50 if (node instanceof ThreadGroup ) 51 { 52 log.info("num threads = " + ((ThreadGroup ) node).getNumThreads()); 53 } 54 Iterator iter = subTree.list().iterator(); 55 while (iter.hasNext()) 56 { 57 Object item = iter.next(); 58 if (item instanceof ThreadGroup ) 59 { 60 log.info( 61 "num threads = " + ((ThreadGroup ) item).getNumThreads()); 62 } 63 if (item instanceof Remoteable 64 && (item instanceof TestListener 65 || item instanceof SampleListener)) 66 { 67 try 68 { 69 RemoteSampleListener rtl = 70 new RemoteSampleListenerImpl(item); 71 if (item instanceof TestListener 72 && item instanceof SampleListener) 73 { 74 RemoteListenerWrapper wrap = 75 new RemoteListenerWrapper(rtl); 76 subTree.replace(item, wrap); 77 } 78 else if (item instanceof TestListener) 79 { 80 RemoteTestListenerWrapper wrap = 81 new RemoteTestListenerWrapper(rtl); 82 subTree.replace(item, wrap); 83 } 84 else 85 { 86 RemoteSampleListenerWrapper wrap = 87 new RemoteSampleListenerWrapper(rtl); 88 subTree.replace(item, wrap); 89 } 90 } 91 catch (RemoteException e) 92 { 93 log.error("", e); 94 } 95 } 96 } 97 } 98 99 102 public void subtractNode() 103 { 104 } 105 106 109 public void processPath() 110 { 111 } 112 113 } 114 | Popular Tags |