@Override public String toString() { if ( formatter == null ) { return "__ALL__"; } return formatter.getPattern(); } }
/** * Returns the current Date in the specified format. * * @param format The format for the output date * @return the current date in the specified format. */ public static String getDate(String format) { if (df == null || !format.equals(df.getPattern())) { df = FastDateFormat.getInstance(format); } return df.format(new Date()); }
/** * Returns the current Date in the specified format. * * @param format The format for the output date * @return the current date in the specified format. */ public static String getDate(String format) { if (df == null || !format.equals(df.getPattern())) { df = FastDateFormat.getInstance(format); } return df.format(new Date()); }
/** * Returns the current Date in the specified format. * * @param format The format for the output date * @return the current date in the specified format. */ public static String getDate(String format) { if (df == null || !format.equals(df.getPattern())) { df = FastDateFormat.getInstance(format); } return df.format(new Date()); }
public synchronized void merge(byte[] content, int idx) throws NotSupportedException { if (idxBitset.get(idx)) { logger.warn("have received the same index:{} of Message. do not merge this content.{},origin:{},{},{},new content:{}", idx,this.serviceNum, LongMessageFrameHolder.buildTextMessage(this.content[idx], msgfmt).getText(), DateFormatUtils.format(getTimestamp(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern()), getSequence(), LongMessageFrameHolder.buildTextMessage(content, msgfmt).getText()); throw new NotSupportedException("received the same index"); } if (this.content.length <= idx || idx < 0) { logger.warn("have received error index:{} of Message content length:{}. do not merge this content.{},{},{},{}", idx, this.content.length, this.serviceNum, DateFormatUtils.format(getTimestamp(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern()), getSequence(), LongMessageFrameHolder.buildTextMessage(content, msgfmt).getText()); throw new NotSupportedException("have received error index"); } // 设置该短信序号已填冲 idxBitset.set(idx); this.content[idx] = content; this.totalbyteLength += this.content[idx].length; }
@Override public void onRemoval(RemovalNotification<String, FrameHolder> notification) { RemovalCause cause = notification.getCause(); FrameHolder h = notification.getValue(); switch (cause) { case EXPIRED: case SIZE: case COLLECTED: logger.error("Long Message Lost cause by {}. {}|{}|{}|{}", cause, DateFormatUtils.format(h.getTimestamp(), DateFormatUtils.ISO_DATETIME_FORMAT.getPattern()), notification.getKey(), h.getSequence(), buildTextMessage(h.mergeAllcontent(), h.getMsgfmt()).getText()); default: return; } } };