mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[220446] Updated Excercise 4 comments.
This commit is contained in:
parent
681323f895
commit
b36441f7f9
2 changed files with 46 additions and 23 deletions
|
@ -50,7 +50,8 @@ import org.eclipse.dd.examples.dsf.DsfExamplesPlugin;
|
||||||
* </p>
|
* </p>
|
||||||
*/
|
*/
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//#@ThreadSafe
|
//#@ThreadSafe
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -73,7 +74,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @Immutable
|
//# @Immutable
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -84,7 +86,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @Immutable
|
//# @Immutable
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -98,7 +101,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
|
|
||||||
// The executor used to access all internal data of the generator.
|
// The executor used to access all internal data of the generator.
|
||||||
//#ifdef excercises
|
//#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
|
// 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
|
// that the concurrency rule that applies to the class also applies to this
|
||||||
// member.
|
// member.
|
||||||
|
@ -110,7 +114,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// method reads from it.
|
// method reads from it.
|
||||||
// The executor used to access all internal data of the generator.
|
// The executor used to access all internal data of the generator.
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -119,7 +124,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
// List of listeners is not synchronized, it also has to be accessed
|
// List of listeners is not synchronized, it also has to be accessed
|
||||||
// using the executor.
|
// using the executor.
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -127,7 +133,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
|
|
||||||
// Current number of elements in this generator.
|
// Current number of elements in this generator.
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -135,7 +142,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
|
|
||||||
// Counter used to determine when to reset the element count.
|
// Counter used to determine when to reset the element count.
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -143,7 +151,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
|
|
||||||
// Elements which were modified since the last reset.
|
// Elements which were modified since the last reset.
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -151,14 +160,16 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
|
|
||||||
// Flag used to ensure that requests are processed sequentially.
|
// Flag used to ensure that requests are processed sequentially.
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
private boolean fServiceQueueInProgress = false;
|
private boolean fServiceQueueInProgress = false;
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#endif
|
||||||
public DataGeneratorWithExecutor() {
|
public DataGeneratorWithExecutor() {
|
||||||
// Create the executor
|
// Create the executor
|
||||||
|
@ -177,7 +188,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#endif
|
||||||
public void shutdown(final RequestMonitor rm) {
|
public void shutdown(final RequestMonitor rm) {
|
||||||
try {
|
try {
|
||||||
|
@ -203,7 +215,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#endif
|
||||||
public void getCount(final DataRequestMonitor<Integer> rm) {
|
public void getCount(final DataRequestMonitor<Integer> rm) {
|
||||||
try {
|
try {
|
||||||
|
@ -220,7 +233,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#endif
|
||||||
public void getValue(final int index, final DataRequestMonitor<String> rm) {
|
public void getValue(final int index, final DataRequestMonitor<String> rm) {
|
||||||
try {
|
try {
|
||||||
|
@ -237,7 +251,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#endif
|
||||||
public void addListener(final Listener listener) {
|
public void addListener(final Listener listener) {
|
||||||
try {
|
try {
|
||||||
|
@ -250,7 +265,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#endif
|
||||||
public void removeListener(final Listener listener) {
|
public void removeListener(final Listener listener) {
|
||||||
try {
|
try {
|
||||||
|
@ -264,7 +280,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
|
|
||||||
// Main processing function of this generator.
|
// Main processing function of this generator.
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -319,7 +336,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -332,7 +350,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -352,7 +371,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
* This method simulates changes in the supplier's data set.
|
* This method simulates changes in the supplier's data set.
|
||||||
*/
|
*/
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -370,7 +390,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
* Calculates new size for provider's data set.
|
* Calculates new size for provider's data set.
|
||||||
*/
|
*/
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
@ -392,7 +413,8 @@ public class DataGeneratorWithExecutor implements IDataGenerator {
|
||||||
* Invalidates a random range of indexes.
|
* Invalidates a random range of indexes.
|
||||||
*/
|
*/
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//# @ConfinedToDsfExecutor("fExecutor")
|
//# @ConfinedToDsfExecutor("fExecutor")
|
||||||
//#endif
|
//#endif
|
||||||
|
|
|
@ -30,7 +30,8 @@ import org.eclipse.dd.dsf.concurrent.RequestMonitor;
|
||||||
* is changed.
|
* is changed.
|
||||||
*/
|
*/
|
||||||
//#ifdef excercises
|
//#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
|
//#else
|
||||||
//#@ThreadSafe
|
//#@ThreadSafe
|
||||||
//#endif
|
//#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue