From d7635bc04631cb65f36364086ea8507981904ca9 Mon Sep 17 00:00:00 2001 From: Pawel Piech Date: Fri, 29 Feb 2008 16:26:34 +0000 Subject: [PATCH] [220446] Updated the "dataviewer" example and excercises for EclipseCon tutorial. --- .../examples/dsf/dataviewer/AsyncDataViewer.java | 4 ++++ .../dataviewer/DataGeneratorWithExecutor.java | 12 ++++++++---- .../dsf/dataviewer/DataGeneratorWithThread.java | 6 +++++- .../examples/dsf/dataviewer/IDataGenerator.java | 16 ++++++++++++---- .../examples/dsf/dataviewer/SyncDataViewer.java | 4 ++++ 5 files changed, 33 insertions(+), 9 deletions(-) diff --git a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/AsyncDataViewer.java b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/AsyncDataViewer.java index e36a3bdaa56..72feab635da 100644 --- a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/AsyncDataViewer.java +++ b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/AsyncDataViewer.java @@ -8,7 +8,11 @@ * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ +//#ifdef excercises package org.eclipse.dd.examples.dsf.dataviewer; +//#else +//#package org.eclipse.dd.examples.dsf.dataviewer.answers; +//#endif import java.util.HashSet; import java.util.Iterator; 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 5fc0da81485..fb70c5e15a4 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 @@ -15,7 +15,9 @@ package org.eclipse.dd.examples.dsf.dataviewer; //#endif import java.util.HashSet; -import java.util.Iterator; +//#ifdef answers +//#import java.util.Iterator; +//#endif import java.util.LinkedList; import java.util.List; import java.util.Random; @@ -25,14 +27,16 @@ import java.util.concurrent.TimeUnit; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.Status; -import org.eclipse.dd.dsf.concurrent.ConfinedToDsfExecutor; +//#ifdef answers +//#import org.eclipse.dd.dsf.concurrent.ConfinedToDsfExecutor; +//#import org.eclipse.dd.dsf.concurrent.Immutable; +//#import org.eclipse.dd.dsf.concurrent.ThreadSafe; +//#endif import org.eclipse.dd.dsf.concurrent.DataRequestMonitor; import org.eclipse.dd.dsf.concurrent.DefaultDsfExecutor; import org.eclipse.dd.dsf.concurrent.DsfExecutor; import org.eclipse.dd.dsf.concurrent.DsfRunnable; -import org.eclipse.dd.dsf.concurrent.Immutable; import org.eclipse.dd.dsf.concurrent.RequestMonitor; -import org.eclipse.dd.dsf.concurrent.ThreadSafe; import org.eclipse.dd.examples.dsf.DsfExamplesPlugin; /** diff --git a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/DataGeneratorWithThread.java b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/DataGeneratorWithThread.java index 8aeab640e6b..6a4aa133dc4 100644 --- a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/DataGeneratorWithThread.java +++ b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/DataGeneratorWithThread.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems and others. + * Copyright (c) 2006, 2008 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,11 @@ * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ +//#ifdef excercises package org.eclipse.dd.examples.dsf.dataviewer; +//#else +//#package org.eclipse.dd.examples.dsf.dataviewer.answers; +//#endif import java.util.Collections; import java.util.HashSet; 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 1a16605fb17..e31c0edb981 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 Wind River Systems and others. + * Copyright (c) 2006, 2008 Wind River Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -8,7 +8,11 @@ * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ +//#ifdef excercises package org.eclipse.dd.examples.dsf.dataviewer; +//#else +//#package org.eclipse.dd.examples.dsf.dataviewer.answers; +//#endif import java.util.Set; @@ -23,15 +27,19 @@ import org.eclipse.dd.dsf.concurrent.ThreadSafe; * view to receive events indicating when the data supplied by the generator * is changed. */ -@ThreadSafe +//#ifdef excercises +//TODO Excercise 3 - Add an annotationindicating allowed concurrency access +//#else +//#@ThreadSafe +//#endif public interface IDataGenerator { // Constants which control the data generator behavior. // Changing the count range can stress the scalability of the system, while // changing of the process delay and random change interval can stress // its performance. - final static int MIN_COUNT = 50; - final static int MAX_COUNT = 100; + final static int MIN_COUNT = 100; + final static int MAX_COUNT = 200; final static int PROCESSING_DELAY = 10; final static int RANDOM_CHANGE_INTERVAL = 10000; final static int RANDOM_COUNT_CHANGE_INTERVALS = 3; diff --git a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/SyncDataViewer.java b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/SyncDataViewer.java index 2f9f5913ed7..f0c4c20729e 100644 --- a/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/SyncDataViewer.java +++ b/plugins/org.eclipse.dd.examples.dsf/src_preprocess/org/eclipse/dd/examples/dsf/dataviewer/SyncDataViewer.java @@ -8,7 +8,11 @@ * Contributors: * Wind River Systems - initial API and implementation *******************************************************************************/ +//#ifdef excercises package org.eclipse.dd.examples.dsf.dataviewer; +//#else +//#package org.eclipse.dd.examples.dsf.dataviewer.answers; +//#endif import java.util.Set;