diff options
| -rw-r--r-- | ROADMAP | 3 | ||||
| -rw-r--r-- | sources/core/VSTaskManager.java | 12 | ||||
| -rw-r--r-- | sources/protocols/VSAbstractProtocol.java | 16 |
3 files changed, 26 insertions, 5 deletions
@@ -1,3 +1,6 @@ +Bugs: + prozess combo box muss PIDs anzeigen nicht process nums + serialize/deserialize mehrerer prozesse?! Must do: Reliable Multicast Ganze simulationseinstellungen abspeichern/laden koennen diff --git a/sources/core/VSTaskManager.java b/sources/core/VSTaskManager.java index 5e32183..272a52c 100644 --- a/sources/core/VSTaskManager.java +++ b/sources/core/VSTaskManager.java @@ -268,7 +268,7 @@ public class VSTaskManager implements VSSerializable { * * @param task the task to insert */ - private void insert(VSTask task) { + private synchronized void insert(VSTask task) { if (task.timeOver()) { if (task.isProgrammed()) fullfilledProgrammedTasks.addLast(task); @@ -286,7 +286,7 @@ public class VSTaskManager implements VSSerializable { * * @param task the task to add */ - public void addTask(VSTask task) { + public synchronized void addTask(VSTask task) { addTask(task, VSTaskManager.ONLY_ONCE); } @@ -328,7 +328,7 @@ public class VSTaskManager implements VSSerializable { * * @param tasks the tasks to remove */ - public void removeAllTasks(ArrayList<VSTask> tasks) { + public synchronized void removeAllTasks(ArrayList<VSTask> tasks) { for (VSTask task : tasks) removeTask(task); } @@ -396,7 +396,7 @@ public class VSTaskManager implements VSSerializable { if (task.isGlobalTimed()) globalTasks.add(task); - for (VSTask task : globalTasks) + for (VSTask task : this.globalTasks) if (task.isProgrammed()) globalTasks.add(task); @@ -453,7 +453,7 @@ public class VSTaskManager implements VSSerializable { /* (non-Javadoc) * @see java.lang.Object#toString() */ - public String toString() { + public synchronized String toString() { StringBuffer buffer = new StringBuffer(); buffer.append(prefs.getString("lang.task.manager")); @@ -467,6 +467,7 @@ public class VSTaskManager implements VSSerializable { } buffer.append(prefs.getString("lang.tasks.global")); + buffer.append(": "); for (VSTask task : globalTasks) { buffer.append(task); @@ -474,6 +475,7 @@ public class VSTaskManager implements VSSerializable { } buffer.append(prefs.getString("lang.tasks.local")); + buffer.append(": "); ArrayList<VSProcess> processes = simulatorCanvas.getProcesses(); synchronized (processes) { diff --git a/sources/protocols/VSAbstractProtocol.java b/sources/protocols/VSAbstractProtocol.java index 30e664c..9999f62 100644 --- a/sources/protocols/VSAbstractProtocol.java +++ b/sources/protocols/VSAbstractProtocol.java @@ -54,6 +54,12 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { /** The protocol object is a client. */ private boolean isClient; + /** The protocol object server is initialized. */ + private boolean isServerInitialized; + + /** The protocol object client is initialized. */ + private boolean isClientInitialized; + /** The current protocol object's context is a server. */ private boolean currentContextIsServer; @@ -105,11 +111,15 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { if (hasOnServerStart) { if (isServer) { currentContextIsServer(true); + if (!isServerInitialized) + onInit(); onServerStart(); } } else { if (isClient) { currentContextIsServer(false); + if (!isClientInitialized) + onInit(); onClientStart(); } } @@ -122,11 +132,13 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { if (isClient) { currentContextIsServer(false); onClientInit(); + isClientInitialized = true; } if (isServer) { currentContextIsServer(true); onServerInit(); + isServerInitialized = true; } } @@ -161,11 +173,15 @@ abstract public class VSAbstractProtocol extends VSAbstractEvent { if (isServer) { currentContextIsServer(true); + if (!isServerInitialized) + onInit(); onServerRecv(message); } if (isClient) { currentContextIsServer(false); + if (!isClientInitialized) + onInit(); onClientRecv(message); } } |
