org.apache.tools.ant.Project.getThreadTask()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(114)

本文整理了Java中org.apache.tools.ant.Project.getThreadTask()方法的一些代码示例,展示了Project.getThreadTask()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getThreadTask()方法的具体详情如下:
包路径:org.apache.tools.ant.Project
类名称:Project
方法名:getThreadTask

Project.getThreadTask介绍

[英]Get the current task associated with a thread, if any.
[中]获取与线程关联的当前任务(如果有)。

代码示例

代码示例来源:origin: org.apache.ant/ant

/**
 * Demux an input request to the correct task.
 *
 * @param buffer the buffer into which data is to be read.
 * @param offset the offset into the buffer at which data is stored.
 * @param length the amount of data to read.
 *
 * @return the number of bytes read.
 *
 * @exception IOException if the data cannot be read.
 * @since Ant 1.6
 */
public int demuxInput(final byte[] buffer, final int offset, final int length)
  throws IOException {
  final Task task = getThreadTask(Thread.currentThread());
  if (task == null) {
    return defaultInput(buffer, offset, length);
  }
  return task.handleInput(buffer, offset, length);
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Demultiplex output so that each task receives the appropriate
 * messages. If the current thread is not currently executing a task,
 * the message is logged directly.
 *
 * @param output Message to handle. Should not be <code>null</code>.
 * @param isWarning Whether the text represents an warning (<code>true</code>)
 *        or information (<code>false</code>).
 */
public void demuxOutput(final String output, final boolean isWarning) {
  final Task task = getThreadTask(Thread.currentThread());
  if (task == null) {
    log(output, isWarning ? MSG_WARN : MSG_INFO);
  } else if (isWarning) {
    task.handleErrorOutput(output);
  } else {
    task.handleOutput(output);
  }
}

代码示例来源:origin: org.apache.ant/ant

/**
 * Demultiplex flush operations so that each task receives the appropriate
 * messages. If the current thread is not currently executing a task,
 * the message is logged directly.
 *
 * @since Ant 1.5.2
 *
 * @param output Message to handle. Should not be <code>null</code>.
 * @param isError Whether the text represents an error (<code>true</code>)
 *        or information (<code>false</code>).
 */
public void demuxFlush(final String output, final boolean isError) {
  final Task task = getThreadTask(Thread.currentThread());
  if (task == null) {
    fireMessageLogged(this, output, isError ? MSG_ERR : MSG_INFO);
  } else if (isError) {
    task.handleErrorFlush(output);
  } else {
    task.handleFlush(output);
  }
}

代码示例来源:origin: org.apache.ant/ant

thread = new Thread(this, "ExecuteJava");
Task currentThreadTask
  = project.getThreadTask(Thread.currentThread());

代码示例来源:origin: com.googlecode.flyway/flyway-ant

public void error(String message, Exception e) {
    Task task = antProject.getThreadTask(Thread.currentThread());
    antProject.log(task, message, e, Project.MSG_ERR);
  }
}

代码示例来源:origin: com.googlecode.flyway/flyway-ant

public void debug(String message) {
  Task task = antProject.getThreadTask(Thread.currentThread());
  antProject.log(task, message, Project.MSG_VERBOSE);
}

代码示例来源:origin: com.googlecode.flyway/flyway-ant

public void info(String message) {
  Task task = antProject.getThreadTask(Thread.currentThread());
  antProject.log(task, message, Project.MSG_INFO);
}

代码示例来源:origin: com.googlecode.flyway/flyway-ant

public void error(String message) {
  Task task = antProject.getThreadTask(Thread.currentThread());
  antProject.log(task, message, Project.MSG_ERR);
}

代码示例来源:origin: com.googlecode.flyway/flyway-ant

public void warn(String message) {
  Task task = antProject.getThreadTask(Thread.currentThread());
  antProject.log(task, message, Project.MSG_WARN);
}

相关文章