BREAKAGE: switching from se.scalablesolutions.akka to akka for all packages
This commit is contained in:
parent
29791593f0
commit
680ee7ddf1
393 changed files with 2100 additions and 2101 deletions
73
akka-spring/src/test/java/akka/spring/foo/PingActor.java
Normal file
73
akka-spring/src/test/java/akka/spring/foo/PingActor.java
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
package akka.spring.foo;
|
||||
|
||||
import akka.actor.UntypedActor;
|
||||
import akka.actor.ActorRef;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
|
||||
|
||||
/**
|
||||
* test class
|
||||
*/
|
||||
public class PingActor extends UntypedActor implements ApplicationContextAware {
|
||||
|
||||
private String stringFromVal;
|
||||
private String stringFromRef;
|
||||
public static String lastMessage = null;
|
||||
public static CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
|
||||
private boolean gotApplicationContext = false;
|
||||
|
||||
|
||||
public void setApplicationContext(ApplicationContext context) {
|
||||
gotApplicationContext = true;
|
||||
}
|
||||
|
||||
public boolean gotApplicationContext() {
|
||||
return gotApplicationContext;
|
||||
}
|
||||
|
||||
public String getStringFromVal() {
|
||||
return stringFromVal;
|
||||
}
|
||||
|
||||
public void setStringFromVal(String s) {
|
||||
stringFromVal = s;
|
||||
}
|
||||
|
||||
public String getStringFromRef() {
|
||||
return stringFromRef;
|
||||
}
|
||||
|
||||
public void setStringFromRef(String s) {
|
||||
stringFromRef = s;
|
||||
}
|
||||
|
||||
private String longRunning() {
|
||||
try {
|
||||
Thread.sleep(6000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
return "this took long";
|
||||
}
|
||||
|
||||
public void onReceive(Object message) throws Exception {
|
||||
if (message instanceof String) {
|
||||
lastMessage = (String) message;
|
||||
if (message.equals("longRunning")) {
|
||||
ActorRef pongActor = UntypedActor.actorOf(PongActor.class).start();
|
||||
pongActor.sendRequestReply("longRunning", getContext());
|
||||
}
|
||||
latch.countDown();
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown message: " + message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue