From 82fe7dff990dc962fe14fae0cb4f9c02fc139492 Mon Sep 17 00:00:00 2001 From: =?utf8?q?S=C3=A9bastien=20Miqu=C3=A9e?= Date: Wed, 24 Feb 2010 09:43:27 +0100 Subject: [PATCH] Correction of the grid status update. - These modifications allows the grid to be consistent and coherent at any time. --- src/jaceP2P/JaceSuperNodeServer.java | 31 ++++++++++++++++------------ 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/jaceP2P/JaceSuperNodeServer.java b/src/jaceP2P/JaceSuperNodeServer.java index 0200806..58d2401 100644 --- a/src/jaceP2P/JaceSuperNodeServer.java +++ b/src/jaceP2P/JaceSuperNodeServer.java @@ -546,22 +546,27 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements @Override public void updateMappedNode( GNode _dead, GNode _remp ) { - int pos = 0 ; - pos = al.getMapping().getIdOfAssociation( _dead ) ; - - if( pos == -1 ) + if( _dead != null ) { - System.err.println( "GNode "+_dead+" does not exist in the mapping!" ) ; - return ; - } + int pos = 0 ; - /** Changing the node in the mapping **/ - al.getMapping().getMapping().get( pos ).setGNode( _remp ) ; + pos = al.getMapping().getIdOfAssociation( _dead ) ; - /** Changing the status in the grid **/ - al.getGrid().setMappedStatus( _remp, true ) ; - - System.out.println( "Succesfully replacing the fallen node in the mapping." ) ; + if( pos != -1 ) + { + /** Changing the node in the mapping **/ + al.getMapping().getMapping().get( pos ).setGNode( _remp ) ; + + System.out.println( "Succesfully replacing the fallen node in the mapping." ) ; + } + + /** Changing the status in the grid **/ + al.getGrid().setMappedStatus( _remp, true ) ; + + al.updateGrid() ; + } else { + System.err.println( "GNode "+_dead+" does not exist in the mapping!" ) ; + } } -- 2.20.1