Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;
import java.util.concurrent.*;

public class Main {
    /**
     * 
     */
    protected static void decorateProperties(ThreadPoolExecutor executor, Properties properties) {
        if (executor != null) {
            if (properties != null) {
                properties.setProperty("thread-keep-alive-time",
                        Long.toString(executor.getKeepAliveTime(TimeUnit.MILLISECONDS)));

                properties.setProperty("thread-pool-size-largest", Integer.toString(executor.getLargestPoolSize()));

                properties.setProperty("thread-pool-size-minimum", Integer.toString(executor.getCorePoolSize()));

                properties.setProperty("thread-pool-size-maximum", Integer.toString(executor.getMaximumPoolSize()));

                properties.setProperty("thread-pool-size", Integer.toString(executor.getPoolSize()));

                properties.setProperty("runnable-completed-count", Long.toString(executor.getCompletedTaskCount()));

                properties.setProperty("runnable-active-count", Integer.toString(executor.getActiveCount()));

                properties.setProperty("queue-size", Integer.toString(executor.getQueue().size()));

                properties.setProperty("queue-capacity-remaining",
                        Integer.toString(executor.getQueue().remainingCapacity()));
            }
        }
    }
}