title: Private Java class properties mysteriously reset between method calls
body: <p>I have a very odd problem. </p>
  
  <p>A class property is mysteriously reset between method calls. </p>
  
  <p>The following code is executed so the constructor is called, then the parseConfiguration method is called. Finally, processData is called.</p>
  
  <p>The parseConfiguration method sets the "recursive" property to "true". However, as soon as it enters "processData", "recursive" becomes "false".</p>
  
  <p>This problem isn't isolated to a single class -- I have several examples of this in my code. </p>
  
  <p>How can this possibly be happening? I've tried initialising properties when they're declared outside any methods, I've tried initialising them in constructors... nothing works.</p>
  
  <p>The only complication I can think of here is that this class is invoked by an object that runs in a thread -- but here is one instance per thread, so surely no chance that threads are interfering. I've tried setting both methods to "synchronized", but this still happens.</p>
  
  <p>I'm on JDK 1.6.0_19 on linux.</p>
  
  <p>Please help!</p>
  
  <pre><code>/**
   * This class or its superclasses are NOT threaded and don't extend Thread
   */
  public class DirectoryAcquirer extends Manipulator
  {
  /**
   * @var Whether to recursively scan directories
   */
  private boolean recursive = false;
  
  /**
   * Constructor
   */
  public DirectoryAcquirer()
  {
  }
  
  /**
   * Constructor that initialises the configuration
   *
   * @param config
   * @throws InvalidConfigurationException
   */
  public DirectoryAcquirer(HierarchicalConfiguration config) throws InvalidConfigurationException
  {
      super(config);
  }
  
  @Override
  protected void parseConfiguration() throws InvalidConfigurationException
  {
      // set whether to recurse into directories or not
      if (this.config.containsKey("recursive"))
      {
      // this.recursive gets set to "true" here
          this.recursive = this.config.getBoolean("recursive");
  
      }
  }
  
  @Override
  public EntityCollection processData(EntityCollection data)
  {
  // here this.recursive is "false"
      this.logger.debug("processData: Entered method");
  }
  }
  </code></pre>