added better debug logging

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@380104 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
James Strachan 2006-02-23 12:28:45 +00:00
parent 3d3c4679fd
commit 7dca720f93
1 changed files with 8 additions and 0 deletions

View File

@ -23,12 +23,16 @@ import org.activeio.command.WireFormat;
import org.apache.activemq.command.Command; import org.apache.activemq.command.Command;
import org.apache.activemq.command.WireFormatInfo; import org.apache.activemq.command.WireFormatInfo;
import org.apache.activemq.openwire.OpenWireFormat; import org.apache.activemq.openwire.OpenWireFormat;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch; import edu.emory.mathcs.backport.java.util.concurrent.CountDownLatch;
public class WireFormatNegotiator extends TransportFilter { public class WireFormatNegotiator extends TransportFilter {
private static final Log log = LogFactory.getLog(WireFormatNegotiator.class);
private final WireFormat wireFormat; private final WireFormat wireFormat;
private final int minimumVersion; private final int minimumVersion;
@ -79,6 +83,10 @@ public class WireFormatNegotiator extends TransportFilter {
public void onCommand(Command command) { public void onCommand(Command command) {
if( command.isWireFormatInfo() ) { if( command.isWireFormatInfo() ) {
WireFormatInfo info = (WireFormatInfo) command; WireFormatInfo info = (WireFormatInfo) command;
if (log.isDebugEnabled()) {
log.debug("Received WireFormat: " + info + " with version: 0x" + Integer.toString(info.getVersion(), 16));
}
if( !info.isValid() ) { if( !info.isValid() ) {
commandListener.onException(new IOException("Remote wire format magic is invalid")); commandListener.onException(new IOException("Remote wire format magic is invalid"));
} else if( info.getVersion() < minimumVersion ) { } else if( info.getVersion() < minimumVersion ) {