All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.block.AbstractBlock Maven / Gradle / Ivy

package org.springframework.block;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

public abstract class AbstractBlock implements Block {
  protected final Log logger = LogFactory.getLog(getClass());

  public long timeout;

  public AbstractBlock() {
    this(0);
  }

  public AbstractBlock(long timeout) {
    this.timeout = timeout;
  }

  @Override
  public abstract void eval();

  @Override
  public void run() {
    Runnable run = new Runnable() {
      @Override
      public void run() {
        try {
          eval();
          Thread.sleep(1000);
        }
        catch (InterruptedException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }
      }
    };

    Thread thread = new Thread(run);
    thread.start();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy