X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/jaceP2P.git/blobdiff_plain/9e956705309c9875a2550b863127892b1a52723c..c7001582aeefb419483631f88a0b0ee5873ae951:/src/jaceP2P/JaceSuperNodeServer.java diff --git a/src/jaceP2P/JaceSuperNodeServer.java b/src/jaceP2P/JaceSuperNodeServer.java index c954257..b279e30 100644 --- a/src/jaceP2P/JaceSuperNodeServer.java +++ b/src/jaceP2P/JaceSuperNodeServer.java @@ -3,19 +3,17 @@ package jaceP2P; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; import java.util.ArrayList; -import java.util.Vector; import and.Mapping.Algo; import and.Mapping.DefaultMapping; +import and.Mapping.FT_AIAC_QM; +import and.Mapping.FT_FEC; import and.Mapping.GNode; import and.Mapping.GTask; import and.Mapping.Graph; import and.Mapping.Grid; -import and.Mapping.LSM; -import and.Mapping.Mapping; -import and.Mapping.QM; +import and.Mapping.Maheve; import and.Mapping.Simple; -import and.Mapping.Utils; public class JaceSuperNodeServer extends UnicastRemoteObject implements @@ -25,10 +23,8 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements // Attributes private int beat; private ArrayList gnodes = null; - private Algo al = null ; - private int count = 0 ; + private ArrayList algos = null ; private boolean inDemand = false, operating = false, authorized = false ; -// private boolean daemonListChange ; // Constructors @@ -36,19 +32,19 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements super() ; beat = timeBeat ; gnodes = new ArrayList() ; -// daemonListChange = true ; + algos = new ArrayList() ; } public int getSuperNodeBeat() throws RemoteException { return beat; } - public Vector sendStub(String IP, int port, JaceSuperNodeInterface stub) + public ArrayList sendStub(String IP, int port, JaceSuperNodeInterface stub) throws RemoteException { SuperNodeListe.Instance().addStubOf(IP, port, stub); System.out.println("Added new superNode (" + IP + ") to list and return List"); - return SuperNodeListe.Instance().getListe(); + return SuperNodeListe.Instance().getListe() ; } public void updateCountNode(String IP, int nb) throws RemoteException { @@ -58,17 +54,17 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements SuperNodeListe.Instance().viewAll(); } - public void sendSurplus(Vector nodes, ArrayList _gnodes) throws RemoteException { + public void sendSurplus(ArrayList nodes, ArrayList _gnodes) throws RemoteException { System.out.println("Recieved " + nodes.size() + " nodes"); for (int i = 0; i < nodes.size(); i++) { - Register.Instance().getListe().add((Node) nodes.elementAt(i)); + Register.Instance().getListe().add((Node) nodes.get(i)); System.out.println("Adding " - + ((Node) nodes.elementAt(i)).getName()); + + ((Node) nodes.get(i)).getName()); try { - ((Node) nodes.elementAt(i)).getStub().updateHeart( + ((Node) nodes.get(i)).getStub().updateHeart( LocalHost.Instance().getSuperNodeStub()); int index = SuperNodeListe.Instance().existSuperNode( LocalHost.Instance().getIP()); @@ -77,7 +73,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements .setNbOfNodes(Register.Instance().getSize()); new ForwardCount().start(); } catch (Exception e) { - System.out.println("Error changing Server in SendSurplus : " + System.err.println("Error changing Server in SendSurplus : " + e); } } @@ -99,7 +95,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements System.out.println("Put token to true"); } catch (Exception e) { - System.out + System.err .println("Unable to heartBeat the next SuperNode with the new Token : " + e); } @@ -123,28 +119,31 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements public synchronized void workerRegistering(JaceInterface workerStub, String workerIP, String workerName, int port, GNode g) throws RemoteException { - System.out.println("CONNEXION of " + workerName); + System.out.println("CONNECTION of " + workerName); // Create the node Node noeud = new Node(workerStub); noeud.setName(workerName); - noeud.setIP(workerIP); + noeud.setIP(g.getIP()); noeud.setAliveFlag(true); noeud.setAliveTime(); noeud.setPort(port); noeud.setAppliName(null); noeud.setNbOfBeats(0); - noeud.setId( count ) ; - noeud.setId( Long.parseLong( workerIP.replace( ".", "" ) ) ) ; + + String sid = workerIP.replace( ".", "" ) + port ; + Long id = Long.parseLong( sid ) ; + noeud.setId( id ) ; - g.setNode(noeud); - g.setId( noeud.getId() ) ; + g.setNode( noeud ) ; + g.setId( id ) ; + g.setMapped( false ) ; workingOnGnodes() ; - gnodes.add(g); + gnodes.add( g ) ; + updateGrids( g ) ; -// daemonListChange = true ; // Insert the node in the Register.Instance() of the Super Node Register.Instance().addNode(noeud); @@ -168,6 +167,25 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements operating = false ; } + + /** + * Update all mapping algorithms with a new node. + * @param _g The new node + * + * @author Sébastien Miquée + */ + private synchronized void updateGrids( GNode _g ) + { + if( _g != null ) + { + for( int i = 0 ; i < algos.size() ; i++ ) + { + algos.get( i ).getGrid().addGNode( _g ) ; + } + } + + } + /****************************************************/ /****************************************************/ @@ -200,18 +218,34 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements /** Mapping !! Sébastien Miquée **/ /*********************************/ - public Register getRegisterSpawner(String spawnerIP, int nbTasks, Task t, + /** + * Search and return to the requester spawner a register containing + * computation nodes plus some extra nodes if needed. This method requires + * as parameters the mapping algorithm choice and its parameters, and the + * amount of requested nodes and the task to be used, in order to + * construct the tasks graph. + * @param spawnerIP IP of the requester + * @param nbTasks Amount of tasks + * @param t Tasks to be executed + * @param nbNoeuds Total amount of requested nodes + * @param algo Identifier of the mapping algorithm + * @param paramAlgo Parameter of the mapping algorithm + * + * @author Sébastien Miquée + */ + @Override + public synchronized Register getRegisterSpawner(String spawnerIP, int nbTasks, Task t, int nbNoeuds, int algo, double paramAlgo) throws RemoteException { // Have we the correct application ? - if (t == null) { - System.err.println( "Problem of class transmission !" ) ; + if( t == null ) { + System.err.println( "Problem of class transmission!" ) ; return null ; } if( t.getDependencies( 0 ) == null ) { - System.err.println( "No redifinition of getDependencies() functions !" ) ; + System.err.println( "No redifinition of getDependencies() function!" ) ; return null ; } @@ -222,32 +256,40 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements workingOnGnodes() ; /** Initialization of Grid architecture (G5K for now) **/ - Grid grid = Utils.createGridG5k(gnodes); - grid.initClusters(); + Grid grid = new Grid() ; + + for( int i = 0 ; i < gnodes.size() ; i++ ) + { + grid.addGNode( gnodes.get( i ) ) ; + } + + + /** Informing about the grid heterogeneity **/ + System.out.println( "\nHeterogeneity degree of the grid: " + grid.getHeterogenityDegre() + "\n" ) ; /** Creation of tasks GTask **/ ArrayList ts = new ArrayList(); - for (int i = 0; i < nbTasks; i++) { - ts.add(new GTask( i ) ) ; + for( int i = 0; i < nbTasks; i++ ) { + ts.add( new GTask( i ) ) ; } /** Research of dependencies **/ - for (int i = 0; i < nbTasks; i++) { - int dep[] = null; - dep = t.getDependencies(i); + for( int i = 0; i < nbTasks; i++ ) { + int dep[] = null ; + dep = t.getDependencies( i ) ; /** Adding dependencies to tasks **/ - for (int j = 0; j < dep.length; j++) { - if (dep[j] != -1) { - ts.get(i).addDependance(ts.get(dep[j])); + for( int j = 0; j < dep.length; j++ ) { + if( dep[j] != -1 ) { + ts.get( i ).addDependance( ts.get( dep[ j ] ) ) ; } else { - break; + break ; } } } - + /** Creation of the application interaction graph **/ Graph graph = new Graph(); for( int i = 0 ; i < ts.size() ; i++) @@ -255,55 +297,61 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements graph.addGTask(ts.get(i)); } - // -- debug ! - // graph.print() ; - - // try { - // Thread.sleep(10000) ; - // } catch( Exception e ) {} - - // grid.print() ; - // - // try { - // Thread.sleep( 10000 ) ; - // } catch( Exception e ) {} - + /** TODO Loading algorithm class with parameters in a configuration file **/ /** Selection of the mapping algorithm **/ - al = null ; + Algo al = null ; - switch (algo) { + switch( algo ) { case 0: al = new Simple(graph, grid); break; case 1: - al = new QM(graph, grid, paramAlgo); + al = new FT_AIAC_QM(graph, grid, paramAlgo); break; case 2: - al = new LSM(graph, grid, paramAlgo); + al = new FT_FEC(graph, grid, paramAlgo); break; + case 3: + al = new Maheve( graph, grid ) ; + ((Maheve) al).setNbSave((int)paramAlgo); + break ; default: - al = new DefaultMapping( graph, grid, gnodes ) ; + al = new DefaultMapping( graph, grid ) ; } - if (al != null) { + if (al != null) + { /** Launching the Mapping **/ al.map(); - /** Transforming mapping in register **/ - Mapping mp = al.getMapping(); - - /** Creating the register **/ - ArrayList ag = mp.getMappedGNodes(); + ArrayList ag = al.getMapping().getMappedGNodes(); + + System.out.println("NB returned nodes : "+ag.size()); + + /** Setting the algorithm's identifier **/ + al.setIdS( spawnerIP ) ; + + /** Adding the algorithm in the list **/ + algos.add( al ) ; + + int idAlgo = searchAlgo( spawnerIP ) ; + + /** Mapping distribution over other SuperNodes */ + SuperNodeListe.Instance().setMapping( al ) ; + + + authorized = true ; - for (int i = 0; i < ag.size(); i++) { + for( int i = 0; i < ag.size(); i++ ) { reg.addNode((Node) ag.get(i).getNode()); - delGNodeFromList( (Node) ag.get(i).getNode(), 0 ) ; -// gnodes.remove(ag.get(i)); -// Register.Instance().removeNode((Node) ag.get(i).getNode()); + + ag.get(i).setMapped( true ) ; + setMapped( ag.get(i), 1 ) ; + Register.Instance().removeNode((Node) ag.get(i).getNode()); } @@ -315,9 +363,11 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements for( int i = 0 ; i < nb ; i ++ ) { - sup = al.getOtherGNode( gnodes ) ; + sup = algos.get(idAlgo).getOtherGNode( gnodes ) ; + algos.get(idAlgo).getMapping().addOtherNode( sup ) ; reg.addNodeBeg( (Node) sup.getNode() ) ; - delGNodeFromList( (Node) sup.getNode(), 0 ) ; + setMapped( sup, 1 ) ; + Register.Instance().removeNode((Node) sup.getNode()); } } @@ -329,26 +379,58 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements } -// daemonListChange = false ; - - System.out.println( "Spawner returned reg: " + reg ) ; - - /** Mapping distribution over other Super Nodes */ - SuperNodeListe.Instance().setMapping( al ) ; - operating = false ; - /* Returning result */ + /** Returning result **/ return reg ; } - /*****************************************/ - /**** Sébastien Miquée ****/ - /** **/ - /** Recherche nouveau noeud **/ - /*****************************************/ - protected GNode delGNodeFromList( Node _n, int _mode ) + public synchronized void setMapped( GNode _g, int _mode ) throws RemoteException + { + if( _g != null ) + { + _g.setMapped( true ) ; + + for( int i = 0 ; i < gnodes.size() ; i++ ) + { + if( _g.getId() == gnodes.get( i ).getId() ) + { + gnodes.remove( i ) ; + break ; + } + } + + for( int i = 0 ; i < algos.size() ; i++ ) + { + algos.get( i ).getGrid().setMappedStatus( _g, true ) ; + } + + if( _mode == 1 ) + { + authorized = true ; + + SuperNodeListe.Instance().setMappedGNode( _g, 0 ) ; + + authorized = false ; + } + } else { + System.err.println( "GNode is null is setMapped!" ) ; + } + } + + /** + * Suppress a node from the gnodes list if this node is free, or remove + * it from the Mapping class of the mapping algorithm if this node is + * a computation node. After having done the local suppression of the node + * it propagates the suppression to other SuperNodes. + * @param _n The fallen node + * @param _mode Choice of the list (0: gnodes, 1: mapping, 2:just mapped) + * + * @author Sébastien Miquée + */ + @Override + public synchronized GNode delGNodeFromList( Node _n, int _mode, String _spawnerIp ) throws RemoteException { GNode removedGNode = null ; @@ -361,42 +443,41 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements workingOnGnodes() ; free = true ; } - - /** The dead node is not in the mapping **/ + if( _mode == 0 ) { + GNode dead = null ; + for( int i = 0 ; i < gnodes.size() ; i++ ) { - if( ((Node)gnodes.get(i).getNode()).getId() == _n.getId() ) + if( _n.getId() == ((Node) gnodes.get(i).getNode()).getId() ) { - removedGNode = gnodes.remove( i ) ; - Register.Instance().removeNodeOfName( removedGNode.getName() ) ; + dead = gnodes.remove( i ) ; break ; } } - } - - /** The dead node is in the mapping **/ - if( _mode == 1 ) - { - ArrayList temp = al.getMapping().getMappedGNodes() ; - for( int i = 0 ; i < temp.size() ; i++ ) + if( dead != null ) { - if( ((Node)temp.get(i).getNode()).getId() == _n.getId() ) + for( int i = 0 ; i < algos.size() ; i++ ) { - removedGNode = temp.get( i ) ; - Register.Instance().removeNodeOfName( removedGNode.getName() ) ; - break ; + algos.get( i ).getGrid().removeGNode( dead ) ; + Register.Instance().removeNodeOfName( dead.getName() ) ; + SuperNodeListe.Instance().removeGNode( dead, _mode, _spawnerIp ) ; + + // trying to reboot the node + try { + _n.getStub().suicide2( "Reboot!" ) ; + } catch( Exception e ) { + System.err.println( "(SN) Unable to reboot the node:" ) ; + e.printStackTrace() ; + } } - } + } else { + System.err.println( "The dead node signaled does not exist!" ) ; + } } - -// daemonListChange = true ; - - SuperNodeListe.Instance().removeGNode( removedGNode ) ; - if( free ) { operating = false ; @@ -408,7 +489,35 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements } - private void workingOnGnodes() + /** + * Search the position of the mapping algorithm in the list. + * @param _id Identifier of the algorithm + * @return The position in the list + */ + private int searchAlgo( String _id ) + { + int id = -1 ; + + for( int i = 0 ; i < algos.size() ; i++ ) + { + if( algos.get( i ).getIdS().equals( _id ) ) + { + id = i ; + break ; + } + } + + return id ; + } + + /** + * Determine if this SuperNode can operate on the gnodes list. + * It asks other SuperNodes to know if their are working on this list + * and set the authorization, or not. + * + * @author Sébastien Miquée + */ + private synchronized void workingOnGnodes() { boolean tmp = true ; @@ -438,34 +547,111 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements inDemand = false ; } - + + /** + * Search and return a new node when one failed or when JaceP2P needs another + * one. For the first case, the given failed node should not be null, and + * null in the other case. + * @param _spawnerIP IP of the requester + * @param _rank The task number number of the dead node + * + * @author Sébastien Miquée + */ + @Override + public synchronized Node getNewNode( String _spawnerIP, int _rank ) throws RemoteException + { + int idNode = -1 ; + int idAlgo = searchAlgo( _spawnerIP ) ; + + if( idAlgo == -1 ) + { + System.err.println( "No algorithm found for this Spawner!" ) ; + return null ; + } + + /** We have to replace a Spawner **/ + if( _rank == -2 ) + { + idNode = -2 ; + } else { + /** We have to replace a computing node **/ + idNode = algos.get( idAlgo ).getMapping().getIdOfAssociation( _rank ) ; + } + + if( idNode == -1 ) + { + System.err.println( "No tasks corresponds to rank "+_rank+"!" ) ; + return null ; + } + + GNode dead = null ; + + if( idNode >= 0 ) + { + dead = algos.get( idAlgo ).getMapping().getAssociation( idNode ).getGNode() ; + } + + if( dead == null && idNode >= 0 ) + { + System.err.println( "The GNode corresponding to the task "+_rank+" is null!" ) ; + System.err.println( "Trying to find a new node for this task (not optimal)..." ) ; + } - public Node getNewNode( String _spawnerIP, Node _deadNode ) throws RemoteException + return getNewNode( _spawnerIP, dead ) ; + } + + /** + * Search and return a new node when one failed or when JaceP2P needs another + * one. For the first case, the given failed node should not be null, and + * null in the other case. + * @param _spawnerIP IP of the requester + * @param _deadNode The failed node + * + * @author Sébastien Miquée + */ + @Override + public synchronized Node getNewNode( String _spawnerIP, GNode _deadNode ) throws RemoteException { Node node = null ; - GNode remp = null, gnode = null ; + GNode remp = null ; + + int idAlgo = searchAlgo( _spawnerIP ) ; + + if( idAlgo == -1 ) + { + System.err.println( "No algorithm found for this Spawner!" ) ; + return null ; + } + /** Can we use gnodes ?**/ workingOnGnodes() ; - if( _deadNode != null ) + if( _deadNode != null ) { authorized = true ; - gnode = delGNodeFromList( _deadNode, 1 ) ; + removeMappedGNode( _deadNode, 1 ) ; + + authorized = false ; - remp = al.replaceNode( gnode, gnodes ) ; + remp = algos.get( idAlgo ).replaceNode( _deadNode, gnodes ) ; if( remp != null ) { System.out.println( "Replacing node found." ) ; - node = (Node) remp.getNode() ; - delGNodeFromList( node, 0 ) ; + authorized = true ; + + remp.setMapped( true ) ; + + setMapped( remp, 1 ) ; + Register.Instance().removeNodeOfName( remp.getName() ) ; + /** Updating all mapping **/ - updateMappedNode( gnode, remp ) ; - propagateReplaceNode( gnode, remp ) ; + updateMappedNode( _deadNode, remp, _spawnerIP ) ; + propagateReplaceNode( _deadNode, remp, _spawnerIP ) ; authorized = false ; @@ -474,16 +660,18 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements System.err.println( "Replacing node not found !!" ) ; } } else { - remp = al.getOtherGNode( gnodes ) ; + remp = algos.get( idAlgo ).getOtherGNode( gnodes ) ; if( remp != null ) { System.out.println( "Other new node found." ) ; - node = (Node) remp.getNode() ; + + remp.setMapped( true ) ; authorized = true ; - delGNodeFromList( node, 0 ) ; + setMapped( remp, 1 ) ; + Register.Instance().removeNodeOfName( remp.getName() ) ; authorized = false ; @@ -493,50 +681,110 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements } } + if( remp != null ) + { + node = (Node) remp.getNode() ; + } else { + System.err.println( "SuperNode: No new node found!" ) ; + } + + /** Free the gnodes use **/ operating = false ; return node ; } - @Override - public void updateMappedNode( GNode _dead, GNode _remp ) + + public synchronized void removeMappedGNode( GNode _g, int _mode ) throws RemoteException { - int pos = 0 ; - pos = al.getMapping().getIdOfAssociation( _dead ) ; - - if( pos == -1 ) + if( _g != null ) { - System.err.println( "GNode "+_dead+" does not exist in the mapping!" ) ; - return ; + for( int i = 0 ; i < algos.size() ; i++ ) + { + algos.get( i ).getGrid().removeGNode( _g ) ; + } + + if( _mode == 1 ) + { + SuperNodeListe.Instance().removeGNode( _g, 0 ) ; + } + } else { + System.err.println( "GNode to be deleted is null!" ) ; } + } + + /** + * Replace a failed GNode in the mapping by another one. + * This method is called by the SuperNodeList, to broadcast the modification. + * @param _dead The failed node + * @param _remp The replacing node + * + * @author Sébastien Miquée + */ + @Override + public synchronized void updateMappedNode( GNode _dead, GNode _remp, String _spawnerIP ) + { + if( _remp != null ) + { + int pos = 0 ; + + int idAlgo = searchAlgo( _spawnerIP ) ; + + if( idAlgo == -1 ) + { + System.err.println( "No algorithm found for this Spawner!" ) ; + return ; + } - al.getMapping().getMapping().get( pos ).setGNode( _remp ) ; - - System.out.println( "Succesfully replacing the fallen node in the mapping." ) ; + pos = algos.get( idAlgo ).getMapping().getIdOfAssociation( _dead ) ; + + if( pos != -1 ) + { + /** Changing the node in the mapping **/ + if( algos.get( idAlgo ).getMapping().getMapping().get( pos ).setGNode( _remp ) ) + { + System.out.println( "Succesfully replacing the fallen node in the mapping." ) ; + } else { + System.err.println( "Failed in replacing the fallen node in the mapping!" ) ; + } + } else { + System.err.println( "The dead node was not found in the mapping!" ) ; + } + + } else { + System.err.println( "The new GNode is null!" ) ; + } } /** - * Inform all SuperNodes of the replacement of a fallen computing node. - * @param _dead The fallen node + * Inform all SuperNodes of the replacement of a failed computing node. + * @param _dead The failed node * @param _remp The replacing node + * + * @author Sébastien Miquée */ - private void propagateReplaceNode( GNode _dead, GNode _remp ) throws RemoteException + private synchronized void propagateReplaceNode( GNode _dead, GNode _remp, String _spawnerIP ) throws RemoteException { - if( _dead != null && _remp != null ) + if( _remp != null ) { - SuperNodeListe.Instance().propagateReplaceNode( _dead, _remp ) ; + SuperNodeListe.Instance().propagateReplaceNode( _dead, _remp, _spawnerIP ) ; + } else { + System.err.println( "The replacement node is null!" ) ; } } /**********************************************************/ /**********************************************************/ + @Override /** * Add a new node in the list. * @param _g The new node + * + * @author Sébastien Miquée */ public void addGNode( GNode _g ) throws RemoteException { @@ -552,46 +800,29 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements gnodes.add( _g ) ; + updateGrids( _g ) ; + if( free ) operating = false ; } } + /** + * Set the local mapping with another done on an other SuperNode. + * @param _al The new mapping + * + * @author Sébastien Miquée + */ @Override - public void removeGNode( GNode _g ) throws RemoteException + public synchronized void setMapping( Algo _al ) throws RemoteException { - if( _g != null ) + if( searchAlgo( _al.getIdS() ) == -1 ) { - boolean free = false ; - - if( ! operating ) - { - workingOnGnodes() ; - free = true ; - } - - for( int i = 0 ; i < gnodes.size() ; i++ ) - { - if( ((Node)gnodes.get(i).getNode()).getId() == ((Node)_g.getNode()).getId() ) - { - gnodes.remove( i ) ; - Register.Instance().removeNodeOfName( _g.getName() ) ; - break ; - } - } - - if( free ) - operating = false ; + algos.add( _al ) ; + } else { + System.err.println( "I already have this mapping algorithm!" ) ; } - - } - - - @Override - public void setMapping( Algo _al ) throws RemoteException - { - al = _al ; } @@ -599,8 +830,9 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements /** * Allow or deny the use of operations on the gnodes list, in order to * do a mapping operation. - * @author miquee * @return The authorization or not to block gnodes + * + * @author Sébastien Miquée */ public boolean blockForMapping() throws RemoteException { @@ -621,12 +853,62 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements } } + /** + * Return the array containing the current not mapped nodes available. + * @return The array of available nodes + * + * @author Sébastien Miquée + */ @Override public ArrayList getGNodes() throws RemoteException { return gnodes ; } + + /** + * Remove a mapping algorithm of the algorithms list. + * @param _id The algorithm identifier + * @param _mode Indicate if the information should be transmitted + * + * @author Sébastien Miquée + */ + public void removeAlgo( String _id, int _mode ) throws RemoteException + { + int pos ; + + pos = searchAlgo( _id ) ; + + if( pos != -1 ) + { + algos.remove( pos ) ; + + if( _mode == 0 ) + { + SuperNodeListe.Instance().removeAlgo( _id ) ; + } + } else { + System.err.println( "The mapping algorithm requested for deletion does not exist!" ) ; + } + } + + + // ** Tests ** // + public Algo getAlgo( String _spID ) throws RemoteException + { + int pos ; + Algo ret = null ; + + pos = searchAlgo( _spID ) ; + + if( pos != -1 ) + { + ret = algos.get( pos ) ; + } + + return ret ; + } + } /** ! **/