mirror of
https://github.com/2006-Scape/apollo.git
synced 2026-07-03 00:38:21 +00:00
Change many log messages to the fine level.
This commit is contained in:
@@ -44,6 +44,7 @@ public final class Server {
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
try {
|
||||
long start = System.currentTimeMillis();
|
||||
Server server = new Server();
|
||||
server.init(args.length == 1 ? args[0] : Release317.class.getName());
|
||||
|
||||
@@ -53,6 +54,7 @@ public final class Server {
|
||||
|
||||
server.start();
|
||||
server.bind(service, http, jaggrab);
|
||||
logger.fine("Starting apollo took " + (System.currentTimeMillis() - start) + " ms.");
|
||||
} catch (Throwable t) {
|
||||
logger.log(Level.SEVERE, "Error whilst starting server.", t);
|
||||
}
|
||||
@@ -86,7 +88,7 @@ public final class Server {
|
||||
/**
|
||||
* The service manager.
|
||||
*/
|
||||
private final ServiceManager serviceManager;
|
||||
private final ServiceManager serviceManager = new ServiceManager();
|
||||
|
||||
/**
|
||||
* Creates the Apollo server.
|
||||
@@ -95,7 +97,6 @@ public final class Server {
|
||||
*/
|
||||
public Server() throws Exception {
|
||||
logger.info("Starting Apollo...");
|
||||
serviceManager = new ServiceManager();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,10 +107,10 @@ public final class Server {
|
||||
* @param jagGrabAddress The JAGGRAB address to bind to.
|
||||
*/
|
||||
public void bind(SocketAddress serviceAddress, SocketAddress httpAddress, SocketAddress jagGrabAddress) {
|
||||
logger.info("Binding service listener to address: " + serviceAddress + "...");
|
||||
logger.fine("Binding service listener to address: " + serviceAddress + "...");
|
||||
serviceBootstrap.bind(serviceAddress);
|
||||
|
||||
logger.info("Binding HTTP listener to address: " + httpAddress + "...");
|
||||
logger.fine("Binding HTTP listener to address: " + httpAddress + "...");
|
||||
try {
|
||||
httpBootstrap.bind(httpAddress);
|
||||
} catch (Throwable t) {
|
||||
@@ -117,7 +118,7 @@ public final class Server {
|
||||
"Binding to HTTP failed: client will use JAGGRAB as a fallback (not recommended)!", t);
|
||||
}
|
||||
|
||||
logger.info("Binding JAGGRAB listener to address: " + jagGrabAddress + "...");
|
||||
logger.fine("Binding JAGGRAB listener to address: " + jagGrabAddress + "...");
|
||||
jagGrabBootstrap.bind(jagGrabAddress);
|
||||
|
||||
logger.info("Ready for connections.");
|
||||
|
||||
@@ -26,14 +26,16 @@ public final class ServiceManager {
|
||||
/**
|
||||
* The service map.
|
||||
*/
|
||||
private Map<Class<? extends Service>, Service> services = new HashMap<Class<? extends Service>, Service>();
|
||||
private Map<Class<? extends Service>, Service> services = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Creates and initializes the {@link ServiceManager}.
|
||||
*
|
||||
* @throws Exception If an error occurs.
|
||||
* @throws IOException If there is an error reading from the xml file.
|
||||
* @throws SAXException If there is an error parsing the xml file.
|
||||
* @throws ReflectiveOperationException If there is an error accessing or creating services using reflection.
|
||||
*/
|
||||
public ServiceManager() throws Exception {
|
||||
public ServiceManager() throws IOException, SAXException, ReflectiveOperationException {
|
||||
init();
|
||||
}
|
||||
|
||||
@@ -61,30 +63,30 @@ public final class ServiceManager {
|
||||
@SuppressWarnings("unchecked")
|
||||
private void init() throws SAXException, IOException, InstantiationException, IllegalAccessException,
|
||||
ClassNotFoundException {
|
||||
logger.info("Registering services...");
|
||||
logger.fine("Registering services...");
|
||||
|
||||
XmlParser parser = new XmlParser();
|
||||
XmlNode rootNode;
|
||||
XmlNode root;
|
||||
|
||||
try (InputStream is = new FileInputStream("data/services.xml")) {
|
||||
rootNode = parser.parse(is);
|
||||
root = parser.parse(is);
|
||||
}
|
||||
|
||||
if (!rootNode.getName().equals("services")) {
|
||||
if (!root.getName().equals("services")) {
|
||||
throw new IOException("Unexpected name of root node.");
|
||||
}
|
||||
|
||||
for (XmlNode childNode : rootNode) {
|
||||
if (!childNode.getName().equals("service")) {
|
||||
for (XmlNode child : root) {
|
||||
if (!child.getName().equals("service")) {
|
||||
throw new IOException("Unexpected name of child node.");
|
||||
}
|
||||
|
||||
if (!childNode.hasValue()) {
|
||||
if (!child.hasValue()) {
|
||||
throw new IOException("Child node must have a value.");
|
||||
}
|
||||
|
||||
Class<? extends Service> clazz = (Class<? extends Service>) Class.forName(childNode.getValue());
|
||||
register((Class<Service>) clazz, clazz.newInstance());
|
||||
Class<? extends Service> service = (Class<? extends Service>) Class.forName(child.getValue());
|
||||
register((Class<Service>) service, service.newInstance());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,10 +10,10 @@ import java.util.logging.Logger;
|
||||
|
||||
import org.apollo.Service;
|
||||
import org.apollo.fs.IndexedFileSystem;
|
||||
import org.apollo.fs.decoder.GameObjectDecoder;
|
||||
import org.apollo.fs.decoder.ItemDefinitionDecoder;
|
||||
import org.apollo.fs.decoder.NpcDefinitionDecoder;
|
||||
import org.apollo.fs.decoder.ObjectDefinitionDecoder;
|
||||
import org.apollo.fs.decoder.GameObjectDecoder;
|
||||
import org.apollo.game.command.CommandDispatcher;
|
||||
import org.apollo.game.login.LoginDispatcher;
|
||||
import org.apollo.game.login.LogoutDispatcher;
|
||||
@@ -241,29 +241,29 @@ public final class World {
|
||||
ItemDefinitionDecoder itemDefDecoder = new ItemDefinitionDecoder(fs);
|
||||
ItemDefinition[] itemDefs = itemDefDecoder.decode();
|
||||
ItemDefinition.init(itemDefs);
|
||||
logger.info("Loaded " + itemDefs.length + " item definitions.");
|
||||
logger.fine("Loaded " + itemDefs.length + " item definitions.");
|
||||
|
||||
try (InputStream is = new BufferedInputStream(new FileInputStream("data/equipment-" + release + ".dat"))) {
|
||||
EquipmentDefinitionParser parser = new EquipmentDefinitionParser(is);
|
||||
EquipmentDefinition[] defs = parser.parse();
|
||||
EquipmentDefinition.init(defs);
|
||||
logger.info("Loaded " + defs.length + " equipment definitions.");
|
||||
logger.fine("Loaded " + defs.length + " equipment definitions.");
|
||||
}
|
||||
|
||||
NpcDefinitionDecoder npcDecoder = new NpcDefinitionDecoder(fs);
|
||||
NpcDefinition[] npcDefs = npcDecoder.decode();
|
||||
NpcDefinition.init(npcDefs);
|
||||
logger.info("Loaded " + npcDefs.length + " npc definitions.");
|
||||
logger.fine("Loaded " + npcDefs.length + " npc definitions.");
|
||||
|
||||
ObjectDefinitionDecoder objectDecoder = new ObjectDefinitionDecoder(fs);
|
||||
ObjectDefinition[] objDefs = objectDecoder.decode();
|
||||
ObjectDefinition.init(objDefs);
|
||||
logger.info("Loaded " + objDefs.length + " object definitions.");
|
||||
logger.fine("Loaded " + objDefs.length + " object definitions.");
|
||||
|
||||
GameObjectDecoder staticDecoder = new GameObjectDecoder(fs);
|
||||
GameObject[] objects = staticDecoder.decode();
|
||||
placeEntities(objects);
|
||||
logger.info("Loaded " + objects.length + " static objects.");
|
||||
logger.fine("Loaded " + objects.length + " static objects.");
|
||||
|
||||
manager.start();
|
||||
pluginManager = manager; // TODO move!!
|
||||
|
||||
Reference in New Issue
Block a user