import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicro;
public class EmbeddedPayara{
public static void main(String[] args) throws BootstrapException{
PayaraMicro micro = PayaraMicro.getInstance();
micro.bootStrap();
micro.shutdown();
}
}
Stopping an Instance
This section describes how to shut down a Payara Micro instance.
Stopping an Instance from the Command Line
Payara Micro instances can be stopped by either:
-
Using
CTRL-Con the terminal in which Payara Micro is running. -
Sending a kill signal to the process ID of Payara Micro (Since Payara Micro 4.1.1.171)
Stopping an Instance Programmatically
To shut down a Payara Micro instance programmatically, you will need to use the
shutdown() method of the PayaraMicro or PayaraMicroRuntime class.
The shutdown() method of the PayaraMicro class must be called on the instance
of Payara Micro that you want to shut down, so will realistically only be used
on a PayaraMicro instance variable:
The shutdown() method of the PayaraMicroRuntime class is tied to an instance
variable, so is used in much the same way:
import fish.payara.micro.PayaraMicro;
import fish.payara.micro.BootstrapException;
import fish.payara.micro.PayaraMicroRuntime;
public class EmbeddedPayara{
public static void main(String[] args) throws BootstrapException{
PayaraMicroRuntime instance = PayaraMicro.bootstrap();
instance.shutdown();
}
}