public class Pool<T extends de.tsl2.nano.execution.IPRunnable<?,?>> extends Object
IPRunnable implementation. Useful for e.g. Rules,
Queries and Actions.
should be used as singelton by a service-factory. persists its runnables in a directory, given by
getDirectory() (using the pool instance generic type as directory name).
It is possible to hold different extensions of the given generic type. Then you access them through ghe getter
get(String, Class) - otherwise it is sufficient to call get(String) using internally the default
type, evaluated by getType().| Constructor and Description |
|---|
Pool() |
| Modifier and Type | Method and Description |
|---|---|
void |
add(String name,
T runnable)
adds the given runnable to the pool
|
void |
add(T runnable)
delegates to
add(String, IPRunnable) using IPRunnable.getName() |
de.tsl2.nano.execution.IPRunnable |
find(String name) |
T |
get(String name)
gets the runnable by name
|
<I extends T> |
get(String name,
Class<I> type)
gets the runnable by name
|
String |
getDirectory()
getDirectory
|
protected String |
getFileName(String name) |
protected Class<T> |
getType()
default type, given by generic of this instance
|
protected static void |
registerPool(Class<? extends Pool> p) |
void |
reset()
reset
|
public String getDirectory()
protected Class<T> getType()
public de.tsl2.nano.execution.IPRunnable find(String name)
public T get(String name)
name - rule/query to findpublic <I extends T> I get(String name, Class<I> type)
name - runnable to findtype - runnable typepublic void add(T runnable)
add(String, IPRunnable) using IPRunnable.getName()public void add(String name, T runnable)
name - runnable namerunnable - runnable to addpublic void reset()
Copyright © 2012–2018. All rights reserved.