more java 5 cleanups
This commit is contained in:
@ -240,7 +240,7 @@ public class InNetMessagePool implements Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int handleReplies(I2NPMessage messageBody) {
|
public int handleReplies(I2NPMessage messageBody) {
|
||||||
List origMessages = _context.messageRegistry().getOriginalMessages(messageBody);
|
List<OutNetMessage> origMessages = _context.messageRegistry().getOriginalMessages(messageBody);
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Original messages for inbound message: " + origMessages.size());
|
_log.debug("Original messages for inbound message: " + origMessages.size());
|
||||||
if (origMessages.size() > 1) {
|
if (origMessages.size() > 1) {
|
||||||
@ -250,7 +250,7 @@ public class InNetMessagePool implements Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < origMessages.size(); i++) {
|
for (int i = 0; i < origMessages.size(); i++) {
|
||||||
OutNetMessage omsg = (OutNetMessage)origMessages.get(i);
|
OutNetMessage omsg = origMessages.get(i);
|
||||||
ReplyJob job = omsg.getOnReplyJob();
|
ReplyJob job = omsg.getOnReplyJob();
|
||||||
if (_log.shouldLog(Log.DEBUG))
|
if (_log.shouldLog(Log.DEBUG))
|
||||||
_log.debug("Original message [" + i + "] " + omsg.getReplySelector()
|
_log.debug("Original message [" + i + "] " + omsg.getReplySelector()
|
||||||
|
@ -46,18 +46,18 @@ public class OutNetMessage {
|
|||||||
private ReplyJob _onReply;
|
private ReplyJob _onReply;
|
||||||
private Job _onFailedReply;
|
private Job _onFailedReply;
|
||||||
private MessageSelector _replySelector;
|
private MessageSelector _replySelector;
|
||||||
private Set _failedTransports;
|
private Set<String> _failedTransports;
|
||||||
private long _sendBegin;
|
private long _sendBegin;
|
||||||
private long _transmitBegin;
|
private long _transmitBegin;
|
||||||
private Exception _createdBy;
|
private Exception _createdBy;
|
||||||
private long _created;
|
private long _created;
|
||||||
/** for debugging, contains a mapping of even name to Long (e.g. "begin sending", "handleOutbound", etc) */
|
/** for debugging, contains a mapping of even name to Long (e.g. "begin sending", "handleOutbound", etc) */
|
||||||
private HashMap _timestamps;
|
private HashMap<String, Long> _timestamps;
|
||||||
/**
|
/**
|
||||||
* contains a list of timestamp event names in the order they were fired
|
* contains a list of timestamp event names in the order they were fired
|
||||||
* (some JVMs have less than 10ms resolution, so the Long above doesn't guarantee order)
|
* (some JVMs have less than 10ms resolution, so the Long above doesn't guarantee order)
|
||||||
*/
|
*/
|
||||||
private List _timestampOrder;
|
private List<String> _timestampOrder;
|
||||||
private int _queueSize;
|
private int _queueSize;
|
||||||
private long _prepareBegin;
|
private long _prepareBegin;
|
||||||
private long _prepareEnd;
|
private long _prepareEnd;
|
||||||
@ -108,11 +108,11 @@ public class OutNetMessage {
|
|||||||
}
|
}
|
||||||
return now - _created;
|
return now - _created;
|
||||||
}
|
}
|
||||||
public Map getTimestamps() {
|
public Map<String, Long> getTimestamps() {
|
||||||
if (_log.shouldLog(Log.INFO)) {
|
if (_log.shouldLog(Log.INFO)) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
locked_initTimestamps();
|
locked_initTimestamps();
|
||||||
return (Map)_timestamps.clone();
|
return (Map<String, Long>)_timestamps.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Collections.EMPTY_MAP;
|
return Collections.EMPTY_MAP;
|
||||||
@ -121,7 +121,7 @@ public class OutNetMessage {
|
|||||||
if (_log.shouldLog(Log.INFO)) {
|
if (_log.shouldLog(Log.INFO)) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
locked_initTimestamps();
|
locked_initTimestamps();
|
||||||
return (Long)_timestamps.get(eventName);
|
return _timestamps.get(eventName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ZERO;
|
return ZERO;
|
||||||
@ -339,8 +339,8 @@ public class OutNetMessage {
|
|||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
long lastWhen = -1;
|
long lastWhen = -1;
|
||||||
for (int i = 0; i < _timestampOrder.size(); i++) {
|
for (int i = 0; i < _timestampOrder.size(); i++) {
|
||||||
String name = (String)_timestampOrder.get(i);
|
String name = _timestampOrder.get(i);
|
||||||
Long when = (Long)_timestamps.get(name);
|
Long when = _timestamps.get(name);
|
||||||
buf.append("\t[");
|
buf.append("\t[");
|
||||||
long diff = when.longValue() - lastWhen;
|
long diff = when.longValue() - lastWhen;
|
||||||
if ( (lastWhen > 0) && (diff > 500) )
|
if ( (lastWhen > 0) && (diff > 500) )
|
||||||
|
Reference in New Issue
Block a user