Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.Enumeration;
import java.util.Vector;

public class Main {
    private static Vector threads = new Vector();

    /**
     * Convention is to use class name of the class performing the task as thread name
     * @param threadName
     */
    public static void interrupt(String threadName) {
        Enumeration e = threads.elements();
        while (e.hasMoreElements()) {
            Thread t = (Thread) e.nextElement();
            if (t.getName().equals(threadName)) {
                t.interrupt();
            }
        }
    }
}