4 * Copyright 2010. The SimGrid Team. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the license (GNU LGPL) which comes with this package.
9 package mutualExclusion.centralized;
11 import org.simgrid.msg.Msg;
12 import org.simgrid.msg.MsgException;
13 import org.simgrid.msg.Task;
14 import org.simgrid.msg.Process;
16 public class Node extends Process {
18 public void request(double CStime) throws MsgException {
19 RequestTask req = new RequestTask(this.name);
20 Msg.info("Send a request to the coordinator");
21 req.send("coordinator");
22 Msg.info("Wait for a grant from the coordinator");
23 Task.receive(this.name); // FIXME: ensure that this is a grant
24 Task compute = new Task("CS", CStime, 0);
26 ReleaseTask release = new ReleaseTask();
27 release.send("coordinator");
30 public void main(String[] args) throws MsgException {
31 request(Double.parseDouble(args[1]));