KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > javacoding > jspider > core > throttle > impl > SimultaneousUsersThrottleProvider


1 package net.javacoding.jspider.core.throttle.impl;
2
3 import net.javacoding.jspider.core.throttle.Throttle;
4 import net.javacoding.jspider.core.throttle.ThrottleProvider;
5 import net.javacoding.jspider.core.util.config.PropertySet;
6 import net.javacoding.jspider.core.logging.LogFactory;
7 import net.javacoding.jspider.core.logging.Log;
8
9
10
11 /**
12  * Throttle Provider implementation that will create throttle objects that
13  * simulate multiple simultaneous users making requests on the webserver.
14  *
15  * $Id: SimultaneousUsersThrottleProvider.java,v 1.6 2003/04/03 15:57:21 vanrogu Exp $
16  *
17  * @author Günther Van Roey
18  */

19 public class SimultaneousUsersThrottleProvider implements ThrottleProvider {
20
21     public static final String JavaDoc THINKTIME_MIN = "thinktime.min";
22     public static final String JavaDoc THINKTIME_MAX = "thinktime.max";
23
24     public static final int THINKTIME_MIN_DEFAULT = 1000;
25     public static final int THINKTIME_MAX_DEFAULT = 1000;
26
27
28     /**
29      * Factory method that will create the Throttle implementation for
30      * simultaneous user simulation, with the config parameters defined
31      * in the configuration file.
32      * @return Throttle implementation to be used
33      */

34     public Throttle createThrottle(PropertySet props) {
35
36         Log log = LogFactory.getLog(SimultaneousUsersThrottleProvider.class);
37
38         int min = props.getInteger(THINKTIME_MIN,THINKTIME_MIN_DEFAULT);
39         int max = props.getInteger(THINKTIME_MAX,THINKTIME_MAX_DEFAULT);
40
41         log.debug("min thinktime set to " + min);
42         log.debug("max thinktime set to " + max);
43
44         return new SimultaneousUsersThrottleImpl ( min, max );
45     }
46
47 }
48
Popular Tags