mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-05 23:22:47 +00:00
Implements better logging while loading ID cache
This commit is contained in:
@@ -205,5 +205,17 @@ public abstract class AbstractDAO<T extends Model<?>, I extends ID<?>>
|
|||||||
return database;
|
return database;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wraps the {@link Model}<?> array into an more specific array
|
||||||
|
*
|
||||||
|
* @param objects
|
||||||
|
* the arrays of objects to be "casted"
|
||||||
|
* @return the wrapped array
|
||||||
|
*/
|
||||||
protected abstract T[] wrap(Model<?>... objects);
|
protected abstract T[] wrap(Model<?>... objects);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return this.getClass().getSimpleName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.l2jserver.service.ServiceStartException;
|
|||||||
import com.l2jserver.service.ServiceStopException;
|
import com.l2jserver.service.ServiceStopException;
|
||||||
import com.l2jserver.service.cache.Cache;
|
import com.l2jserver.service.cache.Cache;
|
||||||
import com.l2jserver.service.cache.CacheService;
|
import com.l2jserver.service.cache.CacheService;
|
||||||
|
import com.l2jserver.service.database.DataAccessObject;
|
||||||
import com.l2jserver.service.database.DatabaseService;
|
import com.l2jserver.service.database.DatabaseService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -118,9 +119,9 @@ public class CachedWorldIDService extends AbstractService implements
|
|||||||
public void load() {
|
public void load() {
|
||||||
log.debug("Loading IDs from database");
|
log.debug("Loading IDs from database");
|
||||||
|
|
||||||
load(characterDao.selectIDs());
|
load(characterDao);
|
||||||
load(itemDao.selectIDs());
|
load(itemDao);
|
||||||
load(npcDao.selectIDs());
|
load(npcDao);
|
||||||
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
}
|
}
|
||||||
@@ -134,12 +135,15 @@ public class CachedWorldIDService extends AbstractService implements
|
|||||||
/**
|
/**
|
||||||
* Load the pre-existing ids
|
* Load the pre-existing ids
|
||||||
*
|
*
|
||||||
* @param ids
|
* @param dao
|
||||||
* an collection of ids
|
* the {@link DataAccessObject} that gives access to the IDs
|
||||||
*/
|
*/
|
||||||
private void load(Collection<? extends ObjectID<?>> ids) {
|
private void load(DataAccessObject<?, ? extends ObjectID<?>> dao) {
|
||||||
Preconditions.checkNotNull(ids, "ids");
|
Preconditions.checkNotNull(dao, "dao");
|
||||||
log.info("Loading {} IDs", ids.size());
|
|
||||||
|
final Collection<? extends ObjectID<?>> ids = dao.selectIDs();
|
||||||
|
log.info("Loaded {} IDs from {}", ids.size(), dao);
|
||||||
|
|
||||||
for (final ObjectID<?> id : ids) {
|
for (final ObjectID<?> id : ids) {
|
||||||
log.debug("Loading {}", id);
|
log.debug("Loading {}", id);
|
||||||
allocator.allocate(id.getID());
|
allocator.allocate(id.getID());
|
||||||
|
|||||||
Reference in New Issue
Block a user