1 34 35 36 package com.micronova.util.codec; 37 38 import java.util.*; 39 import com.micronova.util.*; 40 41 42 43 public class CodecThread extends Codec 44 { 45 46 47 public static Object sleep(Object object) throws Exception 48 { 49 Long l = TypeUtil.isLong(object); 50 51 if (l != null) 52 { 53 Thread.currentThread().sleep(l.longValue()); 54 } 55 56 return l; 57 } 58 59 60 61 public static Object currentThread() 62 { 63 return Thread.currentThread(); 64 } 65 66 67 68 public static Object join(Object object, Object wait) throws Exception 69 { 70 if (object instanceof Thread ) 71 { 72 ((Thread )object).join(TypeUtil.isLong(wait).longValue()); 73 } 74 75 return object; 76 } 77 78 79 80 public static Object interrupt(Object object) 81 { 82 if (object instanceof Thread ) 83 { 84 ((Thread )object).interrupt(); 85 } 86 87 return object; 88 } 89 90 91 92 public static Object yield() 93 { 94 Thread.yield(); 95 96 return Thread.currentThread(); 97 } 98 99 100 101 public static Object maxPriority() 102 { 103 return new Integer (Thread.MAX_PRIORITY); 104 } 105 106 107 108 public static Object minPriority() 109 { 110 return new Integer (Thread.MIN_PRIORITY); 111 } 112 113 114 115 public static Object normPriority() 116 { 117 return new Integer (Thread.NORM_PRIORITY); 118 } 119 120 121 122 public static Object stop(Object object) 123 { 124 if (object instanceof Thread ) 125 { 126 ((Thread )object).stop(); 127 } 128 129 return object; 130 } 131 132 133 134 public static Object suspend(Object object) 135 { 136 if (object instanceof Thread ) 137 { 138 ((Thread )object).suspend(); 139 } 140 141 return object; 142 } 143 144 145 146 public static Object resume(Object object) 147 { 148 if (object instanceof Thread ) 149 { 150 ((Thread )object).resume(); 151 } 152 153 return object; 154 } 155 } 156 | Popular Tags |