import java.util.ArrayList;
+import java.util.Random;
/**
public DefaultMapping()
{
super() ;
+ name = "DefaultMapping" ;
}
{
super( _gr, _gd ) ;
archi = _gnodes ;
+ name = "DefaultMapping" ;
}
} else {
System.err.println( "\n\n!!! Unable to map application !\n\n" ) ;
}
-
- /** Update in cluster the status of nodes **/
- updateGrid() ;
}
{
GNode ret = null ;
- if( _dead != null )
+ if( _dead != null && _ag != null )
{
int pos = 0 ;
pos = mp.getIdOfAssociation( _dead ) ;
if( _ag.size() > 0 )
{
- ret = _ag.get( 0 ) ;
-
+ Random r = new Random() ;
+ ret = _ag.get( r.nextInt( _ag.size() ) ) ;
} else {
System.err.println( "Not enought available nodes in gnodes to replace one !" ) ;
return null ;
- }
+ }
+
+ nb_fault++ ;
}
- /** Update in cluster the status of nodes **/
- updateGrid() ;
-
return ret ;
}
@Override
public GNode getOtherGNode( ArrayList<GNode> _ag )
{
+ /** Returning the first node in the list **/
if( _ag.size() > 0 )
{
- return _ag.get( 1 ) ;
+ return _ag.get( 0 ) ;
}
return null ;
}
+
+
+ @Override
+ public boolean setParams(Object[] _params) {
+ return true ;
+ }
}