Skip to content

Commit

Permalink
getParent now returns a JLPCActor
Browse files Browse the repository at this point in the history
  • Loading branch information
laforge49 committed Apr 7, 2012
1 parent aeb9555 commit b324692
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/agilewiki/jactor/Actor.java
Expand Up @@ -24,6 +24,7 @@
package org.agilewiki.jactor;

import org.agilewiki.jactor.apc.APCRequestSource;
import org.agilewiki.jactor.lpc.JLPCActor;

/**
* <p>
Expand Down Expand Up @@ -101,7 +102,7 @@ public void acceptRequest(APCRequestSource requestSource,
*
* @return The actor's parent, or null.
*/
public Actor getParent();
public JLPCActor getParent();

/**
* Assign the parent actor.
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/org/agilewiki/jactor/lpc/JLPCActor.java
Expand Up @@ -80,15 +80,15 @@ abstract public class JLPCActor implements TargetActor, RequestProcessor, Reques
/**
* The parent actor, for dependency injection.
*/
private Actor parent;
private JLPCActor parent;

/**
* Returns the actor's parent.
*
* @return The actor's parent, or null.
*/
@Override
final public Actor getParent() {
final public JLPCActor getParent() {
return parent;
}

Expand All @@ -105,7 +105,7 @@ public void setParent(Actor parent)
throw new UnsupportedOperationException("The parent can not be changed.");
Requirement[] requirements = requirements();
if (requirements == null || requirements.length == 0) {
this.parent = parent;
this.parent = (JLPCActor) parent;
return;
}
int i = 0;
Expand All @@ -118,7 +118,7 @@ public void setParent(Actor parent)
}
i += 1;
}
this.parent = parent;
this.parent = (JLPCActor) parent;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/org/agilewiki/jactor/basics/Actor2.java
Expand Up @@ -11,7 +11,7 @@ public Actor2(Mailbox mailbox) {

@Override
protected void processRequest(Object request, final RP rp) throws Exception {
Hi1.req.send(this, this, new RP<String>() {
Hi1.req.send(getParent(), this, new RP<String>() {
@Override
public void processResponse(String response) throws Exception {
System.out.println(response);
Expand Down

0 comments on commit b324692

Please sign in to comment.