1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.monitor;
14
15 import java.util.Vector;
16
17 import com.eviware.soapui.SoapUI;
18
19 public class TcpMonMonitorEngine implements SoapMonitorEngine
20 {
21 private SocketWaiter sw;
22 private final Vector connections = new Vector();
23 private int localPort;
24
25 public TcpMonMonitorEngine()
26 {
27 }
28
29 public void start( SoapMonitor monitor, int localPort )
30 {
31 this.localPort = localPort;
32 sw = new SocketWaiter( "Monitor on port " + localPort, monitor, localPort );
33 }
34
35 public void stop()
36 {
37 if( sw.isAlive())
38 {
39 try
40 {
41 for( int i = 0; i < connections.size(); i++ )
42 {
43 Connection conn = ( Connection ) connections.get( i );
44 conn.halt();
45 }
46 sw.halt();
47 }
48 catch( Throwable e )
49 {
50 SoapUI.log.info( "Error stopping monitor: " + e.toString() );
51 }
52
53 SoapUI.log.info( "Stopped SOAP Monitor on local port " + getLocalPort() );
54 }
55 }
56
57 public int getLocalPort()
58 {
59 return localPort;
60 }
61
62 public boolean isRunning()
63 {
64 return sw != null && sw.isAlive();
65 }
66 }