Binary compat work for the 0mq module

This commit is contained in:
Viktor Klang 2012-05-24 12:34:18 +02:00
parent a9945f77f6
commit c9ab35d5f0
5 changed files with 16 additions and 24 deletions

View file

@ -205,11 +205,6 @@ private[zeromq] class ConcurrentSocketActor(params: Seq[SocketOption]) extends A
} }
private val listenerOpt = params collectFirst { case Listener(l) l } private val listenerOpt = params collectFirst { case Listener(l) l }
private def watchListener() { private def watchListener(): Unit = listenerOpt foreach context.watch
listenerOpt foreach context.watch private def notifyListener(message: Any): Unit = listenerOpt foreach { _ ! message }
}
private def notifyListener(message: Any) {
listenerOpt foreach { _ ! message }
}
} }

View file

@ -255,7 +255,9 @@ case class Linger(value: Long) extends SocketOption
/** /**
* Gets the linger option @see [[akka.zeromq.Linger]] * Gets the linger option @see [[akka.zeromq.Linger]]
*/ */
object Linger extends SocketOptionQuery object Linger extends SocketOptionQuery {
val no: Linger = Linger(0)
}
/** /**
* Sets the recovery interval for multicast transports using the specified socket. * Sets the recovery interval for multicast transports using the specified socket.

View file

@ -20,5 +20,5 @@ case class Frame(payload: Seq[Byte]) {
* Deserializes ZeroMQ messages into an immutable sequence of frames * Deserializes ZeroMQ messages into an immutable sequence of frames
*/ */
class ZMQMessageDeserializer extends Deserializer { class ZMQMessageDeserializer extends Deserializer {
def apply(frames: Seq[Frame]) = ZMQMessage(frames) def apply(frames: Seq[Frame]): ZMQMessage = ZMQMessage(frames)
} }

View file

@ -19,7 +19,7 @@ import org.zeromq.ZMQException
* @param patch * @param patch
*/ */
case class ZeroMQVersion(major: Int, minor: Int, patch: Int) { case class ZeroMQVersion(major: Int, minor: Int, patch: Int) {
override def toString = "%d.%d.%d".format(major, minor, patch) override def toString: String = "%d.%d.%d".format(major, minor, patch)
} }
/** /**
@ -27,17 +27,14 @@ case class ZeroMQVersion(major: Int, minor: Int, patch: Int) {
*/ */
object ZeroMQExtension extends ExtensionId[ZeroMQExtension] with ExtensionIdProvider { object ZeroMQExtension extends ExtensionId[ZeroMQExtension] with ExtensionIdProvider {
override def get(system: ActorSystem): ZeroMQExtension = super.get(system) override def get(system: ActorSystem): ZeroMQExtension = super.get(system)
def lookup() = this def lookup(): this.type = this
def createExtension(system: ExtendedActorSystem) = new ZeroMQExtension(system) override def createExtension(system: ExtendedActorSystem): ZeroMQExtension = new ZeroMQExtension(system)
private val minVersionString = "2.1.0" private val minVersionString = "2.1.0"
private val minVersion = JZMQ.makeVersion(2, 1, 0) private val minVersion = JZMQ.makeVersion(2, 1, 0)
private[zeromq] def check[TOption <: SocketOption: Manifest](parameters: Seq[SocketOption]) = { private[zeromq] def check[TOption <: SocketOption: Manifest](parameters: Seq[SocketOption]) =
parameters exists { p parameters exists { p ClassManifest.singleType(p) <:< manifest[TOption] }
ClassManifest.singleType(p) <:< manifest[TOption]
}
}
} }
/** /**
@ -47,16 +44,14 @@ object ZeroMQExtension extends ExtensionId[ZeroMQExtension] with ExtensionIdProv
*/ */
class ZeroMQExtension(system: ActorSystem) extends Extension { class ZeroMQExtension(system: ActorSystem) extends Extension {
val DefaultPollTimeout = Duration(system.settings.config.getMilliseconds("akka.zeromq.poll-timeout"), TimeUnit.MILLISECONDS) val DefaultPollTimeout: Duration = Duration(system.settings.config.getMilliseconds("akka.zeromq.poll-timeout"), TimeUnit.MILLISECONDS)
val NewSocketTimeout = Timeout(Duration(system.settings.config.getMilliseconds("akka.zeromq.new-socket-timeout"), TimeUnit.MILLISECONDS)) val NewSocketTimeout: Timeout = Timeout(Duration(system.settings.config.getMilliseconds("akka.zeromq.new-socket-timeout"), TimeUnit.MILLISECONDS))
/** /**
* The version of the ZeroMQ library * The version of the ZeroMQ library
* @return a [[akka.zeromq.ZeroMQVersion]] * @return a [[akka.zeromq.ZeroMQVersion]]
*/ */
def version = { def version: ZeroMQVersion = ZeroMQVersion(JZMQ.getMajorVersion, JZMQ.getMinorVersion, JZMQ.getPatchVersion)
ZeroMQVersion(JZMQ.getMajorVersion, JZMQ.getMinorVersion, JZMQ.getPatchVersion)
}
/** /**
* Factory method to create the [[akka.actor.Props]] to build the ZeroMQ socket actor. * Factory method to create the [[akka.actor.Props]] to build the ZeroMQ socket actor.

View file

@ -20,10 +20,10 @@ package object zeromq {
/** /**
* Convenience accessor to subscribe to all events * Convenience accessor to subscribe to all events
*/ */
val SubscribeAll = Subscribe(Seq.empty) val SubscribeAll: Subscribe = Subscribe.all
/** /**
* Set the linger to 0, doesn't block and discards messages that haven't been sent yet. * Set the linger to 0, doesn't block and discards messages that haven't been sent yet.
*/ */
val NoLinger = Linger(0) val NoLinger: Linger = Linger.no
} }