Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Correction of interlock implementation.
authorSébastien Miquée <sebastien.miquee@univ-fcomte.fr>
Tue, 9 Feb 2010 15:02:05 +0000 (16:02 +0100)
committerSébastien Miquée <sebastien.miquee@univ-fcomte.fr>
Tue, 9 Feb 2010 15:02:05 +0000 (16:02 +0100)
- Now we do not block the SuperNode itself when it uses functions
  modifying gnodes.

- Correction of some function declarations in order to launch "rmic"
  correctly.

Makefile
src/jaceP2P/JaceSpawner.java
src/jaceP2P/JaceSuperNodeInterface.java
src/jaceP2P/JaceSuperNodeServer.java

index b747d81..12ccc45 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -7,17 +7,19 @@ SRC=src
 PACKAGE=jaceP2P
 BIN=bin
 JAR=JaceP2P.jar
+MAPPING=/home/miquee/lib/Mapping.jar
+CLASSPATH=.:$(MAPPING)
 
 all: compile jar
 
 compile:clean
        javac -d ./$(BIN) ./$(SRC)/$(PACKAGE)/*.java
-       rmic -d ./$(BIN) jaceP2P.JaceServer
-       rmic -d ./$(BIN) jaceP2P.JaceSuperNodeServer
+       rmic -classpath $(CLASSPATH):$(BIN) -d ./$(BIN) jaceP2P.JaceServer
+       rmic -classpath $(CLASSPATH):$(BIN) -d ./$(BIN) jaceP2P.JaceSuperNodeServer
 
 rmi:compile
-       rmic -d ./$(BIN) jaceP2P.JaceServer
-       rmic -d ./$(BIN) jaceP2P.JaceSuperNodeServer
+       rmic -classpath $(CLASSPATH):$(BIN) -d ./$(BIN) jaceP2P.JaceServer
+       rmic -classpath $(CLASSPATH):$(BIN) -d ./$(BIN) jaceP2P.JaceSuperNodeServer
 
 jar:   
        jar cvfm ./$(JAR) Manifest -C ./$(BIN) $(PACKAGE)
index 4f38cbe..e2f68d5 100644 (file)
@@ -841,7 +841,7 @@ public class JaceSpawner {
                                centralServer = (JaceSuperNodeInterface) Naming.lookup("rmi://"
                                                + superNode_IP + ":" + superNode_port
                                                + "/JaceSuperNode");
-                               System.out.println("succesfully located " + superNode_IP);
+                               System.out.println("Succesfully located " + superNode_IP);
 
                                // add stub and IP in LocalHost to store it until super node
                                // death
index 9f9573f..23cb489 100644 (file)
@@ -50,10 +50,9 @@ public interface JaceSuperNodeInterface extends Remote {
        
        public void removeGNode( GNode _g ) throws RemoteException ;
 
+       public boolean blockForMapping() throws RemoteException ;
+       
        public void setMapping( Algo al ) throws RemoteException ;
-
-       public boolean blockForMapping();
-
 }
 
 /** ! **/
index 8809d17..c85a7c5 100644 (file)
@@ -27,7 +27,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
        private ArrayList<GNode> gnodes = null;
        private Algo al = null ;
        private int count = 0 ;
-       private boolean inDemand = false, operating = false ;
+       private boolean inDemand = false, operating = false, authorized = false ;
 //     private boolean daemonListChange ;
        
        // Constructors
@@ -216,6 +216,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                /** Initialization of Grid architecture (G5K for now) **/
                Grid grid = Utils.createGridG5k(gnodes);
                grid.initClusters();
+               
 
                /** Creation of tasks GTask **/
                ArrayList<GTask> ts = new ArrayList<GTask>();
@@ -237,6 +238,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                                }
                        }
                }
+               
 
                Graph graph = new Graph();
 
@@ -279,17 +281,23 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                        /** Launching the Mapping **/
                        al.map();
 
+
                        /** Transforming mapping in register **/
                        Mapping mp = al.getMapping();
-
+                       
+                       
                        /** Creating the register **/
                        ArrayList<GNode> ag = mp.getMappedGNodes();
 
+                       authorized = true ;
+                       
                        for (int i = 0; i < ag.size(); i++) {
                                reg.addNode((Node) ag.get(i).getNode());
                                gnodes.remove(ag.get(i));
                                Register.Instance().removeNode((Node) ag.get(i).getNode());
                        }
+                       
+                       authorized = false ;
 
                        if (ag.size() != 0) {
                                SuperNodeListe.Instance().forwardCountNode();
@@ -321,8 +329,14 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                GNode removedGNode = null ;
                
                if( _n != null )
-               {               
-                       workingOnGnodes() ;
+               {       
+                       boolean free = false ;
+                       
+                       if( ! operating )
+                       {
+                               workingOnGnodes() ;
+                               free = true ;
+                       }
                        
                        for( int i = 0 ; i < gnodes.size() ; i++ )
                        {
@@ -337,7 +351,10 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                
                        SuperNodeListe.Instance().removeGNode( removedGNode ) ;
                        
-                       operating = false ;
+                       if( free )
+                       {
+                               operating = false ;
+                       }
                
                }
                
@@ -355,6 +372,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                while( ! operating )
                {
                        inDemand = true ;
+                       tmp = true ;
                        
                        tmp = tmp && SuperNodeListe.Instance().workingOnGnodes() ;
 
@@ -394,7 +412,13 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                        {
                                System.out.println( "Replacing node found." ) ;
                                node = (Node) remp.getNode() ;
+                               
+                               authorized = true ;
+                               
                                delGNodeFromList( node ) ;
+                               
+                               authorized = false ;
+                               
                                SuperNodeListe.Instance().forwardCountNode();
                        } else {
                                System.err.println( "Replacing node not found !!" ) ;
@@ -406,7 +430,13 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                        {
                                System.out.println( "Other new node found." ) ;
                                node = (Node) remp.getNode() ;
+                               
+                               authorized = true ;
+                               
                                delGNodeFromList( node ) ;
+                               
+                               authorized = false ;
+                               
                                SuperNodeListe.Instance().forwardCountNode();
                        } else {
                                System.err.println( "Other new node not found !!" ) ;
@@ -465,6 +495,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                al = _al ;              
        }
 
+       
        @Override
        /**
         * Allow or deny the use of operations on the gnodes list, in order to
@@ -472,7 +503,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
         * @author miquee
         * @return The authorization or not to block gnodes
         */
-       public boolean blockForMapping() 
+       public boolean blockForMapping() throws RemoteException
        {
                while( inDemand )
                {
@@ -483,7 +514,7 @@ public class JaceSuperNodeServer extends UnicastRemoteObject implements
                        }
                }
                
-               if( operating )
+               if( operating && ! authorized )
                {
                        return false ;
                } else {