Today when we were looking at thread dumps from one of our customers, a hot 
spot was identified in the following line from MessageTransportBase line 86.


    Assert.eval("Wrong handshake message from: "+message.getSource(),!(message 
instanceof TransportHandshakeMessage));


This was a problem because everytime this code was run (which is lot of times), 
a huge string was concatenated and discarded which proved to be a hot spot. 
Another way of writing this would be is to do this.

if(message instanceof TransportHandshakeMessage)) {
   throw new AssertionError("Wrong handshake message from: " + 
message.getSource());
}

This way the error string is not created unless there is an error. This is very 
important esp in code paths that gets run often like in comms layer.

Saravanan

_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev

Reply via email to