Co-authored-by: gdamms <gdamms@users.noreply.github.com>
This commit is contained in:
Laureηt 2021-11-30 18:01:10 +01:00
parent e414adca3b
commit 4a7bd702d3
No known key found for this signature in database
GPG key ID: D88C6B294FD40994
2 changed files with 16 additions and 20 deletions

View file

@ -1,5 +1,6 @@
package linda;
import java.rmi.Remote;
import java.util.Collection;
/** Public interface to a Linda implementation.

View file

@ -3,7 +3,6 @@ package linda.server;
import linda.Callback;
import linda.Linda;
import linda.Tuple;
import linda.shm.CentralizedLinda;
import java.net.MalformedURLException;
import java.rmi.*;
@ -19,28 +18,24 @@ public class LindaClient implements Linda {
Linda lindaServer;
public static void main(String[] args) {
LindaClient lc = new LindaClient(args[0]);
Tuple t1 = new Tuple(1, "a");
System.out.print("Tuple " + t1 + " envoyé");
lc.write(t1);
System.out.print("Tuple " + t1 + " écrit");
try {
LindaServer ls = (LindaServer) Naming.lookup(args[0]);
Tuple t1 = new Tuple(1, "a");
System.out.print("Tuple " + t1 + " envoyé");
ls.write(t1);
System.out.print("Tuple " + t1 + " écrit");
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Tuple template = new Tuple(Integer.class, String.class);
System.out.print("Lecture " + template + " envoyé");
Tuple t2 = ls.read(template);
System.out.print("Tuple " + t2 + " lu");
} catch (MalformedURLException | RemoteException | NotBoundException e) {
Thread.sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
Tuple template = new Tuple(Integer.class, String.class);
System.out.print("Lecture " + template + " envoyé");
Tuple t2 = lc.read(template);
System.out.print("Tuple " + t2 + " lu");
}
/**