aboutsummaryrefslogtreecommitdiff
path: root/src/ModulusThreads.java
blob: a66424935c6db5facc87828a612d9746145ec86d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*    */ import java.util.LinkedHashMap;
/*    */ import java.util.Map;
/*    */ 
/*    */ public class ModulusThreads
/*    */ {
/*  8 */   private static Map<String, Thread> executing = new LinkedHashMap();
/*    */ 
/* 10 */   public static void addThread(String key, Thread thread) { if (executing.containsKey(key)) {
/* 11 */       executing.remove(key);
/* 12 */       executing.put(key, thread);
/*    */     }
/*    */ 
/* 15 */     executing.put(key, thread);
/* 16 */     if (!thread.isAlive())
/* 17 */       thread.start(); }
/*    */ 
/*    */   public static void addRunnable(String key, Runnable x)
/*    */   {
/* 21 */     addThread(key, new Thread(x));
/*    */   }
/*    */   public static Thread getThread(String key) {
/* 24 */     return (Thread)executing.get(key);
/*    */   }
/*    */   public static void removeThread(String key) {
/* 27 */     Thread temp = (Thread)executing.get(key);
/* 28 */     executing.remove(key);
/*    */   }
/*    */ }

/* Location:           Modulus.jar
 * Qualified Name:     ModulusThreads
 * JD-Core Version:    0.6.2
 */