1 18 19 package org.apache.jmeter.samplers; 20 21 import java.rmi.RemoteException ; 22 23 import org.apache.jmeter.engine.event.LoopIterationEvent; 24 import org.apache.jmeter.testelement.TestListener; 25 26 29 public class RemoteSampleListenerImpl 30 extends java.rmi.server.UnicastRemoteObject 31 implements RemoteSampleListener, SampleListener, TestListener 32 { 33 TestListener testListener; 34 SampleListener sampleListener; 35 36 public RemoteSampleListenerImpl() throws RemoteException 37 { 38 super(); 39 } 40 41 public void setListener(Object listener) 42 { 43 if (listener instanceof TestListener) 44 { 45 testListener = (TestListener) listener; 46 } 47 if (listener instanceof SampleListener) 48 { 49 sampleListener = (SampleListener) listener; 50 } 51 } 52 53 public RemoteSampleListenerImpl(Object listener) throws RemoteException 54 { 55 super(); 56 setListener(listener); 57 } 58 59 public void testStarted() 60 { 61 if (testListener != null) 62 { 63 testListener.testStarted(); 64 } 65 } 66 67 public void testStarted(String host) 68 { 69 if (testListener != null) 70 { 71 testListener.testStarted(host); 72 } 73 } 74 75 public void testEnded() 76 { 77 if (testListener != null) 78 { 79 testListener.testEnded(); 80 } 81 } 82 83 public void testEnded(String host) 84 { 85 if (testListener != null) 86 { 87 testListener.testEnded(host); 88 } 89 } 90 91 public void sampleOccurred(SampleEvent e) 92 { 93 if (sampleListener != null) 94 { 95 sampleListener.sampleOccurred(e); 96 } 97 } 98 99 102 public void sampleStarted(SampleEvent e) 103 { 104 if (sampleListener != null) 105 { 106 sampleListener.sampleStarted(e); 107 } 108 } 109 110 113 public void sampleStopped(SampleEvent e) 114 { 115 if (sampleListener != null) 116 { 117 sampleListener.sampleStopped(e); 118 } 119 } 120 121 124 public void testIterationStart(LoopIterationEvent event) 125 { 126 } 127 } 128 | Popular Tags |