A Java wraper that simplify the construction of background services
Java
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.settings
dist
src/com/leonardofischer/jss
.classpath
.gitignore
.project
README.md
build.xml

README.md

JSS: Java Simple Services

Introduction

Java Simple Services is a Java wraper that simplify the construction of background process easily. By implementing only one abstract class and creating a default main method on it, your application can run in backgroud, be stoped and you can query for its status without any complex code.

How to Use

Implement the com.leonardofischer.jss.Service. You must implement the void start(String[] commandLineArgs) and void stop(String[] commandLineArgs) methods. Also, you need to implement the main method on your Service implementation, such as the following:

package your.application.package;
public class ApplicationService extends Service {

    public void start(String[] args) {
        // your service implementation goes here
    }

    public void stop(String[] args) {
        // your service stop method goes here
    }

    public static void main(String[] args) {
        ApplicationService appService = new ApplicationService();
        appService.parseArgs(args);
    }
}

Then start your application using:

java your.application.package.ApplicationService start

To stop your application, execute:

java your.application.package.ApplicationService stop

Know Issues and Some Nice-to-have Features

  • Some Service methods are missing documentation.
  • Needs a way to capture/redirect output from the running service.
  • The service doesn't restart if it crashes (but I'm not sure that it should restart)

Download

More Info