Alinous-Core is written in Java programming language. So Alinous-Core can load Java Classes directly.
In this section, I'll show you how to make and use it. You can learn it from the sample porject of JavaConnector.
The Alinous-Core has a sample project to learn JavaConnector.
- How to create and rebuildSample project
- Implementation of JavaConnector
The Java functions are probyded by a Java Class which contains functions to export into Alinous-Core.
The Alinous-Core server load jar files and resources in the "ALINOUS_HOME/lib/" folder.
The Alinous-Core has own Classloader, and after loaded the folder's jar file, it does operations below.
- Load jar File
- Load all class
- Detect classes which implements IAlinousFunction interface
- Create a instance of the classes which implement the interface
The Alinous-Core class loader automatically create instance of the Class which implements the IAlinousFunction interface. The number of the instance is only one.
Therefor when you implement the Java connector class, you have to think the class's instance become a singleton instance.
When you run the server and jar files in the "ALINOUS_HOME/lib/" folder are changed, the class loader dispose all loaded class and the instances.
After dispose all of them, reload the "ALINOUS_HOME/lib/" folder.