小结:
1、初始化jvm;
2、第一次唤醒java命令不快,后续快;
https://github.com/elastic/logstash
Advanced: Drip Launcher
Drip is a tool that solves the slow JVM startup problem while developing Logstash. The drip script is intended to be a drop-in replacement for the java command. We recommend using drip during development, in particular for running tests. Using drip, the first invocation of a command will not be faster but the subsequent commands will be swift.
To tell logstash to use drip, set the environment variable JAVACMD=`which drip`
.
Example (but see the Testing section below before running rspec for the first time):
JAVACMD=`which drip` bin/rspec
https://github.com/ninjudd/drip
Pre-Initialization
By default, Drip only loads your main class at startup, but you can tell Drip to run additional code at startup. This can be used to load classes or execute any initialization code you like. For a language like Clojure, which compiles code on-the-fly, this can be used to precompile commonly used code by requiring it.
To tell Drip how to initialize a new JVM, use the DRIP_INIT
and DRIP_INIT_CLASS
environment variables. DRIP_INIT
should be a newline-separated list of args to be passed to the main()
function of DRIP_INIT_CLASS
. DRIP_INIT_CLASS
defaults to the main class the JVM was started with.