Fixing ticket #524

This commit is contained in:
Viktor Klang 2010-11-11 17:23:37 +01:00
parent efa5cf21de
commit 08fd01c652
5 changed files with 14 additions and 8 deletions

View file

@ -16,7 +16,6 @@ import akka.remote.protocol.RemoteProtocol._
import akka.remote.protocol.RemoteProtocol.ActorType._
import akka.config.Config._
import akka.config.ConfigurationException
import akka.dispatch.{DefaultCompletableFuture, CompletableFuture}
import akka.serialization.RemoteActorSerialization
import akka.serialization.RemoteActorSerialization._
@ -31,6 +30,7 @@ import org.jboss.netty.handler.ssl.SslHandler
import scala.collection.mutable.Map
import scala.reflect.BeanProperty
import akka.dispatch. {Future, DefaultCompletableFuture, CompletableFuture}
/**
* Use this object if you need a single remote server on a specific node.
@ -66,10 +66,10 @@ object RemoteNode extends RemoteServer
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
object RemoteServer {
val UUID_PREFIX = "uuid:"
val SECURE_COOKIE: Option[String] = config.getString("akka.remote.secure-cookie")
val REQUIRE_COOKIE = {
val UUID_PREFIX = "uuid:"
val MESSAGE_FRAME_SIZE = config.getInt("akka.remote.server.message-frame-size", 1048576)
val SECURE_COOKIE = config.getString("akka.remote.secure-cookie")
val REQUIRE_COOKIE = {
val requireCookie = config.getBool("akka.remote.server.require-cookie", true)
if (requireCookie && RemoteServer.SECURE_COOKIE.isEmpty) throw new ConfigurationException(
"Configuration option 'akka.remote.server.require-cookie' is turned on but no secure cookie is defined in 'akka.remote.secure-cookie'.")
@ -400,7 +400,7 @@ class RemoteServerPipelineFactory(
}
val ssl = if(RemoteServer.SECURE) join(new SslHandler(engine)) else join()
val lenDec = new LengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4)
val lenDec = new LengthFieldBasedFrameDecoder(RemoteServer.MESSAGE_FRAME_SIZE, 0, 4, 0, 4)
val lenPrep = new LengthFieldPrepender(4)
val protobufDec = new ProtobufDecoder(RemoteMessageProtocol.getDefaultInstance)
val protobufEnc = new ProtobufEncoder

View file

@ -181,7 +181,6 @@ abstract class TypedActor extends Actor with Proxyable {
if (Actor.SERIALIZE_MESSAGES) serializeArguments(joinPoint)
if (TypedActor.isOneWay(joinPoint)) joinPoint.proceed
else self.reply(joinPoint.proceed)
case Link(proxy) => self.link(proxy)
case Unlink(proxy) => self.unlink(proxy)
case unexpected => throw new IllegalActorStateException(
@ -851,6 +850,7 @@ private[akka] abstract class ActorAspect {
ActorType.TypedActor)
if (isOneWay) null // for void methods
//else if (TypedActor.returnsFuture_?(methodRtti)) future.get
else {
if (future.isDefined) {
future.get.await

View file

@ -1,8 +1,9 @@
package akka.actor;
import java.util.concurrent.CountDownLatch;
import akka.dispatch.Future;
public interface SamplePojo {
public String greet(String s);
public String fail();
public Future<String> someFutureString();
}

View file

@ -25,6 +25,10 @@ public class SamplePojoImpl extends TypedActor implements SamplePojo {
throw new RuntimeException("expected");
}
public akka.dispatch.Future<String> someFutureString() {
return future("foo");
}
@Override
public void preRestart(Throwable e) {
_pre = true;

View file

@ -135,6 +135,7 @@ akka {
service = on
hostname = "localhost" # The hostname or IP that clients should connect to
port = 2552 # The port clients should connect to
message-frame-size = 1048576
connection-timeout = 1
require-cookie = on
untrusted-mode = off