public class MessageIDGenerator extends Object
Creates unique message IDs. IDs are stored in a file called hapi.home
/id_file for persistence
across JVM sessions. Note that if one day you run the JVM with a new working directory,
you must move or copy id_file into this directory so that new ID numbers will begin
with the last one used, rather than starting over again.
Note that as of HAPI 2.0, by default this class will not fail even if the id_file can
not be read/written. In this case, HAPI will try to fail gracefully by simply generating
a numeric sequence starting at zero. This behaviour can be overwritten using
NEVER_FAIL_PROPERTY
IDGeneratorFactory
instead.
Also consider using FileBasedHiLoGenerator
which provides better performanceModifier and Type | Field and Description |
---|---|
static String |
DEFAULT_ID_FILE
Deprecated.
Contains the complete path to the default ID file, which is a plain text file containing
the number corresponding to the last generated ID
|
static String |
NEVER_FAIL_PROPERTY
Deprecated.
System property key which indicates that this class should never fail.
|
Modifier and Type | Method and Description |
---|---|
static MessageIDGenerator |
getInstance()
Deprecated.
Synchronized method used to return the single (static) instance of the class
|
String |
getNewID()
Deprecated.
Synchronized method used to return the incremented id value
|
public static final String DEFAULT_ID_FILE
public static final String NEVER_FAIL_PROPERTY
System.setProperty(MessageIDGenerator.NEVER_FAIL_PROPERTY, Boolean.FALSE.toString());
public static MessageIDGenerator getInstance() throws IOException
IOException
public String getNewID() throws IOException
IOException
Copyright © 2001–2017 University Health Network. All rights reserved.