Index: source/ariba/utility/misc/Demultiplexer.hpp
===================================================================
--- source/ariba/utility/misc/Demultiplexer.hpp	(revision 12775)
+++ source/ariba/utility/misc/Demultiplexer.hpp	(revision 2378)
@@ -1,3 +1,3 @@
-// [License]
+// [Licence]
 // The Ariba-Underlay Copyright
 //
@@ -35,5 +35,5 @@
 // official policies, either expressed or implied, of the Institute of
 // Telematics.
-// [License]
+// [Licence]
 
 #ifndef DEMULTIPLEXER_H__
@@ -41,5 +41,4 @@
 
 #include <list>
-#include <iostream>
 #include <map>
 #include <boost/thread/mutex.hpp>
@@ -47,5 +46,4 @@
 #include "ariba/utility/messages/Message.h"
 
-using std::cout;
 using std::list;
 using std::map;
@@ -75,24 +73,4 @@
 	boost::mutex						mapMutex;
 
-	void debugprint() {
-		cout << "-------------start--------" << std::endl;
-		{
-			LISTENER_SERVICE_MAP_CITERATOR i = mapListenerService.begin();
-			LISTENER_SERVICE_MAP_CITERATOR iend = mapListenerService.end();
-
-			for( ; i != iend; i++ )
-				cout << "xxx" << i->first.toString() << " -> " << i->second << std::endl;
-		}
-		cout << "-----------------------" << std::endl;
-		{
-			SERVICE_LISTENER_MAP_CITERATOR i = mapServiceListener.begin();
-			SERVICE_LISTENER_MAP_CITERATOR iend = mapServiceListener.end();
-
-			for( ; i != iend; i++ )
-				cout << "xxx" << i->first << " -> " << i->second.toString() << std::endl;
-		}
-		cout << "-------------end---------" << std::endl;
-	}
-
 public:
 
@@ -105,14 +83,15 @@
 	void registerItem( S id, T listener ) {
 		boost::mutex::scoped_lock lock( mapMutex );
-
-		mapServiceListener.insert( SERVICE_LISTENER_PAIR( id, listener ) );
-		mapListenerService.insert( LISTENER_SERVICE_PAIR( listener, id ) );
+		{
+			mapServiceListener.insert( SERVICE_LISTENER_PAIR( id, listener ) );
+			mapListenerService.insert( LISTENER_SERVICE_PAIR( listener, id ) );
+		}
 	}
 
-	void unregisterItem( S id ) {
+	void unregisterItem( S id) {
 		T listener = get( id );
 
+		boost::mutex::scoped_lock lock( mapMutex );
 		{
-			boost::mutex::scoped_lock lock( mapMutex );
 			mapServiceListener.erase( id );
 			mapListenerService.erase( listener );
@@ -121,5 +100,5 @@
 
 	void unregisterItem( T listener ) {
-		S id = get( listener );
+		S id = get (listener);
 		unregisterItem( id );
 	}
@@ -127,29 +106,34 @@
 	S get( T listener ) {
 		boost::mutex::scoped_lock lock( mapMutex );
-
-		LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
-		return it->second;
+		{
+			LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
+			return it->second;
+		}
 	}
 
 	T get( S id ) {
 		boost::mutex::scoped_lock lock( mapMutex );
+		{
+			SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
 
-		SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
-		if( it == mapServiceListener.end() ) 	return 0;
-		else					return it->second;
+			if( it == mapServiceListener.end() ) 	return NULL;
+			else					return it->second;
+		}
 	}
 
 	bool contains( T listener ) {
 		boost::mutex::scoped_lock lock( mapMutex );
-
-		LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
-		return ( it != mapListenerService.end() );
+		{
+			LISTENER_SERVICE_MAP_CITERATOR it = mapListenerService.find( listener );
+			return ( it != mapListenerService.end() );
+		}
 	}
 
 	bool contains( S id ) {
 		boost::mutex::scoped_lock lock( mapMutex );
-
-		SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
-		return ( it != mapServiceListener.end() );
+		{
+			SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
+			return ( it != mapServiceListener.end() );
+		}
 	}
 
@@ -157,6 +141,5 @@
 	typedef list<T> TwoList;
 
-	OneList getOneList() {
-		boost::mutex::scoped_lock lock( mapMutex );
+	OneList getOneList() const {
 		OneList ret;
 
@@ -168,6 +151,5 @@
 	}
 
-	TwoList getTwoList() {
-		boost::mutex::scoped_lock lock( mapMutex );
+	TwoList getTwoList() const {
 		TwoList ret;
 
