Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2011-02-23 17:10:45 -0500
committerHenrik Rentz-Reichert2011-02-23 17:10:45 -0500
commitc5e939ebca6576a089a4d3c8101f61fd7553371c (patch)
tree0eb9c803244e79b691eb351ad4d828bab6e0e34f /runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase
parentf2c3d8e1319515d3ab14323a15cb75df7af28c16 (diff)
downloadorg.eclipse.etrice-c5e939ebca6576a089a4d3c8101f61fd7553371c.tar.gz
org.eclipse.etrice-c5e939ebca6576a089a4d3c8101f61fd7553371c.tar.xz
org.eclipse.etrice-c5e939ebca6576a089a4d3c8101f61fd7553371c.zip
applied patch 2 of
https://bugs.eclipse.org/bugs/show_bug.cgi?id=337075 Thanks for the contribution!
Diffstat (limited to 'runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase')
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java12
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/InterfaceItemBase.java24
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java4
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/SubSystemClassBase.java18
4 files changed, 36 insertions, 22 deletions
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
index de874bd1a..57a8eb84a 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/ActorClassBase.java
@@ -13,6 +13,7 @@ import org.eclipse.etrice.runtime.java.messaging.IMessageReceiver;
import org.eclipse.etrice.runtime.java.messaging.IRTObject;
import org.eclipse.etrice.runtime.java.messaging.Message;
import org.eclipse.etrice.runtime.java.messaging.MessageService;
+import org.eclipse.etrice.runtime.java.messaging.RTServices;
/**
* The base class for model actor classes.
@@ -36,13 +37,14 @@ public abstract class ActorClassBase extends EventReceiver implements IMessageRe
*/
protected int state;
- private MessageService msgsvc = null;
+ private MessageService ownMsgsvc = null;
+ private Address ownAddr = null;
- public ActorClassBase(IRTObject parent, String name, IMessageReceiver msgsvc) {
+ public ActorClassBase(IRTObject parent, String name, Address ownAddr) {
super(parent, name);
- if (msgsvc instanceof MessageService)
- this.msgsvc = (MessageService) msgsvc;
+ this.ownAddr = ownAddr;
+ ownMsgsvc = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(this.ownAddr.threadID);
}
public String toString(){
@@ -77,6 +79,6 @@ public abstract class ActorClassBase extends EventReceiver implements IMessageRe
}
public MessageService getMsgsvc() {
- return msgsvc;
+ return ownMsgsvc;
}
}
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 5ffe6ae84..5492c963e 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
@@ -12,6 +12,7 @@ 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.MessageService;
+import org.eclipse.etrice.runtime.java.messaging.RTServices;
/**
* The abstract base class for actor class interface items like ports and saps.
@@ -21,30 +22,37 @@ import org.eclipse.etrice.runtime.java.messaging.MessageService;
*/
public abstract class InterfaceItemBase extends AbstractMessageReceiver {
- private IMessageReceiver msgReceiver;
+ private IMessageReceiver ownMsgReceiver;
+ private IMessageReceiver peerMsgReceiver;
private int localId;
private int idx;
private Address peerAddress;
- public InterfaceItemBase (IEventReceiver actor, String name, int localId, int idx, Address address, Address peerAddress, IMessageReceiver msgReceiver){
- super(actor, address, name);
- this.msgReceiver = msgReceiver;
+ public InterfaceItemBase (IEventReceiver actor, String name, int localId, int idx, Address ownAddress, Address peerAddress){
+ super(actor, ownAddress, name);
+ this.ownMsgReceiver = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(ownAddress.threadID);
+ this.peerMsgReceiver = RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(peerAddress.threadID);
this.localId = localId;
this.idx = idx;
this.peerAddress = peerAddress;
- if (getAddress()!=null && msgReceiver instanceof MessageService) {
- MessageService ms = (MessageService) msgReceiver;
+ if (getAddress()!=null && this.ownMsgReceiver instanceof MessageService) {
+ MessageService ms = (MessageService) this.ownMsgReceiver;
+ // register at the own dispatcher to receive messages
ms.getMessageDispatcher().addMessageReceiver(this);
}
}
protected IMessageReceiver getMsgReceiver() {
- return msgReceiver;
+ return ownMsgReceiver;
+ }
+
+ protected IMessageReceiver getPeerMsgReceiver() {
+ return peerMsgReceiver;
}
public void setMsgReceiver(IMessageReceiver msgReceiver) {
- this.msgReceiver = msgReceiver;
+ this.ownMsgReceiver = msgReceiver;
}
public IEventReceiver getActor() {
diff --git a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java
index 67f346fe6..9a4989b87 100644
--- a/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java
+++ b/runtime/org.eclipse.etrice.runtime.java/src/org/eclipse/etrice/runtime/java/modelbase/PortBase.java
@@ -19,7 +19,7 @@ import org.eclipse.etrice.runtime.java.messaging.IMessageReceiver;
*/
public abstract class PortBase extends InterfaceItemBase {
- public PortBase (IEventReceiver actor, String name, int localId, int idx, Address address, Address peerAddress, IMessageReceiver msgReceiver){
- super(actor, name, localId, idx, address, peerAddress, msgReceiver);
+ public PortBase (IEventReceiver actor, String name, int localId, int idx, Address address, Address peerAddress){
+ super(actor, name, localId, idx, address, peerAddress);
}
}
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 398069176..6da6db7da 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
@@ -54,8 +54,12 @@ public abstract class SubSystemClassBase extends RTObject {
System.out.println("*** MainComponent "+getInstancePath()+"::init ***");
// MessageService
- RTServices.getInstance().getMsgSrvCtrl().addMsgSrv(new MessageService(this, new Address(0, 0, 0), "MessageService0"));
- //instantiateMessageServices();
+ instantiateMessageServices();
+
+ // this is the place to connect the message services if necessary
+ // normaly the ports will address the correct target message service directly
+ // it is just for test purposes
+ // RTServices.getInstance().getMsgSvcCtrl().connectAll();
instantiateActors();
@@ -66,7 +70,7 @@ public abstract class SubSystemClassBase extends RTObject {
}
}
- //public abstract void instantiateMessageServices();
+ public abstract void instantiateMessageServices();
public abstract void instantiateActors();
@@ -78,13 +82,13 @@ public abstract class SubSystemClassBase extends RTObject {
}
// start all message services
- RTServices.getInstance().getMsgSrvCtrl().start();
+ RTServices.getInstance().getMsgSvcCtrl().start();
running = true;
}
public void stop() {
- RTServices.getInstance().getMsgSrvCtrl().stop();
+ RTServices.getInstance().getMsgSvcCtrl().stop();
// stop all actor instances
if (instances!=null)
@@ -105,8 +109,8 @@ public abstract class SubSystemClassBase extends RTObject {
System.out.println("*** MainComponent "+getInstancePath()+"::destroy ***");
}
- public MessageService getMsgService() {
- return RTServices.getInstance().getMsgSrvCtrl().getMessageService(0);
+ public MessageService getMsgService(int idx) {
+ return RTServices.getInstance().getMsgSvcCtrl().getMsgSvc(idx);
}
public ActorClassBase getInstance(int i) {

Back to the top