JANOS Register Process

Many times we write an application that should be the only instance of that application running.  That application may monitor inputs, control outputs, send email, or perform logic.  Whatever that application is doing, it should be the only one doing that particular thing at any given time.

The ensure that this happens we use the JANOS.registerProcess(id) method.  This method returns the number of processes that have been registered with that given id.  That id can be any unique identifier given to that application.  It can be a name or a random UUID.

If the registerProcess() method returns a value greater than one then we will exit our application.  This will leave the first instance running.  Here is an example.

        // make sure there is only 1 instance of this application running
        if (1 < JANOS.registerProcess(Application.getAppName())) {
            JANOS.syslog("Another instance of " + Application.getAppName() + " is running");
        }
By | Updated On November 3, 2023 2:42 pm | No Comments | Categories: , | Tags:


INTEG Process Group, inc. © 2023

Real-Time
Mon - Fri, 8am - 4pm EST
P: 724-933-9350
PureChat
Always Available
Contact Form
sales@integpg.com
support@integpg.com

@integpg
@jniordev
10142