Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Add example task to hello world app
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Nothaas committed Feb 18, 2019
1 parent d97031b commit 201ceb3
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions dxa-helloworld/src/main/java/de/hhu/bsinfo/dxapp/HelloTask.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Copyright (C) 2018 Heinrich-Heine-Universitaet Duesseldorf, Institute of Computer Science,
* Department Operating Systems
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public
* License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/

package de.hhu.bsinfo.dxapp;

import de.hhu.bsinfo.dxram.ms.Signal;
import de.hhu.bsinfo.dxram.ms.Task;
import de.hhu.bsinfo.dxram.ms.TaskContext;
import de.hhu.bsinfo.dxutils.serialization.Exporter;
import de.hhu.bsinfo.dxutils.serialization.Importer;

/**
* Example for a task script to run with the MasterSlaveService of DXRAM.
*
* @author Stefan Nothaas, [email protected], 18.02.2019
*/
public class HelloTask implements Task {
/**
* Constructor.
*/
public HelloTask() {

}

@Override
public int execute(final TaskContext p_ctx) {
System.out.println("Hello from task running on slave " + p_ctx.getCtxData().getSlaveId());
return 0;
}

@Override
public void handleSignal(final Signal p_signal) {
// ignore signals
}

@Override
public void exportObject(final Exporter p_exporter) {
// nothing to export
}

@Override
public void importObject(final Importer p_importer) {
// nothing to import
}

@Override
public int sizeofObject() {
return 0;
}
}

0 comments on commit 201ceb3

Please sign in to comment.