/** * Synchronized method used to return the single (static) instance of the class */ public static synchronized MessageIDGenerator getInstance() throws IOException { if (messageIdGenerator == null) messageIdGenerator = new MessageIDGenerator(); return messageIdGenerator; }//end method
/** * Constructor * Creates an instance of the class * Its reads an id (longint#) from an external file, if one is not present then the external file * is created and initialized to zero. * This id is stored into the private field of id. */ private MessageIDGenerator() throws IOException { initialize(); }//end constructor code
public String getID() throws IOException { return MessageIDGenerator.getInstance().getNewID(); }
public String getID() throws IOException { return MessageIDGenerator.getInstance().getNewID(); }
/** * Synchronized method used to return the single (static) instance of the class */ public static synchronized MessageIDGenerator getInstance() throws IOException { if (messageIdGenerator == null) messageIdGenerator = new MessageIDGenerator(); return messageIdGenerator; }//end method
/** * Constructor * Creates an instance of the class * Its reads an id (longint#) from an external file, if one is not present then the external file * is created and initialized to zero. * This id is stored into the private field of id. */ private MessageIDGenerator() throws IOException { initialize(); }//end constructor code