Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2013-07-04 13:23:50 -0400
committerHenrik Rentz-Reichert2013-07-04 13:23:50 -0400
commit015004ced90703e2b22d4b8b86ecd4ea9580334f (patch)
treef616bfa1eec7cf1dc2f531108740cb53eb4a1c4b /runtime/org.eclipse.etrice.runtime.java/src/org/eclipse
parent25222bb74b01250792046457d9f1e45d45557209 (diff)
downloadorg.eclipse.etrice-015004ced90703e2b22d4b8b86ecd4ea9580334f.tar.gz
org.eclipse.etrice-015004ced90703e2b22d4b8b86ecd4ea9580334f.tar.xz
org.eclipse.etrice-015004ced90703e2b22d4b8b86ecd4ea9580334f.zip
[generator.c, runtime.c] bug 412334: [generator.java][runtime.java] use physical and mapping model
https://bugs.eclipse.org/412334
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.java/src/org/eclipse')
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java43
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java25
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java14
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java3
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java4
5 files changed, 67 insertions, 22 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java
new file mode 100644
index 000000000..b06856b9a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/IMessageService.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2013 protos software gmbh (http://www.protos.de).
+ * 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:
+ * Henrik Rentz-Reichert (initial contribution)
+ *
+ *******************************************************************************/
+
+package org.eclipse.etrice.runtime.java.messaging;
+
+/**
+ * @author Henrik Rentz-Reichert
+ *
+ */
+public interface IMessageService extends IRTObject, IMessageReceiver, Runnable {
+
+ enum ExecMode {
+ POLLED, BLOCKED, MIXED
+ }
+
+ void terminate();
+
+ Address getFreeAddress();
+
+ void freeAddress(Address addr);
+
+ /**
+ * set the thread of this service
+ * (also sets the thread priority)
+ *
+ * @param thread
+ */
+ void setThread(Thread thread);
+
+ /**
+ * @return the thread of this service
+ */
+ Thread getThread();
+}
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java
index 7379871a3..3bb067c7b 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageService.java
@@ -15,14 +15,14 @@ package org.eclipse.etrice.runtime.java.messaging;
/**
- * The MessageService the backbone of the asynchronous communication inside a SubSystem
+ * The MessageService is the backbone of the asynchronous communication inside a SubSystem
* It usually contains a thread a message queue and a dispatcher
*
* @author Thomas Schuetz (initial contribution)
* @author Henrik Rentz-Reichert (extending RTObject, implementing Runnable)
*
*/
-public class MessageService extends RTObject implements IMessageReceiver, Runnable {
+public class MessageService extends RTObject implements IMessageService {
private boolean running = false;
@@ -34,11 +34,15 @@ public class MessageService extends RTObject implements IMessageReceiver, Runnab
private Thread thread;
private int priority;
- public MessageService(IRTObject parent, int node, int thread, String name) {
- this(parent, node, thread, name, Thread.NORM_PRIORITY);
+ public MessageService(IRTObject parent, ExecMode mode, int node, int thread, String name) {
+ this(parent, mode, 0, node, thread, name, Thread.NORM_PRIORITY);
}
- public MessageService(IRTObject parent, int node, int thread, String name, int priority) {
+ public MessageService(IRTObject parent, ExecMode mode, int nsec, int node, int thread, String name) {
+ this(parent, mode, nsec, node, thread, name, Thread.NORM_PRIORITY);
+ }
+
+ public MessageService(IRTObject parent, ExecMode mode, int nsec, int node, int thread, String name, int priority) {
super(parent, "MessageService_"+name);
address = new Address(node, thread, 0);
@@ -117,11 +121,8 @@ public class MessageService extends RTObject implements IMessageReceiver, Runnab
}
}
- /**
- * set the thread of this service
- * (also sets the thread priority)
- *
- * @param thread
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.messaging.IMessageService#setThread(java.lang.Thread)
*/
public void setThread(Thread thread) {
this.thread = thread;
@@ -129,8 +130,8 @@ public class MessageService extends RTObject implements IMessageReceiver, Runnab
thread.setPriority(priority);
}
- /**
- * @return the thread of this service
+ /* (non-Javadoc)
+ * @see org.eclipse.etrice.runtime.java.messaging.IMessageService#getThread()
*/
public Thread getThread() {
return thread;
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java
index 2776a0ba2..ee820d1bc 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/messaging/MessageServiceController.java
@@ -59,7 +59,7 @@ public class MessageServiceController {
}
}
- private List<MessageService> messageServiceList = null;
+ private List<IMessageService> messageServiceList = null;
private PathToThread path2thread = new PathToThread();
private PathToPeers path2peers = new PathToPeers();
private boolean running = false;
@@ -67,10 +67,10 @@ public class MessageServiceController {
public MessageServiceController(/*IRTObject parent*/){
// TODOTS: Who is parent of MessageServices and Controller?
// this.parent = parent;
- messageServiceList = new ArrayList<MessageService>();
+ messageServiceList = new ArrayList<IMessageService>();
}
- public void addMsgSvc(MessageService msgSvc){
+ public void addMsgSvc(IMessageService msgSvc){
// TODOTS: Who is parent of MessageServices ?
assert(msgSvc.getAddress().threadID == messageServiceList.size());
messageServiceList.add(msgSvc);
@@ -80,14 +80,14 @@ public class MessageServiceController {
return messageServiceList.size();
}
- public MessageService getMsgSvc(int threadID){
+ public IMessageService getMsgSvc(int threadID){
assert(threadID < messageServiceList.size());
return messageServiceList.get(threadID);
}
public void start() {
// start all message services
- for (MessageService msgSvc : messageServiceList){
+ for (IMessageService msgSvc : messageServiceList){
Thread thread = new Thread(msgSvc, msgSvc.getName());
msgSvc.setThread(thread);
thread.start();
@@ -130,7 +130,7 @@ public class MessageServiceController {
private void terminate() {
// terminate all message services
- for (MessageService msgSvc : messageServiceList){
+ for (IMessageService msgSvc : messageServiceList){
msgSvc.terminate();
// TODOTS: stop in order of priorities
}
@@ -141,7 +141,7 @@ public class MessageServiceController {
* ! not threadsafe !
*/
public void waitTerminate() {
- for (MessageService msgSvc : messageServiceList) {
+ for (IMessageService msgSvc : messageServiceList) {
try {
msgSvc.getThread().join(1000); // wait at most 1000ms
if (msgSvc.getThread().isAlive())
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java
index b3436d82b..65babe6af 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java
@@ -13,6 +13,7 @@ import java.util.List;
import org.eclipse.etrice.runtime.java.messaging.AbstractMessageReceiver;
import org.eclipse.etrice.runtime.java.messaging.Address;
import org.eclipse.etrice.runtime.java.messaging.IMessageReceiver;
+import org.eclipse.etrice.runtime.java.messaging.IMessageService;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
import org.eclipse.etrice.runtime.java.messaging.MessageService;
import org.eclipse.etrice.runtime.java.messaging.RTServices;
@@ -39,7 +40,7 @@ public abstract class InterfaceItemBase extends AbstractMessageReceiver {
int thread = RTServices.getInstance().getMsgSvcCtrl().getThreadForPath(getParent().getInstancePath());
if (thread>=0) {
- MessageService msgSvc = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(thread);
+ IMessageService msgSvc = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(thread);
Address addr = msgSvc.getFreeAddress();
setAddress(addr);
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
index 6234d6a90..1278aaaa3 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java
@@ -11,8 +11,8 @@ package org.eclipse.etrice.runtime.java.modelbase;
import org.eclipse.etrice.runtime.java.config.IVariableService;
import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
import org.eclipse.etrice.runtime.java.messaging.Address;
+import org.eclipse.etrice.runtime.java.messaging.IMessageService;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
-import org.eclipse.etrice.runtime.java.messaging.MessageService;
import org.eclipse.etrice.runtime.java.messaging.RTObject;
import org.eclipse.etrice.runtime.java.messaging.RTServices;
import org.eclipse.etrice.runtime.java.modelbase.RTSystemProtocol.RTSystemConjPort;
@@ -119,7 +119,7 @@ public abstract class SubSystemClassBase extends RTObject implements IEventRecei
System.out.println("=== done destroy RTServices\n\n\n");
}
- public MessageService getMsgService(int idx) {
+ public IMessageService getMsgService(int idx) {
return RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(idx);
}

Back to the top