Program: 64524
Project: 64524
Buggy source:
/** 
 * Create a   {@link PushMeasure} which checks at regular intervals the valueof a  {@link PullMeasure}. If the value have changed since the last check (or since the creation of the   {@link PushMeasure}), a notification will be generated by the   {@link PushMeasure} with the new {@link Value}.<br/> <br/> Notice that if the period is two small, the checking process could have a significant impact on performances, because a   {@link Thread} is run inparallel to check regularly the  {@link Value} modifications. If theperiod is too big, you could miss relevant notifications, especially if the  {@link PullMeasure} change to a new {@link Value} and change back toits previous  {@link Value} between two consecutive checks. In such acase, no notification will be sent because the  {@link Value} during thetwo checks is equal.
 * @param pull the  {@link PullMeasure} to cover
 * @param period the number of milliseconds between each check
 * @return a {@link PushMeasure} which will notify any change occurred onthe  {@link PullMeasure} at the given frequency
 */
public <Value>PushMeasure<Value> createPushFromPull(PullMeasure<Value> pull,final long period){
  SimplePushMeasure<Value> push=new SimplePushMeasure<>(pull.getName(),pull.getDescription());
  final WeakReference<PullMeasure<Value>> weakPull=new WeakReference<PullMeasure<Value>>(pull);
  final WeakReference<SimplePushMeasure<Value>> weakPush=new WeakReference<SimplePushMeasure<Value>>(push);
  final Value initialValue=pull.get();
  Thread thread=new Thread(new Runnable(){
    private Value lastValue=initialValue;
    @Override public void run(){
      boolean isThreadNeeded=true;
      long alreadyConsumed=0;
      while (isThreadNeeded) {
        if (alreadyConsumed > period) {
          long realConsumption=alreadyConsumed;
          long missed=alreadyConsumed / period;
          alreadyConsumed=alreadyConsumed % period;
          log.warning("String_Node_Str" + realConsumption + "String_Node_Str"+ period+ "String_Node_Str"+ missed+ "String_Node_Str"+ alreadyConsumed);
        }
 else {
        }
        try {
          Thread.sleep(period - alreadyConsumed);
        }
 catch (        InterruptedException e) {
          e.printStackTrace();
        }
        long measureStart=System.currentTimeMillis();
        PullMeasure<Value> pull=weakPull.get();
        SimplePushMeasure<Value> push=weakPush.get();
        if (pull == null || push == null) {
          isThreadNeeded=false;
        }
 else {
          Value value=pull.get();
          if (value == lastValue || value != null && value.equals(lastValue)) {
          }
 else {
            lastValue=value;
            push.push(value);
          }
        }
        pull=null;
        push=null;
        long measureEnd=System.currentTimeMillis();
        alreadyConsumed=measureEnd - measureStart;
      }
    }
  }
);
  thread.setDaemon(true);
  thread.start();
  return push;
}

Fixed version (ground truth):
/** 
 * Create a   {@link PushMeasure} which checks at regular intervals the valueof a  {@link PullMeasure}. If the value have changed since the last check (or since the creation of the   {@link PushMeasure}), a notification will be generated by the   {@link PushMeasure} with the new {@link Value}.<br/> <br/> Notice that if the period is two small, the checking process could have a significant impact on performances, because a   {@link Thread} is run inparallel to check regularly the  {@link Value} modifications. If theperiod is too big, you could miss relevant notifications, especially if the  {@link PullMeasure} change to a new {@link Value} and change back toits previous  {@link Value} between two consecutive checks. In such acase, no notification will be sent because the  {@link Value} during thetwo checks is equal.
 * @param pull the  {@link PullMeasure} to cover
 * @param period the number of milliseconds between each check
 * @return a {@link PushMeasure} which will notify any change occurred onthe  {@link PullMeasure} at the given frequency
 */
public <Value>PushMeasure<Value> createPushFromPull(PullMeasure<Value> pull,final long period){
  SimplePushMeasure<Value> push=new SimplePushMeasure<>(pull.getName(),pull.getDescription());
  final WeakReference<PullMeasure<Value>> weakPull=new WeakReference<PullMeasure<Value>>(pull);
  final WeakReference<SimplePushMeasure<Value>> weakPush=new WeakReference<SimplePushMeasure<Value>>(push);
  final Value initialValue=pull.get();
  Thread thread=new Thread(new Runnable(){
    private Value lastValue=initialValue;
    @Override public void run(){
      boolean isThreadNeeded=true;
      long alreadyConsumed=0;
      while (isThreadNeeded) {
        if (alreadyConsumed > period) {
          long realConsumption=alreadyConsumed;
          long missed=alreadyConsumed / period;
          alreadyConsumed=alreadyConsumed % period;
          log.warning("String_Node_Str" + realConsumption + "String_Node_Str"+ period+ "String_Node_Str"+ missed+ "String_Node_Str"+ alreadyConsumed);
        }
 else {
        }
        try {
          Thread.sleep(period - alreadyConsumed);
        }
 catch (        InterruptedException e) {
          throw new JMetalException("String_Node_Str",e);
        }
        long measureStart=System.currentTimeMillis();
        PullMeasure<Value> pull=weakPull.get();
        SimplePushMeasure<Value> push=weakPush.get();
        if (pull == null || push == null) {
          isThreadNeeded=false;
        }
 else {
          Value value=pull.get();
          if (value == lastValue || value != null && value.equals(lastValue)) {
          }
 else {
            lastValue=value;
            push.push(value);
          }
        }
        pull=null;
        push=null;
        long measureEnd=System.currentTimeMillis();
        alreadyConsumed=measureEnd - measureStart;
      }
    }
  }
);
  thread.setDaemon(true);
  thread.start();
  return push;
}