sysrep:rmi
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| sysrep:rmi [2013/10/16 16:57] – [Generic Engine] orel | sysrep:rmi [2024/03/18 15:06] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 99: | Line 99: | ||
| * Modifez l’interface " | * Modifez l’interface " | ||
| - | * String sayHello() throws RemoteException; | ||
| * String sayEcho(String echo) throws RemoteException; | * String sayEcho(String echo) throws RemoteException; | ||
| * Ajoutez la méthode suivante, qui manipule le type //Message// défini par l' | * Ajoutez la méthode suivante, qui manipule le type //Message// défini par l' | ||
| Line 130: | Line 129: | ||
| __Exercice__ : | __Exercice__ : | ||
| * Faire une proposition d' | * Faire une proposition d' | ||
| - | * Implantation. Utilisez les compléments Java fournis à la fin de cette page ;-) | + | * Implantation. Utilisez les compléments Java disponibles [[sysrep: |
| * Quelques éléments de correction pour vous aider : [[sysrep: | * Quelques éléments de correction pour vous aider : [[sysrep: | ||
| Line 179: | Line 178: | ||
| </ | </ | ||
| - | En résumé, pour lancer votre application distribuée | + | En résumé, pour lancer votre application distribuée : |
| <code bash> | <code bash> | ||
| - | server$ rmiregistry & | + | # lancement serveur |
| - | server$ java -Djava.security.policy=all.policy EngineServer | + | $ cd server |
| - | client$ java -Djava.rmi.server.codebase=file:/// | + | $ ls |
| + | all.policy | ||
| + | $ rmiregistry & # ou utiliser createRegistry() | ||
| + | $ java -Djava.security.policy=all.policy EngineServer | ||
| + | |||
| + | # lancement | ||
| + | $ cd client | ||
| + | $ ls | ||
| + | EngineClient.java | ||
| + | $ java -Djava.rmi.server.codebase=file:/// | ||
| </ | </ | ||
| __Tutoriel__ : http:// | __Tutoriel__ : http:// | ||
| - | ====Compléments Java==== | + | ====Fourmis==== |
| - | __Readline__ | + | FIXME : Ajouter un nouvel exo sur un programme Java simulant l' |
| - | <code java> | ||
| - | BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); | ||
| - | try { | ||
| - | String msg = in.readLine(); | ||
| - | } catch(IOException e) { /* ... */ } | ||
| - | </ | ||
| - | |||
| - | __StringTokenizer__ : Pour décomposer une chaîne de caractères en mots (les //tokens//) : | ||
| - | |||
| - | <code java> | ||
| - | StringTokenizer st = new StringTokenizer(" | ||
| - | while (st.hasMoreTokens()) System.out.println(st.nextToken()); | ||
| - | </ | ||
| - | |||
| - | Affiche ici : | ||
| - | |||
| - | this | ||
| - | is | ||
| - | a | ||
| - | test | ||
| - | |||
| - | |||
| - | __HashMap and Generics__ : Voici un petit exemple d' | ||
| - | |||
| - | <code java> | ||
| - | HashMap< | ||
| - | map.put(1, " | ||
| - | map.put(2, " | ||
| - | String name = map.get(2) | ||
| - | |||
| - | for (Integer key : map.keySet()) | ||
| - | System.out.println(" | ||
| - | </ | ||
| - | |||
| - | __Intrinsic Locks and Synchronization__ : En java chaque objet dispose d'un verrou intrinséque (mutex), qui est utile pour synchroniser l' | ||
| - | |||
| - | <code java> | ||
| - | class FooBar { | ||
| - | synchronized void foo() { ...} | ||
| - | synchronized void bar() { ...} | ||
| - | } | ||
| - | </ | ||
| - | |||
| - | Soit on déclare un bloc de code " | ||
| - | |||
| - | <code java> | ||
| - | Object lock = new Object; | ||
| - | synchronized(lock) { | ||
| - | ... | ||
| - | ... | ||
| - | } | ||
| - | </ | ||
sysrep/rmi.1381942670.txt.gz · Last modified: 2024/03/18 15:05 (external edit)
