A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[#!] #! tesh -> #!/usr/bin/env tesh
[simgrid.git]
/
examples
/
java
/
app
/
centralizedmutex
/
Coordinator.java
diff --git
a/examples/java/app/centralizedmutex/Coordinator.java
b/examples/java/app/centralizedmutex/Coordinator.java
index
f89fef9
..
22b3cfd
100644
(file)
--- a/
examples/java/app/centralizedmutex/Coordinator.java
+++ b/
examples/java/app/centralizedmutex/Coordinator.java
@@
-1,5
+1,4
@@
-/* Copyright (c) 2012-2014, 2016. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2012-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-17,14
+16,13
@@
public class Coordinator extends Process {
public Coordinator(Host host, String name, String[]args) {
super(host,name,args);
}
public Coordinator(Host host, String name, String[]args) {
super(host,name,args);
}
- LinkedList<RequestTask> waitingQueue=new LinkedList<RequestTask>();
- int CsToServe;
public void main(String[] args) throws MsgException {
public void main(String[] args) throws MsgException {
- CsToServe = Integer.parseInt(args[0]);
- Task task;
- while (CsToServe >0) {
- task = Task.receive("coordinator");
+ int csToServe = Integer.parseInt(args[0]);
+ LinkedList<RequestTask> waitingQueue=new LinkedList<>();
+
+ while (csToServe >0) {
+ Task task = Task.receive("coordinator");
if (task instanceof RequestTask) {
RequestTask t = (RequestTask) task;
if (waitingQueue.isEmpty()) {
if (task instanceof RequestTask) {
RequestTask t = (RequestTask) task;
if (waitingQueue.isEmpty()) {
@@
-40,8
+38,8
@@
public class Coordinator extends Process {
GrantTask tosend = new GrantTask();
tosend.send(req.from);
}
GrantTask tosend = new GrantTask();
tosend.send(req.from);
}
-
C
sToServe--;
- if (waitingQueue.isEmpty() &&
C
sToServe==0) {
+
c
sToServe--;
+ if (waitingQueue.isEmpty() &&
c
sToServe==0) {
Msg.info("we should shutdown the simulation now");
}
}
Msg.info("we should shutdown the simulation now");
}
}