import java.text.Format;import java.text.SimpleDateFormat;import java.util.Date;import java.util.HashMap;import java.util.Map; /** * * @author Phonnie * */public class StreamId { private static final int MAX_VALUE=9999; private static final String FORMAT = "yyMMdd"; private static final Format DF= new SimpleDateFormat(FORMAT); private static final byte[] lock = new byte[0]; private String prefix = null; private Date date = null; private int number=1; private static Mapmap = new HashMap (); private StreamId(String prefix,Date date){ this.prefix = prefix; this.date = date; } public static StreamId newInstance(String prefix){ Date date = new Date(); return newInstance(prefix,date); } public static StreamId newInstance(String prefix,Date date){ StreamId o = null; synchronized (lock) { String key = getKey(prefix, date); if(map.containsKey(key)){ o = map.get(key); int number = o.getNumber(); if(number