1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-05 23:22:47 +00:00

Fixes a bug in ThreadService start method

This commit is contained in:
2011-12-16 13:38:44 -02:00
parent dea1196859
commit 415908a22f
11 changed files with 47 additions and 97 deletions

View File

@@ -62,8 +62,8 @@ public class ThreadServiceImpl extends AbstractService implements ThreadService
@Override
protected void doStart() throws ServiceStartException {
pool = createThreadPool("shared", 20);
threadPools = CollectionFactory.newMap();
pool = createThreadPool("shared", 20);
pool.async(50, TimeUnit.MILLISECONDS, 50, new Runnable() {
@Override

View File

@@ -59,6 +59,16 @@ public abstract class AbstractDAO<T extends Model<?>, I extends ID<?>>
this.database = database;
}
@Override
public AsyncFuture<T> selectAsync(final I id) {
return threadService.async(new Callable<T>() {
@Override
public T call() throws Exception {
return select(id);
}
});
}
@Override
public int save(T object) {
return save(object, false);

View File

@@ -58,6 +58,18 @@ public interface DataAccessObject<O extends Model<?>, I extends ID<?>> extends
*/
O select(I id);
/**
* Asynchronously load the instance represented by <tt>id</tt> from the
* database
*
* @param id
* the id
* @return the {@link AsyncFuture} that will load the selected object.
* {@link AsyncFuture} might return <tt>null</tt> if the object
* could not be found in the database.
*/
AsyncFuture<O> selectAsync(I id);
/**
* Loads an List of all {@link ID}s in the database
*