-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from FINTprosjektet/event-dispatch
Dispatch SSE events on separate thread pool.
- Loading branch information
Showing
4 changed files
with
126 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,7 @@ fint: | |
queue-endpoint-enabled: true | ||
|
||
springfox: | ||
swagger-https: false | ||
swagger-https: false | ||
|
||
server: | ||
port: 8081 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package no.fint.util; | ||
|
||
import java.util.Collection; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.concurrent.*; | ||
import java.util.stream.Collectors; | ||
|
||
/** | ||
* Executor which useful for unit testing | ||
*/ | ||
public class CurrentThreadExecutor implements ExecutorService { | ||
|
||
@Override | ||
public void execute(Runnable command) { | ||
command.run(); | ||
} | ||
|
||
@Override | ||
public void shutdown() { | ||
} | ||
|
||
@Override | ||
public List<Runnable> shutdownNow() { | ||
return Collections.emptyList(); | ||
} | ||
|
||
@Override | ||
public boolean isShutdown() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isTerminated() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException { | ||
return false; | ||
} | ||
|
||
@Override | ||
public <T> Future<T> submit(Callable<T> task) { | ||
FutureTask<T> f = new FutureTask<T>(task); | ||
f.run(); | ||
return f; | ||
} | ||
|
||
@Override | ||
public <T> Future<T> submit(Runnable task, T result) { | ||
FutureTask<T> f = new FutureTask<T>(task, result); | ||
f.run(); | ||
return f; | ||
} | ||
|
||
@Override | ||
public Future<?> submit(Runnable task) { | ||
FutureTask<?> f = new FutureTask<Void>(task, null); | ||
f.run(); | ||
return f; | ||
} | ||
|
||
@Override | ||
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks) throws InterruptedException { | ||
return tasks.stream().map(this::submit).collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public <T> List<Future<T>> invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException { | ||
return tasks.stream().map(this::submit).collect(Collectors.toList()); | ||
} | ||
|
||
@Override | ||
public <T> T invokeAny(Collection<? extends Callable<T>> tasks) throws InterruptedException, ExecutionException { | ||
return tasks.stream().map(this::submit).findFirst().get().get(); | ||
} | ||
|
||
@Override | ||
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { | ||
return tasks.stream().map(this::submit).findFirst().get().get(); | ||
} | ||
|
||
} |