Last change
on this file was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
597 bytes
|
Rev | Line | |
---|
[85] | 1 | package com.framsticks.util.dispatching; |
---|
| 2 | |
---|
[105] | 3 | import com.framsticks.util.ExceptionHandler; |
---|
[97] | 4 | import com.framsticks.util.FramsticksException; |
---|
[85] | 5 | |
---|
[105] | 6 | public abstract class RunAt<C> implements ExceptionHandler, Runnable { |
---|
[97] | 7 | |
---|
[105] | 8 | protected final ExceptionHandler handler; |
---|
[97] | 9 | |
---|
[105] | 10 | public RunAt(ExceptionHandler handler) { |
---|
[97] | 11 | assert handler != null; |
---|
| 12 | this.handler = handler; |
---|
[85] | 13 | } |
---|
| 14 | |
---|
[97] | 15 | protected abstract void runAt(); |
---|
| 16 | |
---|
| 17 | public final void run() { |
---|
| 18 | try { |
---|
| 19 | runAt(); |
---|
| 20 | } catch (FramsticksException e) { |
---|
| 21 | handle(e); |
---|
| 22 | } |
---|
[85] | 23 | } |
---|
[97] | 24 | |
---|
| 25 | |
---|
| 26 | |
---|
| 27 | @Override |
---|
| 28 | public final void handle(FramsticksException exception) { |
---|
| 29 | handler.handle(exception); |
---|
| 30 | } |
---|
| 31 | |
---|
[85] | 32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.