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