As the title says, the gate isn't closed if localhost is used as the ip address. Here is a minimal example.
import java.io.IOException;
import java.net.UnknownHostException;
import org.jspace.ActualField;
import org.jspace.RemoteSpace;
import org.jspace.SequentialSpace;
import org.jspace.SpaceRepository;
public class TestStarter {
public static void main(String[] args) throws UnknownHostException, IOException, InterruptedException {
try {
final SpaceRepository rep = new SpaceRepository();
rep.addGate("tcp://localhost:1290/?conn");
final SequentialSpace getSpace = new SequentialSpace();
rep.add("teeest", getSpace);
final RemoteSpace putSpace = new RemoteSpace("tcp://localhost:1290/teeest?conn");
//close the gate
rep.closeGate("tcp://localhost:1290/?conn");
System.out.println("Gate closed");
//now putting something shouldn't work
putSpace.put("cake");
System.out.println("Give cake");
//and get also shouldn't work
getSpace.get(new ActualField("cake"));
System.out.println("Got cake!");
} catch (Exception e) {
e.printStackTrace();
}
}
}
The output is:
Gate closed
Give cake
Got cake!
I would expect both the put and get to throw an error because the connection should have ended.
I should mention that this doesn't only happen with localhost but we have also experienced it with other ip addresses although i am not able to produce an example of it.
Maybe that requires the SpaceRepository and RemoteSpace to be on separate computers to reproduce?
As the title says, the gate isn't closed if localhost is used as the ip address. Here is a minimal example.
The output is:
I would expect both the put and get to throw an error because the connection should have ended.
I should mention that this doesn't only happen with localhost but we have also experienced it with other ip addresses although i am not able to produce an example of it. Maybe that requires the SpaceRepository and RemoteSpace to be on separate computers to reproduce?