<commit_before>package org.radargun.stages;

import org.radargun.DistStageAck;
import org.radargun.state.MasterState;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * The warmup stage for web session benchmarks.  This ensures the same access paths are used for the warmup and the
 * actual benchmark.
 *
 * @author <NAME>
 */
public class WebSessionWarmupStage extends WebSessionBenchmarkStage {

   private static final Set<String> WARMED_UP_CONFIGS = new HashSet<String>(2);

   @Override
   public DistStageAck executeOnSlave() {

      String configName = cacheWrapper.getClass().getName() + " - " + cacheWrapper.getInfo();
      DefaultDistStageAck result = new DefaultDistStageAck(slaveIndex, slaveState.getLocalAddress());
      if (!WARMED_UP_CONFIGS.contains(configName)) {
         this.cacheWrapper = slaveState.getCacheWrapper();
         if (cacheWrapper == null) {
            log.info("Not running test on this slave as the wrapper hasn't been configured.");
            return result;
         }

         try {
            long startTime = System.currentTimeMillis();
            doWork();
            long duration = System.currentTimeMillis() - startTime;
            log.info("The warmup took: " + (duration / 1000) + " seconds.");
            result.setPayload(duration);<commit_msg>Fix NPE<commit_after>package org.radargun.stages;

import org.radargun.DistStageAck;
import org.radargun.state.MasterState;

import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * The warmup stage for web session benchmarks.  This ensures the same access paths are used for the warmup and the
 * actual benchmark.
 *
 * @author <NAME>
 */
public class WebSessionWarmupStage extends WebSessionBenchmarkStage {

   private static final Set<String> WARMED_UP_CONFIGS = new HashSet<String>(2);

   @Override
   public DistStageAck executeOnSlave() {
      DefaultDistStageAck result = new DefaultDistStageAck(slaveIndex, slaveState.getLocalAddress());
      this.cacheWrapper = slaveState.getCacheWrapper();
      if (cacheWrapper == null) {
         log.info("Not running test on this slave as the wrapper hasn't been configured.");
         return result;
      }

      String configName = cacheWrapper.getClass().getName() + " - " + cacheWrapper.getInfo();

      if (!WARMED_UP_CONFIGS.contains(configName)) {

         try {
            long startTime = System.currentTimeMillis();
            doWork();
            long duration = System.currentTimeMillis() - startTime;
            log.info("The warmup took: " + (duration / 1000) + " seconds.");
            result.setPayload(duration);
{'fraction_non_alphanumeric': 0.1018867924528302, 'fraction_numerical': 0.0037735849056603774, 'mean_word_length': 3.207936507936508, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2498249', 'n_tokens_mistral': 750, 'n_tokens_neox': 736, 'n_words': 196}