Class MessageIDGenerator

java.lang.Object
ca.uhn.hl7v2.util.MessageIDGenerator

public class MessageIDGenerator extends Object
Deprecated.
use one of the IDGenerator implementations

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

Also consider using FileBasedHiLoGenerator which provides better performance
Author:
Neal Acharya
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    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 final String
    Deprecated.
    System property key which indicates that this class should never fail.
  • Method Summary

    Modifier and Type
    Method
    Description
    Deprecated.
    Synchronized method used to return the single (static) instance of the class
    Deprecated.
    Synchronized method used to return the incremented id value

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEFAULT_ID_FILE

      public static final 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
    • NEVER_FAIL_PROPERTY

      public static final String NEVER_FAIL_PROPERTY
      Deprecated.
      System property key which indicates that this class should never fail. If this system property is set to false (default is true), as in the following code:
      System.setProperty(MessageIDGenerator.NEVER_FAIL_PROPERTY, Boolean.FALSE.toString());
      this class will fail if the underlying disk file can not be read or written. This means you are roughly guaranteed a unique ID number between JVM sessions (barring the file getting lost or corrupted).
  • Method Details