Changeset 4fb3d347


Ignore:
Timestamp:
Apr 10, 2004 10:01:17 AM (17 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d81f42e3
Parents:
9a0a527
git-author:
shendaras <shendaras> (04/10/04 10:01:17)
git-committer:
zzz <zzz@…> (04/10/04 10:01:17)
Message:

see how that looks
(shendaras)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • apps/heartbeat/java/src/net/i2p/heartbeat/ClientConfig.java

    r9a0a527 r4fb3d347  
    1212/**
    1313 * Define the configuration for testing against one particular peer as a client
    14  *
     14 * 
    1515 */
    1616public class ClientConfig {
     17
    1718    private static final Log _log = new Log(ClientConfig.class);
     19
    1820    private Destination _peer;
     21
    1922    private Destination _us;
     23
    2024    private String _statFile;
     25
    2126    private int _statDuration;
     27
    2228    private int _statFrequency;
     29
    2330    private int _sendFrequency;
     31
    2432    private int _sendSize;
     33
    2534    private int _numHops;
     35
    2636    private String _comment;
     37
    2738    private int _averagePeriods[];
    28    
     39
    2940    /**
    3041     * @seeRoutine ClientConfig#load
     
    3243     */
    3344    public static final String PROP_PREFIX = "peer.";
    34    
     45
    3546    /**
    3647     * @seeRoutine ClientConfig#load
     
    3849     */
    3950    public static final String PROP_PEER = ".peer";
    40    
     51
    4152    /**
    4253     * @seeRoutine ClientConfig#load
     
    5061     */
    5162    public static final String PROP_STATDURATION = ".statDuration";
    52    
     63
    5364    /**
    5465     * @seeRoutine ClientConfig#load
     
    6879     */
    6980    public static final String PROP_SENDSIZE = ".sendSize";
    70    
     81
    7182    /**
    7283     * @seeRoutine ClientConfig#load
     
    7485     */
    7586    public static final String PROP_COMMENT = ".comment";
    76    
     87
    7788    /**
    7889     * @seeRoutine ClientConfig#load
     
    8091     */
    8192    public static final String PROP_AVERAGEPERIODS = ".averagePeriods";
    82    
     93
    8394    /**
    8495     * Default constructor...
    8596     */
    8697    public ClientConfig() {
    87         this(null, null, null, -1, -1, -1, -1, 0, null, null);
    88     }
    89    
    90     /**
    91      * @param peer who we will test against
    92      * @param us who we are
    93      * @param duration how many minutes to keep events for
    94      * @param statFreq how often to write out stats
    95      * @param sendFreq how often to send pings
    96      * @param sendSize how large the pings should be
    97      * @param numHops how many hops is the current Heartbeat app using
    98      * @param comment describe this test
    99      * @param averagePeriods list of minutes to summarize over
    100      */
    101     public ClientConfig(Destination peer, Destination us, String statFile, int duration, int statFreq, int sendFreq, int sendSize, int numHops, String comment, int averagePeriods[]) {
    102         _peer = peer;
    103         _us = us;
    104         _statFile = statFile;
    105         _statDuration = duration;
    106         _statFrequency = statFreq;
    107         _sendFrequency = sendFreq;
    108         _sendSize = sendSize;
    109         _numHops = numHops;
    110         _comment = comment;
    111         _averagePeriods = averagePeriods;
    112     }
    113 
    114     /** Retrieves the peer to test against
     98        this(null, null, null, -1, -1, -1, -1, 0, null, null);
     99    }
     100
     101    /**
     102     * @param peer
     103     *            who we will test against
     104     * @param us
     105     *            who we are
     106     * @param duration
     107     *            how many minutes to keep events for
     108     * @param statFreq
     109     *            how often to write out stats
     110     * @param sendFreq
     111     *            how often to send pings
     112     * @param sendSize
     113     *            how large the pings should be
     114     * @param numHops
     115     *            how many hops is the current Heartbeat app using
     116     * @param comment
     117     *            describe this test
     118     * @param averagePeriods
     119     *            list of minutes to summarize over
     120     */
     121    public ClientConfig(Destination peer, Destination us, String statFile,
     122            int duration, int statFreq, int sendFreq, int sendSize,
     123            int numHops, String comment, int averagePeriods[]) {
     124        _peer = peer;
     125        _us = us;
     126        _statFile = statFile;
     127        _statDuration = duration;
     128        _statFrequency = statFreq;
     129        _sendFrequency = sendFreq;
     130        _sendSize = sendSize;
     131        _numHops = numHops;
     132        _comment = comment;
     133        _averagePeriods = averagePeriods;
     134    }
     135
     136    /**
     137     * Retrieves the peer to test against
     138     *
    115139     * @return the Destination (peer)
    116140     */
    117     public Destination getPeer() { return _peer; }
     141    public Destination getPeer() {
     142        return _peer;
     143    }
    118144
    119145    /**
    120146     * Sets the peer to test against
    121      * @param peer the Destination (peer)
    122      */
    123     public void setPeer(Destination peer) { _peer = peer; }
    124 
    125    
    126     /**
    127      * Retrieves who we are when we test
     147     *
     148     * @param peer
     149     *            the Destination (peer)
     150     */
     151    public void setPeer(Destination peer) {
     152        _peer = peer;
     153    }
     154
     155    /**
     156     * Retrieves who we are when we test
     157     *
    128158     * @return the Destination (us)
    129159     */
    130     public Destination getUs() { return _us; }
    131    
     160    public Destination getUs() {
     161        return _us;
     162    }
     163
    132164    /**
    133165     * Sets who we are when we test
    134      * @param us the Destination (us)
    135      */
    136     public void setUs(Destination us) { _us = us; }
    137 
    138     /**
    139      * Retrieves the location to write the current stats to
     166     *
     167     * @param us
     168     *            the Destination (us)
     169     */
     170    public void setUs(Destination us) {
     171        _us = us;
     172    }
     173
     174    /**
     175     * Retrieves the location to write the current stats to
     176     *
    140177     * @return the name of the file
    141178     */
    142     public String getStatFile() { return _statFile; }
    143    
     179    public String getStatFile() {
     180        return _statFile;
     181    }
     182
    144183    /**
    145184     * Sets the name of the location we write the current stats to
    146      * @param statFile the name of the file
    147      */
    148     public void setStatFile(String statFile) { _statFile = statFile; }
    149    
    150     /**
    151      * Retrieves how many minutes of statistics should be maintained within the window for this client
     185     *
     186     * @param statFile
     187     *            the name of the file
     188     */
     189    public void setStatFile(String statFile) {
     190        _statFile = statFile;
     191    }
     192
     193    /**
     194     * Retrieves how many minutes of statistics should be maintained within the
     195     * window for this client
     196     *
    152197     * @return the number of minutes
    153198     */
    154     public int getStatDuration() { return _statDuration; }
    155 
    156     /**
    157      * Sets how many minutes of statistics should be maintained within the window for this client
    158      * @param durationMinutes the number of minutes
    159      */
    160     public void setStatDuration(int durationMinutes) { _statDuration = durationMinutes; }
    161    
    162     /**
    163      * Retrieves how frequently the stats are written out (in seconds)
     199    public int getStatDuration() {
     200        return _statDuration;
     201    }
     202
     203    /**
     204     * Sets how many minutes of statistics should be maintained within the
     205     * window for this client
     206     *
     207     * @param durationMinutes
     208     *            the number of minutes
     209     */
     210    public void setStatDuration(int durationMinutes) {
     211        _statDuration = durationMinutes;
     212    }
     213
     214    /**
     215     * Retrieves how frequently the stats are written out (in seconds)
     216     *
    164217     * @return the frequency in seconds
    165218     */
    166     public int getStatFrequency() { return _statFrequency; }
    167    
     219    public int getStatFrequency() {
     220        return _statFrequency;
     221    }
     222
    168223    /**
    169224     * Sets how frequently the stats are written out (in seconds)
    170      * @param freqSeconds the frequency in seconds
    171      */
    172     public void setStatFrequency(int freqSeconds) { _statFrequency = freqSeconds; }
    173    
    174     /**
    175      * Retrieves how frequenty we send messages to the peer (in seconds)
     225     *
     226     * @param freqSeconds
     227     *            the frequency in seconds
     228     */
     229    public void setStatFrequency(int freqSeconds) {
     230        _statFrequency = freqSeconds;
     231    }
     232
     233    /**
     234     * Retrieves how frequenty we send messages to the peer (in seconds)
     235     *
    176236     * @return the frequency in seconds
    177237     */
    178     public int getSendFrequency() { return _sendFrequency; }
    179    
     238    public int getSendFrequency() {
     239        return _sendFrequency;
     240    }
     241
    180242    /**
    181243     * Sets how frequenty we send messages to the peer (in seconds)
    182      * @param freqSeconds the frequency in seconds
    183      */
    184     public void setSendFrequency(int freqSeconds) { _sendFrequency = freqSeconds; }
    185    
    186     /**
    187      * Retrieves how many bytes the ping messages should be
    188      * (min values ~700, max ~32KB)
     244     *
     245     * @param freqSeconds
     246     *            the frequency in seconds
     247     */
     248    public void setSendFrequency(int freqSeconds) {
     249        _sendFrequency = freqSeconds;
     250    }
     251
     252    /**
     253     * Retrieves how many bytes the ping messages should be (min values ~700,
     254     * max ~32KB)
     255     *
    189256     * @return the size in bytes
    190257     */
    191     public int getSendSize() { return _sendSize; }
    192 
    193     /**
    194      * Sets how many bytes the ping messages should be
    195      * (min values ~700, max ~32KB)
    196      * @param numBytes the size in bytes
    197      */
    198     public void setSendSize(int numBytes) { _sendSize = numBytes; }
    199    
    200     /**
    201      * Retrieves the brief, 1 line description of the test. 
    202      * Useful comments are along the lines of "The peer is located on a fast router and connection with 2 hop tunnels".
     258    public int getSendSize() {
     259        return _sendSize;
     260    }
     261
     262    /**
     263     * Sets how many bytes the ping messages should be (min values ~700, max
     264     * ~32KB)
     265     *
     266     * @param numBytes
     267     *            the size in bytes
     268     */
     269    public void setSendSize(int numBytes) {
     270        _sendSize = numBytes;
     271    }
     272
     273    /**
     274     * Retrieves the brief, 1 line description of the test. Useful comments are
     275     * along the lines of "The peer is located on a fast router and connection
     276     * with 2 hop tunnels".
    203277     *
    204278     * @return the brief comment
    205279     */
    206     public String getComment() { return _comment; }
     280    public String getComment() {
     281        return _comment;
     282    }
     283
    207284    /**
    208285     * Sets a brief, 1 line description (comment) of the test.
    209      * @param comment the brief comment
    210      */
    211     public void setComment(String comment) { _comment = comment; }
    212    
     286     *
     287     * @param comment
     288     *            the brief comment
     289     */
     290    public void setComment(String comment) {
     291        _comment = comment;
     292    }
     293
    213294    /**
    214295     * Retrieves the periods that the client's tests should be averaged over.
    215      * @return list of periods (in minutes) that the data should be averaged over, or null
    216      */
    217     public int[] getAveragePeriods() { return _averagePeriods; }
     296     *
     297     * @return list of periods (in minutes) that the data should be averaged
     298     *         over, or null
     299     */
     300    public int[] getAveragePeriods() {
     301        return _averagePeriods;
     302    }
    218303
    219304    /**
    220305     * Sets the periods that the client's tests should be averaged over.
    221      * @param periods the list of periods (in minutes) that the data should be averaged over, or null
    222      */
    223     public void setAveragePeriods(int periods[]) { _averagePeriods = periods; }
    224    
    225     /**
    226      * Retrieves how many hops this test engine is configured to use for its outbound and inbound tunnels
     306     *
     307     * @param periods
     308     *            the list of periods (in minutes) that the data should be
     309     *            averaged over, or null
     310     */
     311    public void setAveragePeriods(int periods[]) {
     312        _averagePeriods = periods;
     313    }
     314
     315    /**
     316     * Retrieves how many hops this test engine is configured to use for its
     317     * outbound and inbound tunnels
     318     *
    227319     * @return the number of hops
    228320     */
    229     public int getNumHops() { return _numHops; }
    230    
    231     /**
    232      * Sets how many hops this test engine is configured to use for its outbound and inbound tunnels
    233      * @param numHops the number of hops
    234      */
    235     public void setNumHops(int numHops) { _numHops = numHops; }
    236    
    237     /**
    238      * Load the client config from the properties specified, deriving the current
     321    public int getNumHops() {
     322        return _numHops;
     323    }
     324
     325    /**
     326     * Sets how many hops this test engine is configured to use for its outbound
     327     * and inbound tunnels
     328     *
     329     * @param numHops
     330     *            the number of hops
     331     */
     332    public void setNumHops(int numHops) {
     333        _numHops = numHops;
     334    }
     335
     336    /**
     337     * Load the client config from the properties specified, deriving the
     338     * current config entry from the peer number.
     339     *
     340     * @param clientConfig
     341     *            the properties to load from
     342     * @param peerNum
     343     *            the number associated with the peer
     344     * @return true if it was loaded correctly, false if there were errors
     345     */
     346    public boolean load(Properties clientConfig, int peerNum) {
     347        if ((clientConfig == null) || (peerNum < 0)) return false;
     348        String peerVal = clientConfig.getProperty(PROP_PREFIX + peerNum
     349                + PROP_PEER);
     350        String statFileVal = clientConfig.getProperty(PROP_PREFIX + peerNum
     351                + PROP_STATFILE);
     352        String statDurationVal = clientConfig.getProperty(PROP_PREFIX + peerNum
     353                + PROP_STATDURATION);
     354        String statFrequencyVal = clientConfig.getProperty(PROP_PREFIX
     355                + peerNum + PROP_STATFREQUENCY);
     356        String sendFrequencyVal = clientConfig.getProperty(PROP_PREFIX
     357                + peerNum + PROP_SENDFREQUENCY);
     358        String sendSizeVal = clientConfig.getProperty(PROP_PREFIX + peerNum
     359                + PROP_SENDSIZE);
     360        String commentVal = clientConfig.getProperty(PROP_PREFIX + peerNum
     361                + PROP_COMMENT);
     362        String periodsVal = clientConfig.getProperty(PROP_PREFIX + peerNum
     363                + PROP_AVERAGEPERIODS);
     364
     365        if ((peerVal == null) || (statFileVal == null)
     366                || (statDurationVal == null) || (statFrequencyVal == null)
     367                || (sendFrequencyVal == null) || (sendSizeVal == null)) {
     368            if (_log.shouldLog(Log.DEBUG)) {
     369                _log.debug("Peer number " + peerNum + " does not exist");
     370            }
     371            return false;
     372        }
     373
     374        try {
     375            int duration = getInt(statDurationVal);
     376            int statFreq = getInt(statFrequencyVal);
     377            int sendFreq = getInt(sendFrequencyVal);
     378            int sendSize = getInt(sendSizeVal);
     379
     380            if ((duration <= 0) || (statFreq <= 0) || (sendFreq <= 0)
     381                    || (sendSize <= 0)) {
     382                if (_log.shouldLog(Log.WARN)) {
     383                    _log.warn("Invalid client config: duration ["
     384                            + statDurationVal + "] stat frequency ["
     385                            + statFrequencyVal + "] send frequency ["
     386                            + sendFrequencyVal + "] send size [" + sendSizeVal
     387                            + "]");
     388                }
     389                return false;
     390            }
     391
     392            statFileVal = statFileVal.trim();
     393            if (statFileVal.length() <= 0) {
     394                if (_log.shouldLog(Log.WARN)) {
     395                    _log.warn("Stat file is blank for peer " + peerNum);
     396                }
     397                return false;
     398            }
     399
     400            Destination d = new Destination();
     401            d.fromBase64(peerVal);
     402
     403            if (commentVal == null) {
     404                commentVal = "";
     405            }
     406
     407            commentVal = commentVal.trim();
     408            commentVal = commentVal.replace('\n', '_');
     409
     410            List periods = new ArrayList(4);
     411            if (periodsVal != null) {
     412                StringTokenizer tok = new StringTokenizer(periodsVal);
     413                while (tok.hasMoreTokens()) {
     414                    String periodVal = tok.nextToken();
     415                    int minutes = getInt(periodVal);
     416                    if (minutes > 0) {
     417                        periods.add(new Integer(minutes));
     418                    }
     419                }
     420            }
     421            int avgPeriods[] = new int[periods.size()];
     422            for (int i = 0; i < periods.size(); i++) {
     423                avgPeriods[i] = ((Integer) periods.get(i)).intValue();
     424            }
     425
     426            _comment = commentVal;
     427            _statDuration = duration;
     428            _statFrequency = statFreq;
     429            _sendFrequency = sendFreq;
     430            _sendSize = sendSize;
     431            _statFile = statFileVal;
     432            _peer = d;
     433            _averagePeriods = avgPeriods;
     434            return true;
     435        } catch (DataFormatException dfe) {
     436            _log.error("Peer destination for " + peerNum + " was invalid: "
     437                    + peerVal);
     438            return false;
     439        }
     440    }
     441
     442    /**
     443     * Store the client config to the properties specified, deriving the current
    239444     * config entry from the peer number.
    240      *
    241      * @param clientConfig the properties to load from
    242      * @param peerNum the number associated with the peer
    243      * @return true if it was loaded correctly, false if there were errors
    244      */
    245     public boolean load(Properties clientConfig, int peerNum) {
    246         if ( (clientConfig == null) || (peerNum < 0) ) return false;
    247         String peerVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_PEER);
    248         String statFileVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATFILE);
    249         String statDurationVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATDURATION);
    250         String statFrequencyVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_STATFREQUENCY);
    251         String sendFrequencyVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_SENDFREQUENCY);
    252         String sendSizeVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_SENDSIZE);
    253         String commentVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_COMMENT);
    254         String periodsVal = clientConfig.getProperty(PROP_PREFIX + peerNum + PROP_AVERAGEPERIODS);
    255        
    256         if ( (peerVal == null) || (statFileVal == null) || (statDurationVal == null) ||
    257              (statFrequencyVal == null) || (sendFrequencyVal == null) || (sendSizeVal == null) ) {
    258             if (_log.shouldLog(Log.DEBUG)) {
    259                     _log.debug("Peer number "+ peerNum + " does not exist");
     445     *
     446     * @param clientConfig
     447     *            the properties to store to
     448     * @param peerNum
     449     *            the number associated with the peer
     450     * @return true if it was stored correctly, false if there were errors
     451     */
     452    public boolean store(Properties clientConfig, int peerNum) {
     453        if ((_peer == null) || (_sendFrequency <= 0) || (_sendSize <= 0)
     454                || (_statDuration <= 0) || (_statFrequency <= 0)
     455                || (_statFile == null)) { return false; }
     456
     457        String comment = _comment;
     458        if (comment == null) {
     459            comment = "";
    260460        }
    261             return false;
    262         }
    263        
    264        
    265         try {
    266             int duration = getInt(statDurationVal);
    267             int statFreq = getInt(statFrequencyVal);
    268             int sendFreq = getInt(sendFrequencyVal);
    269             int sendSize = getInt(sendSizeVal);
    270            
    271             if ( (duration <= 0) || (statFreq <= 0) || (sendFreq <= 0) || (sendSize <= 0) ) {
    272                 if (_log.shouldLog(Log.WARN)) {
    273                     _log.warn("Invalid client config: duration [" + statDurationVal + "] stat frequency [" + statFrequencyVal +
    274                               "] send frequency [" + sendFrequencyVal + "] send size [" + sendSizeVal + "]");
     461
     462        comment = comment.trim();
     463        comment = comment.replace('\n', '_');
     464
     465        StringBuffer buf = new StringBuffer(32);
     466        if (_averagePeriods != null) {
     467            for (int i = 0; i < _averagePeriods.length; i++) {
     468                buf.append(_averagePeriods[i]).append(' ');
     469            }
    275470        }
    276                 return false;
    277             }
    278            
    279             statFileVal = statFileVal.trim();
    280             if (statFileVal.length() <= 0) {
    281                 if (_log.shouldLog(Log.WARN)) {
    282                     _log.warn("Stat file is blank for peer " + peerNum);
     471
     472        clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_PEER, _peer
     473                .toBase64());
     474        clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFILE,
     475                _statFile);
     476        clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATDURATION,
     477                _statDuration + "");
     478        clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFREQUENCY,
     479                _statFrequency + "");
     480        clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDFREQUENCY,
     481                _sendFrequency + "");
     482        clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDSIZE,
     483                _sendSize + "");
     484        clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_COMMENT, comment);
     485        clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_AVERAGEPERIODS,
     486                buf.toString());
     487        return true;
     488    }
     489
     490    private static final int getInt(String val) {
     491        if (val == null) return -1;
     492        try {
     493            int i = Integer.parseInt(val);
     494            return i;
     495        } catch (NumberFormatException nfe) {
     496            if (_log.shouldLog(Log.DEBUG)) {
     497                _log.debug("Value [" + val + "] is not a valid integer");
     498            }
     499            return -1;
    283500        }
    284                 return false;
    285             }
    286            
    287             Destination d = new Destination();
    288             d.fromBase64(peerVal);
    289            
    290             if (commentVal == null) {
    291                     commentVal = "";
    292         }
    293            
    294         commentVal = commentVal.trim();
    295             commentVal = commentVal.replace('\n', '_');
    296            
    297             List periods = new ArrayList(4);
    298             if (periodsVal != null) {
    299                 StringTokenizer tok = new StringTokenizer(periodsVal);
    300                 while (tok.hasMoreTokens()) {
    301                     String periodVal = tok.nextToken();
    302                     int minutes = getInt(periodVal);
    303                     if (minutes > 0) {
    304                             periods.add(new Integer(minutes));
    305             }
    306                 }
    307             }
    308             int avgPeriods[] = new int[periods.size()];
    309             for (int i = 0; i < periods.size(); i++) {
    310                     avgPeriods[i] = ((Integer)periods.get(i)).intValue();
    311         }
    312            
    313             _comment = commentVal;
    314             _statDuration = duration;
    315             _statFrequency = statFreq;
    316             _sendFrequency = sendFreq;
    317             _sendSize = sendSize;
    318             _statFile = statFileVal;
    319             _peer = d;
    320             _averagePeriods = avgPeriods;
    321             return true;
    322         } catch (DataFormatException dfe) {
    323             _log.error("Peer destination for " + peerNum + " was invalid: " + peerVal);
    324             return false;
    325         }
    326     }
    327    
    328     /**
    329      * Store the client config to the properties specified, deriving the current
    330      * config entry from the peer number.
    331      *
    332      * @param clientConfig the properties to store to
    333      * @param peerNum the number associated with the peer
    334      * @return true if it was stored correctly, false if there were errors
    335      */
    336     public boolean store(Properties clientConfig, int peerNum) {
    337         if ( (_peer == null) || (_sendFrequency <= 0) || (_sendSize <= 0) ||
    338              (_statDuration <= 0) || (_statFrequency <= 0) || (_statFile == null) ) {
    339             return false;
    340         }
    341        
    342         String comment = _comment;
    343         if (comment == null) {
    344             comment = "";
    345     }
    346        
    347     comment = comment.trim();
    348         comment = comment.replace('\n', '_');
    349        
    350         StringBuffer buf = new StringBuffer(32);
    351         if (_averagePeriods != null) {
    352             for (int i = 0; i < _averagePeriods.length; i++) {
    353                 buf.append(_averagePeriods[i]).append(' ');
    354             }
    355         }
    356 
    357         clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_PEER, _peer.toBase64());
    358         clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFILE, _statFile);
    359         clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATDURATION, _statDuration + "");
    360         clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_STATFREQUENCY, _statFrequency + "");
    361         clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDFREQUENCY, _sendFrequency + "");
    362         clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_SENDSIZE, _sendSize + "");
    363         clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_COMMENT, comment);
    364         clientConfig.setProperty(PROP_PREFIX + peerNum + PROP_AVERAGEPERIODS, buf.toString());
    365         return true;
    366     }
    367 
    368     private static final int getInt(String val) {
    369         if (val == null) return -1;
    370         try {
    371             int i = Integer.parseInt(val);
    372             return i;
    373         } catch (NumberFormatException nfe) {
    374             if (_log.shouldLog(Log.DEBUG)) {
    375                     _log.debug("Value [" + val + "] is not a valid integer");
    376         }
    377             return -1;
    378         }
    379501    }
    380502}
Note: See TracChangeset for help on using the changeset viewer.