From b36441f7f901dcda1904c19c2a243089d82f17e9 Mon Sep 17 00:00:00 2001
From: Pawel Piech
Date: Wed, 12 Mar 2008 19:16:54 +0000
Subject: [PATCH] [220446] Updated Excercise 4 comments.
---
.../dataviewer/DataGeneratorWithExecutor.java | 66 ++++++++++++-------
.../dsf/dataviewer/IDataGenerator.java | 3 +-
2 files changed, 46 insertions(+), 23 deletions(-)
diff --git a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/DataGeneratorWithExecutor.java b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/DataGeneratorWithExecutor.java
index d667b2810d4..d3c392c8e2c 100644
--- a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/DataGeneratorWithExecutor.java
+++ b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/DataGeneratorWithExecutor.java
@@ -50,7 +50,8 @@ import org.eclipse.dd.examples.dsf.DsfExamplesPlugin;
*
*/
//#ifdef excercises
-// TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+//TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+//indicating allowed thread access to this class/method/member
//#else
//#@ThreadSafe
//#endif
@@ -73,7 +74,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @Immutable
//#endif
@@ -84,7 +86,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @Immutable
//#endif
@@ -98,7 +101,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
// The executor used to access all internal data of the generator.
//#ifdef excercises
- // TODO Excercise 4 - Add an annotation indicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
// Hint: If a member does not have an annotation, the programmer can assume
// that the concurrency rule that applies to the class also applies to this
// member.
@@ -110,7 +114,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
// method reads from it.
// The executor used to access all internal data of the generator.
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -119,7 +124,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
// List of listeners is not synchronized, it also has to be accessed
// using the executor.
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -127,7 +133,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
// Current number of elements in this generator.
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -135,7 +142,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
// Counter used to determine when to reset the element count.
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -143,7 +151,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
// Elements which were modified since the last reset.
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -151,14 +160,16 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
// Flag used to ensure that requests are processed sequentially.
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
private boolean fServiceQueueInProgress = false;
//#ifdef excercises
- // TODO Excercise 4 - Add an annotation indicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#endif
public DataGeneratorWithExecutor() {
// Create the executor
@@ -177,7 +188,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotation indicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#endif
public void shutdown(final RequestMonitor rm) {
try {
@@ -203,7 +215,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotation indicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#endif
public void getCount(final DataRequestMonitor rm) {
try {
@@ -220,7 +233,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotation indicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#endif
public void getValue(final int index, final DataRequestMonitor rm) {
try {
@@ -237,7 +251,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotation indicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#endif
public void addListener(final Listener listener) {
try {
@@ -250,7 +265,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotation indicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#endif
public void removeListener(final Listener listener) {
try {
@@ -264,7 +280,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
// Main processing function of this generator.
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -319,7 +336,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -332,7 +350,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
}
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -352,7 +371,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
* This method simulates changes in the supplier's data set.
*/
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -370,7 +390,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
* Calculates new size for provider's data set.
*/
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
@@ -392,7 +413,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
* Invalidates a random range of indexes.
*/
//#ifdef excercises
- // TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+ // TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+ // indicating allowed thread access to this class/method/member
//#else
//# @ConfinedToDsfExecutor("fExecutor")
//#endif
diff --git a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/IDataGenerator.java b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/IDataGenerator.java
index e3eb61bc6b1..8e54e8648b2 100644
--- a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/IDataGenerator.java
+++ b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/IDataGenerator.java
@@ -30,7 +30,8 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
* is changed.
*/
//#ifdef excercises
-//TODO Excercise 4 - Add an annotationindicating allowed concurrency access
+// TODO Exercise 4 - Add an annotation (ThreadSafe/ConfinedToDsfExecutor)
+// indicating allowed thread access to this class/method/member
//#else
//#@ThreadSafe
//#endif