Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.HashMap;

public class Main {
    private static HashMap<String, Thread> threadPool = new HashMap<String, Thread>();

    /**
     * Starts a new thread and then adds the string and thread to the thread
     * pool
     * 
     * @param name
     *            the string to be added
     * @param threadRun
     *            the thread to be executed and added
     */
    public static void spinThreadForPool(String name, Runnable threadRun) {
        Thread spun = new Thread(threadRun);
        spun.start();
        threadPool.put(name, spun);
    }
}