home | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Lucene example source code file (SetPropTask.java)

This example Lucene source code file (SetPropTask.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Lucene tags/keywords

exception, exception, override, override, perftask, setproptask, setproptask, string, string

The Lucene SetPropTask.java source code

package org.apache.lucene.benchmark.byTask.tasks;

import org.apache.lucene.benchmark.byTask.PerfRunData;

 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *     http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.

 * Set a performance test configuration property.
 * A property may have a single value, or a sequence of values, separated by ":". 
 * If a sequence of values is specified, each time a new round starts, 
 * the next (cyclic) value is taken.  
 * <br>Other side effects: none.
 * <br>Takes mandatory param: "name,value" pair. 
 * @see org.apache.lucene.benchmark.byTask.tasks.NewRoundTask
public class SetPropTask extends PerfTask {

  public SetPropTask(PerfRunData runData) {

  private String name;
  private String value;
  public int doLogic() throws Exception {
    if (name==null || value==null) {
      throw new Exception(getName()+" - undefined name or value: name="+name+" value="+value);
    return 0;

   * Set the params (property name and value).
   * @param params property name and value separated by ','.
  public void setParams(String params) {
    int k = params.indexOf(",");
    name = params.substring(0,k).trim();
    value = params.substring(k+1).trim();

  /* (non-Javadoc)
   * @see org.apache.lucene.benchmark.byTask.tasks.PerfTask#supportsParams()
  public boolean supportsParams() {
    return true;


Other Lucene examples (source code examples)

Here is a short list of links related to this Lucene SetPropTask.java source code file:

my book on functional programming


new blog posts


Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.