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

gw.util.process.OutputBuffer Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2014 Guidewire Software, Inc.
 */

package gw.util.process;

import java.io.StringWriter;
import java.util.concurrent.locks.ReentrantLock;

/**
 */
class OutputBuffer extends StringWriter implements OutputHandler {
  private final ReentrantLock _lock = new ReentrantLock();

  @Override
  public void handleLine(String line) {
    _lock.lock();
    try {
      append(line).append('\n');
    } finally {
      _lock.unlock();
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy