diff src/alice/datasegment/LocalDataSegmentManager.java @ 71:a3a2605e16a2

change checking debug mode of logger
author kazz <kazz@cr.ie.u-ryukyu.ac.jp>
date Tue, 21 Feb 2012 21:10:15 +0900
parents 1d4f2b72fb31
children 4bfd81352cfa 1044a79ce4ef
line wrap: on
line diff
--- a/src/alice/datasegment/LocalDataSegmentManager.java	Tue Feb 21 20:09:18 2012 +0900
+++ b/src/alice/datasegment/LocalDataSegmentManager.java	Tue Feb 21 21:10:15 2012 +0900
@@ -14,7 +14,6 @@
 	private ConcurrentHashMap<String, DataSegmentKey> dataSegments = new ConcurrentHashMap<String, DataSegmentKey>();
 	private LinkedBlockingQueue<KeyCommand> cmdQueue = new LinkedBlockingQueue<KeyCommand>();
 	private Logger logger = Logger.getLogger("local");
-	private boolean debug = false;
 
 	private Runnable keyCommandThread = new Runnable() {
 
@@ -33,7 +32,6 @@
 		
 	};
 
-	
 	public LocalDataSegmentManager() {
 		new Thread(replyThread, "LocalDataSegmentManager-replyCommand").start();
 		new Thread(keyCommandThread, "LocalDataSegmentManager-runKeyCommand").start();
@@ -66,7 +64,7 @@
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
 		Command cmd = new Command(CommandType.PUT, null, key, val, 0, 0, replyQueue, cs, reverseKey);
 		addCommand(dataSegmentKey, cmd);
-		if (debug)
+		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
 	}
 	
@@ -78,7 +76,7 @@
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
 		Command cmd = new Command(CommandType.UPDATE, null, key, val, 0, 0, replyQueue, cs, reverseKey);
 		addCommand(dataSegmentKey, cmd);
-		if (debug)
+		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
 	}
 
@@ -89,7 +87,7 @@
 		Command cmd = new Command(CommandType.TAKE, receiver, key, null, index, seq, replyQueue, cs, null);
 		seqHash.put(seq, cmd);
 		addCommand(dataSegmentKey, cmd);
-		if (debug)
+		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
 	}
 
@@ -100,7 +98,7 @@
 		Command cmd = new Command(CommandType.PEEK, receiver, key, null, index, seq, replyQueue, cs, null);
 		seqHash.put(seq, cmd); // waiting for PUT or UPDATE at unique sequence number
 		addCommand(dataSegmentKey, cmd);
-		if (debug)
+		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
 	}
 
@@ -109,7 +107,7 @@
 		DataSegmentKey dataSegmentKey = getDataSegmentKey(key);
 		Command cmd = new Command(CommandType.REMOVE, null, key, null, 0, 0, replyQueue, null, null);
 		addCommand(dataSegmentKey, cmd);
-		if (debug)
+		if (logger.isDebugEnabled())
 			logger.debug(cmd.getCommandString());
 	}