|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
vote for a couple of (very slight) changes
Hello,
We've just integrated MaxQ proxy in the Eclipse console of the CLIF load testing platform. This integration consists of a "New HTTP capture" wizard which first sets maxq configuration properties and then starts the capture, through an Eclipse SWT and JFace GUI. To do this, we had to perform slight changes in classes Config and ProxyServer.
Please find attached the corresponding diff/patch file, and tell me if I may commit these changes. Best regards, -- Bruno.
Index: com/bitmechanic/maxq/Config.java =================================================================== RCS file: /cvs/maxq/java/com/bitmechanic/maxq/Config.java,v retrieving revision 1.22 diff -u -r1.22 Config.java --- com/bitmechanic/maxq/Config.java 18 May 2007 09:39:34 -0000 1.22 +++ com/bitmechanic/maxq/Config.java 8 Sep 2009 15:16:39 -0000 @@ -27,9 +27,9 @@ */ public class Config { - private static Config config = null; + protected static Config config = null; private static final Log log = LogFactory.getLog(Config.class); - private static Properties props; + protected static Properties props; private String pythonPath; private int port = 8090; @@ -138,7 +138,7 @@ config.port = Integer.parseInt(portStr); } - private Config() + protected Config() { } Index: com/bitmechanic/maxq/ProxyServer.java =================================================================== RCS file: /cvs/maxq/java/com/bitmechanic/maxq/ProxyServer.java,v retrieving revision 1.9 diff -u -r1.9 ProxyServer.java --- com/bitmechanic/maxq/ProxyServer.java 18 Feb 2005 16:13:26 -0000 1.9 +++ com/bitmechanic/maxq/ProxyServer.java 8 Sep 2009 15:16:39 -0000 @@ -27,6 +27,7 @@ private Vector listeners; private ServerSocket srvSock; private int count; + private boolean close = false; private static final Log log = LogFactory.getLog(ProxyServer.class); public ProxyServer() throws IOException @@ -74,7 +75,7 @@ public void run() { log.info("Proxy server started on port: " + getLocalPort()); - while (true) { + while (!close) { try { Socket s = srvSock.accept(); RequestHandler handler = new RequestHandler(this, s); @@ -83,7 +84,13 @@ t.start(); count++; } catch (Throwable t) { - SwingMain.reportOutsideException(t); + try { + close = true; + srvSock.close(); + log.info("Connection closed"); + } catch (IOException e) { + SwingMain.reportOutsideException(t); + } } } } @@ -92,5 +99,15 @@ { return srvSock.getLocalPort(); } + + public ServerSocket getServerSocket() + { + return srvSock; + } + + public int getNumberOfRequests() + { + return count; + } } |
|
|
Re: vote for a couple of (very slight) changesSounds good to me.
Bruno Dillenseger wrote: > Hello, > > We've just integrated MaxQ proxy in the Eclipse console of the CLIF > load testing platform. This integration consists of a "New HTTP > capture" wizard which first sets maxq configuration properties and > then starts the capture, through an Eclipse SWT and JFace GUI. > > To do this, we had to perform slight changes in classes Config and > ProxyServer. > > * We need to support extra configuration settings and to reload > these settings dynamically (when the wizard is run again and > again). For this, we inherit from Config.java, but we need to > change from private to protected visibility for 2 attributes and > for the constructor. > * We need to stop and restart maxq proxy server (with a new > configuration) each time the wizard is run. For this, we add a > public getter method for the ProxyServer class' srvSock > attribute, and call the close() method on the ServerSocket in > order to stop it. Then, we catch the thrown exception in the > run() method, set a "close" boolean attribute, and terminate the > thread activity. > * It is interesting to get the number of captured requests. So we > add a public method to get the "count" attribute of class > ProxyServer. > > That's all. Changes are minor and I see no reason why they could > affect the normal functioning of MaxQ. > Please find attached the corresponding diff/patch file, and tell me if > I may commit these changes. > > Best regards, > -- Bruno. > ------------------------------------------------------ http://maxq.tigris.org/ds/viewMessage.do?dsForumId=928&dsMessageId=2392685 To unsubscribe from this discussion, e-mail: [dev-unsubscribe@...]. |
| Free embeddable forum powered by Nabble | Forum Help |