![]() |
QuickJas |
|
What's new in the current release of QuickJas
What is QuickJas
QuickJas is my new products with some friends. It is a multi-process (not multi-thread) Java application server. QuickJas is well designed for OLTP applications with many large size objects in a JVM of a huge heap. You might find that QuickJas could be the simplest Java application server. It utilizes non-invasive POJO classes as services and the users are not required to learn any special API to build a client/server system. QuickJas is written in pure java, however you can also use many native clients to call QuickJas services.
I have the plan to design such an application server long before, But my job is too busy for me to have spare time to write something. Now I am so happy that it is born. Till now I do not use any other project in QuickJas.
QuickJas is free to use except some tiny restrictions. Please consult the LICENSE.txt file in the top directory of QuickJas package.
Why Java?
My friends always think me as a C/C++ developer. But C/C++ is an error-prone language. I have been so tired to help customer developers to find their application problems. Java application is much easier to debug and it is also fast enough now.
Why Multi-Process?
I find all Java application servers using multi-thread because Java is not good at IPC. But if you use a very large heap and many large size objects in your Java applications, the performance of GC is very headache. This is why I created this project.
Installing QuickJas
You can expand QuickJas to any system directory and just use the bin/startJas or bin/stopJas script to start/stop QuickJas server. That's it, very easy.
The only thing that you may have to make sure of is that the "PATH" environment variable is set to hold the path of java executable.
For example:
on Windows:
set PATH=C:\jdk1.5\bin;…or on Unix:
% setenv PATH /usr/local/java:...
(csh)
$ PATH=/usr/java:...
export JAVA_HOME
(ksh, bash)
The bin/startJas or bin/stopJas script is very simple. It only set an environment variable named QUICK_JAS to point to the top directory of QuickJas. For example:
QUICK_JAS=D:\dev\java\QuickJas
Use following commands to start QuickJas:
bin\startJas.bator on Unix:
bin/startJas.sh
Use following commands to stop QuickJas:
bin\stopJas.bator on Unix:
bin/stopJas.sh
If you want to install multiple instances of QuickJas, note to change the ServicePort parameter in conf/QJMain.properties file to different values. The default value is 6080, which is the listening port of QuickJas to receive remote requests.
Configuring QuickJas
There is only configuration file named conf/QJMain.properties for QuickJas. I will introduce all parameters in the file as following:
Log.Level parameter specifies how much information to be logged. Note the following comment before it:
#0=OFF,1=SEVERE,2=WARNING,3=INFO,4=CONFIG,5=FINE,6=FINER,7=FINEST,8=ALL
The conceptions is according to JDK logging API.
JVMComandArguments parameter specifies the command line arguments to start Java application servers (JVM's).
AppServerNum parameter specifies how many Java application servers (JVM's) to be started to process the client requests.
CheckReqInterval parameter is related with performance for advanced users.
ServicePort parameter specifies the port number for QuickJas to wait client requests.
AdminSecret parameter specifies the password for QuickJas administration.
ServiceList parameter specifies the list of user application services. The format is "<Service name1>,<Service name2>,<Service name3>...".
<Service nameN> parameter specifies the full qualified class name of the user application service.
Something besides conf/QJMain.properties file for configuration is that it may be required to change the bin/startJas script, especially for CLASSPATH environment variable, to add something required by your application.
QuickJas Service Application Development
It is not required to learn any new API to write QuickJas service application. If you want to make your java code to be a QuickJas service, you should do as following:
You can find sample service applications in the sample directory. There are 3 sample user services defined in conf/QJMain.properties file. To test the services, you can run bin/test* scripts. Those sample applications are also included in lib/QuickJas.jar file.
QuickJas Client Application Development
It is only required for you to learn only one interface named JasClient with one method named invokeService to call QuickJas services. The method invokeService is defined as following:
byte[] invokeService(java.lang.String server, int port, java.lang.String service, byte[] data) throws JasException, java.io.IOException
This is the entry to access QuickJas service
Parameters:
server - The QuickJas server name or IP address
port - The QuickJas server listening port
service - The QuickJas service name
data - The input data
Returns:
The return value of the service
Throws:
JasException, java.io.IOException
Use following code to create a JasClient object:
lr.quickjas.app.JasClient jc = lr.quickjas.app.JasService.createJasClient();
You can find sample client applications also including many native clients samples in the sample directory. There are 3 sample user services defined in conf/QJMain.properties file. To test the services, you can run bin/test* scripts. Those sample applications are also included in lib/QuickJas.jar file.
Thanks you for your interest in QuickJas. I welcome all feedback at liurui@lrsolution.com.