Skip to content

Commit

Permalink
Cleaned up code for Request
Browse files Browse the repository at this point in the history
  • Loading branch information
laforge49 committed Apr 5, 2012
1 parent 95a9c8c commit 481992b
Showing 1 changed file with 18 additions and 56 deletions.
74 changes: 18 additions & 56 deletions src/main/java/org/agilewiki/jactor/lpc/Request.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,28 +72,15 @@ final public RESPONSE_TYPE send(JAFuture future, Actor targetActor)
}

/**
* Send a request.
* Send a request and waits for a response.
*
* @param senderInternals The sending actor's internals.
* @param targetActor The target actor.
* @param rp The response processor.
* @param future The future.
* @param targetActor The target actor.
* @throws Exception Any uncaught exceptions raised while processing the request.
*/
final public void send(Internals senderInternals, Actor targetActor, RP<RESPONSE_TYPE> rp)
final public RESPONSE_TYPE send(JAFuture future, TARGET_TYPE targetActor)
throws Exception {
if (isTargetType(targetActor)) {
senderInternals.send(targetActor, this, rp);
return;
}
Actor parent = targetActor.getParent();
if (parent != null) {
send(senderInternals, parent, rp);
return;
}
throw new UnsupportedOperationException(
"request: " + getClass().getName() +
" target actor: " + targetActor.getClass().getName() +
" target actor type: " + targetActor.getActorType());
return (RESPONSE_TYPE) future.send((Actor) targetActor, this);
}

/**
Expand Down Expand Up @@ -122,6 +109,19 @@ final public void send(APCRequestSource requestSource, Actor targetActor, RP<RES
}


/**
* Send a request.
*
* @param requestSource The sender of the request.
* @param targetActor The target actor.
* @param rp The response processor.
* @throws Exception Any uncaught exceptions raised while processing the request.
*/
final public void send(APCRequestSource requestSource, TARGET_TYPE targetActor, RP<RESPONSE_TYPE> rp)
throws Exception {
((Actor) targetActor).acceptRequest(requestSource, this, rp);
}

/**
* Send a request event.
*
Expand All @@ -145,44 +145,6 @@ final public void sendEvent(Actor targetActor)
" target actor type: " + targetActor.getActorType());
}

/**
* Send a request and waits for a response.
*
* @param future The future.
* @param targetActor The target actor.
* @throws Exception Any uncaught exceptions raised while processing the request.
*/
final public RESPONSE_TYPE send(JAFuture future, TARGET_TYPE targetActor)
throws Exception {
return (RESPONSE_TYPE) future.send((Actor) targetActor, this);
}

/**
* Send a request.
*
* @param senderInternals The sending actor's internals.
* @param targetActor The target actor.
* @param rp The response processor.
* @throws Exception Any uncaught exceptions raised while processing the request.
*/
final public void send(Internals senderInternals, TARGET_TYPE targetActor, RP<RESPONSE_TYPE> rp)
throws Exception {
senderInternals.send((Actor) targetActor, this, rp);
}

/**
* Send a request.
*
* @param requestSource The sender of the request.
* @param targetActor The target actor.
* @param rp The response processor.
* @throws Exception Any uncaught exceptions raised while processing the request.
*/
final public void send(APCRequestSource requestSource, TARGET_TYPE targetActor, RP<RESPONSE_TYPE> rp)
throws Exception {
((Actor) targetActor).acceptRequest(requestSource, this, rp);
}

/**
* Send a request event.
*
Expand Down

0 comments on commit 481992b

Please sign in to comment.