Index: source/ariba/utility/misc/Demultiplexer.hpp
===================================================================
--- source/ariba/utility/misc/Demultiplexer.hpp	(revision 2452)
+++ source/ariba/utility/misc/Demultiplexer.hpp	(revision 2473)
@@ -41,4 +41,5 @@
 
 #include <list>
+#include <iostream>
 #include <map>
 #include <boost/thread/mutex.hpp>
@@ -46,4 +47,5 @@
 #include "ariba/utility/messages/Message.h"
 
+using std::cout;
 using std::list;
 using std::map;
@@ -73,4 +75,24 @@
 	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:
 
@@ -83,15 +105,14 @@
 	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 );
@@ -100,5 +121,5 @@
 
 	void unregisterItem( T listener ) {
-		S id = get (listener);
+		S id = get( listener );
 		unregisterItem( id );
 	}
@@ -106,34 +127,29 @@
 	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 );
 
-			if( it == mapServiceListener.end() ) 	return NULL;
-			else					return it->second;
-		}
+		SERVICE_LISTENER_MAP_CITERATOR it = mapServiceListener.find( id );
+		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() );
 	}
 
@@ -141,5 +157,6 @@
 	typedef list<T> TwoList;
 
-	OneList getOneList() const {
+	OneList getOneList() {
+		boost::mutex::scoped_lock lock( mapMutex );
 		OneList ret;
 
@@ -151,5 +168,6 @@
 	}
 
-	TwoList getTwoList() const {
+	TwoList getTwoList() {
+		boost::mutex::scoped_lock lock( mapMutex );
 		TwoList ret;
 
