2021-11-30 16:39:17 +00:00
|
|
|
package linda.server;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
import java.rmi.server.UnicastRemoteObject;
|
|
|
|
import java.rmi.*;
|
|
|
|
import java.rmi.registry.*;
|
|
|
|
|
2021-11-30 16:39:17 +00:00
|
|
|
import linda.Callback;
|
|
|
|
import linda.Linda;
|
|
|
|
import linda.Tuple;
|
|
|
|
import linda.shm.CentralizedLinda;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* lindaServer
|
|
|
|
*/
|
2021-12-02 20:57:01 +00:00
|
|
|
public class LindaServer extends UnicastRemoteObject implements LindaRemote {
|
2021-11-30 16:39:17 +00:00
|
|
|
|
|
|
|
Linda lindaInstance;
|
|
|
|
|
|
|
|
public LindaServer() throws RemoteException {
|
|
|
|
this.lindaInstance = new CentralizedLinda();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void write(Tuple t) {
|
|
|
|
lindaInstance.write(t);
|
|
|
|
}
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
public Tuple take(Tuple template) throws RemoteException {
|
2021-11-30 16:39:17 +00:00
|
|
|
return lindaInstance.take(template);
|
|
|
|
}
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
public Tuple read(Tuple template) throws RemoteException {
|
2021-11-30 16:39:17 +00:00
|
|
|
return lindaInstance.read(template);
|
|
|
|
}
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
public Tuple tryTake(Tuple template) throws RemoteException {
|
2021-11-30 16:39:17 +00:00
|
|
|
return lindaInstance.tryTake(template);
|
|
|
|
}
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
public Tuple tryRead(Tuple template) throws RemoteException {
|
2021-11-30 16:39:17 +00:00
|
|
|
return lindaInstance.tryRead(template);
|
|
|
|
}
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
public Collection<Tuple> takeAll(Tuple template) throws RemoteException {
|
2021-11-30 16:39:17 +00:00
|
|
|
return lindaInstance.takeAll(template);
|
|
|
|
}
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
public Collection<Tuple> readAll(Tuple template) throws RemoteException {
|
2021-11-30 16:39:17 +00:00
|
|
|
return lindaInstance.readAll(template);
|
|
|
|
}
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
public void eventRegister(Linda.eventMode mode, Linda.eventTiming timing, Tuple template, Callback callback) throws RemoteException {
|
2021-11-30 16:39:17 +00:00
|
|
|
lindaInstance.eventRegister(mode, timing, template, callback);
|
|
|
|
}
|
|
|
|
|
2021-12-02 20:57:01 +00:00
|
|
|
public void debug(String prefix) throws RemoteException {
|
2021-11-30 16:39:17 +00:00
|
|
|
lindaInstance.debug(prefix);
|
|
|
|
}
|
|
|
|
}
|