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

com.arextest.diff.factory.CallerRunsPolicyWithReport Maven / Gradle / Ivy

There is a newer version: 0.2.15
Show newest version
package com.arextest.diff.factory;

import java.util.concurrent.ThreadPoolExecutor;

public class CallerRunsPolicyWithReport extends ThreadPoolExecutor.CallerRunsPolicy {


  private String threadPoolName;

  public CallerRunsPolicyWithReport() {
    super();
  }

  public CallerRunsPolicyWithReport(String threadPoolName) {
    this.threadPoolName = threadPoolName;
  }


  @Override
  public void rejectedExecution(Runnable r, ThreadPoolExecutor e) {
    String msg = String.format("The thread pool [%s] is full! Task: %d (completed: %d), Queue: %d",
        threadPoolName, e.getTaskCount(), e.getCompletedTaskCount(), e.getQueue().size());
    super.rejectedExecution(r, e);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy