Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/ServicesStartupSequence.java')
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/ServicesStartupSequence.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/ServicesStartupSequence.java b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/ServicesStartupSequence.java
new file mode 100644
index 00000000000..c137bc36369
--- /dev/null
+++ b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/timers/ServicesStartupSequence.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Wind River Systems - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.examples.dsf.timers;
+
+import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
+import org.eclipse.cdt.dsf.concurrent.Sequence;
+import org.eclipse.cdt.dsf.service.DsfSession;
+
+/**
+ * Startup sequence for the timers session. With only two services, this is
+ * a very simple sequence.
+ */
+public class ServicesStartupSequence extends Sequence {
+
+ final private DsfSession fSession;
+
+ // The reference to the services are saved to use in the last step.
+ private TimerService fTimerService = null;
+ private AlarmService fAlarmService = null;
+
+
+ public ServicesStartupSequence(DsfSession session) {
+ super(session.getExecutor());
+ fSession = session;
+ }
+
+ Step[] fSteps = new Step[] {
+ new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fTimerService = new TimerService(fSession);
+ fTimerService.initialize(requestMonitor);
+ }},
+ new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ fAlarmService = new AlarmService(fSession);
+ fAlarmService.initialize(requestMonitor);
+ }},
+ new Step() {
+ @Override
+ public void execute(RequestMonitor requestMonitor) {
+ // Create the first timer and trigger.
+ fTimerService.startTimer();
+ fAlarmService.createTrigger(5);
+ requestMonitor.done();
+ }}
+ };
+
+ @Override
+ public Step[] getSteps() { return fSteps; }
+}

Back to the top