use of org.gridlab.gat.io.Pipe in project compss by bsc-wdc.
the class EndpointExample method remote.
public void remote() throws GATObjectCreationException, GATInvocationException, URISyntaxException, IOException, InterruptedException {
System.err.println("Starting the 'remote' instance.");
AdvertService advert = GAT.createAdvertService();
advert.importDataBase(new URI("any://localhost/example-advert.db"));
System.err.println("Advert database imported from 'any://localhost/example-advert.db'.");
Endpoint endpoint = (Endpoint) advert.getAdvertisable("examples/endpoint");
System.err.println("Endpoint retrieved from the advert service.");
Pipe p = endpoint.connect();
System.err.println("Connection established. Writing 'hello world'.");
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(p.getOutputStream()));
out.write("hello world\n");
out.flush();
Thread.sleep(10 * 1000);
p.close();
}
use of org.gridlab.gat.io.Pipe in project compss by bsc-wdc.
the class EndpointExample method local.
public void local(String remoteHost) throws GATObjectCreationException, GATInvocationException, URISyntaxException, IOException {
System.err.println("Starting the 'local' instance.");
Endpoint endpoint = GAT.createEndpoint();
AdvertService advert = GAT.createAdvertService();
advert.add(endpoint, null, "examples/endpoint");
advert.exportDataBase(new URI("any://" + remoteHost + "/example-advert.db"));
System.err.println("Advert database exported to: '" + "any://" + remoteHost + "/example-advert.db" + "'.");
System.err.println("Setup ready. Listening for incoming connection from 'remote' instance");
Pipe p = endpoint.listen();
System.err.println("Connection established. Trying to read a line.");
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
System.out.println("read: " + in.readLine());
p.close();
}
Aggregations