01: package net.javacoding.jspider.core.throttle.impl;
02:
03: import net.javacoding.jspider.core.throttle.Throttle;
04: import net.javacoding.jspider.core.throttle.ThrottleProvider;
05: import net.javacoding.jspider.core.util.config.PropertySet;
06: import net.javacoding.jspider.core.logging.LogFactory;
07: import net.javacoding.jspider.core.logging.Log;
08:
09: /**
10: * Throttle Provider implementation that will create throttle objects that
11: * simulate multiple simultaneous users making requests on the webserver.
12: *
13: * $Id: SimultaneousUsersThrottleProvider.java,v 1.6 2003/04/03 15:57:21 vanrogu Exp $
14: *
15: * @author Günther Van Roey
16: */
17: public class SimultaneousUsersThrottleProvider implements
18: ThrottleProvider {
19:
20: public static final String THINKTIME_MIN = "thinktime.min";
21: public static final String THINKTIME_MAX = "thinktime.max";
22:
23: public static final int THINKTIME_MIN_DEFAULT = 1000;
24: public static final int THINKTIME_MAX_DEFAULT = 1000;
25:
26: /**
27: * Factory method that will create the Throttle implementation for
28: * simultaneous user simulation, with the config parameters defined
29: * in the configuration file.
30: * @return Throttle implementation to be used
31: */
32: public Throttle createThrottle(PropertySet props) {
33:
34: Log log = LogFactory
35: .getLog(SimultaneousUsersThrottleProvider.class);
36:
37: int min = props
38: .getInteger(THINKTIME_MIN, THINKTIME_MIN_DEFAULT);
39: int max = props
40: .getInteger(THINKTIME_MAX, THINKTIME_MAX_DEFAULT);
41:
42: log.debug("min thinktime set to " + min);
43: log.debug("max thinktime set to " + max);
44:
45: return new SimultaneousUsersThrottleImpl(min, max);
46: }
47:
48: }
|