- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
package com.uva.concurrent;
import com.uva.log.Log;
import com.uva.log.Message;
public class ThreadExecutor implements Executor {
private final String name;
public ThreadExecutor(String name) {
this.name = name;
}
public void execute(Runnable target) {
new Thread(target, name).start();
}
/** Execute given runnable in separate thread. All exceptions will be caught.
* @param runnable - runnable to execute. */
public void executeSilent(final Runnable runnable) {
new Thread() {
public void run() {
try {
runnable.run();
}
catch (RuntimeException e) {
Log.exception(name, Message.CRITICAL_ERROR, e);
throw e;
}
}
}.start();
}
}
Видимо, он исключения, не наследуемые от RuntimeException, за исключения не считает. Или исправлял код, пока Eclipse не разрешил ему не объявлять throws.
> executeSilent
Какой silent, все исключения пробрасываются.
Кругом какие-то велосипеды. Одно только import com.uva.log.Log чего стоит.
All your base will belong to us.
http://govnokod.ru/7445 Вот оно!