add INTERNAL API markers and explicit return types

This commit is contained in:
Roland 2013-02-15 11:59:01 +01:00
parent 933c93c05b
commit 6d61a59a0f
14 changed files with 61 additions and 30 deletions

View file

@ -1,5 +1,5 @@
/** /**
* Copyright (C) 2009-2012 Typesafe Inc. <http://www.typesafe.com> * Copyright (C) 2009-2013 Typesafe Inc. <http://www.typesafe.com>
*/ */
package akka.io package akka.io

View file

@ -106,8 +106,11 @@ object Tcp extends ExtensionKey[TcpExt] {
case class Received(data: ByteString) extends Event case class Received(data: ByteString) extends Event
case class Connected(remoteAddress: InetSocketAddress, localAddress: InetSocketAddress) extends Event case class Connected(remoteAddress: InetSocketAddress, localAddress: InetSocketAddress) extends Event
case class CommandFailed(cmd: Command) extends Event case class CommandFailed(cmd: Command) extends Event
case object Bound extends Event
case object Unbound extends Event sealed trait Bound extends Event
case object Bound extends Bound
sealed trait Unbound extends Event
case object Unbound extends Unbound
sealed trait ConnectionClosed extends Event { sealed trait ConnectionClosed extends Event {
def isAborted: Boolean = false def isAborted: Boolean = false
@ -190,34 +193,34 @@ object TcpMessage {
def connect(remoteAddress: InetSocketAddress, def connect(remoteAddress: InetSocketAddress,
localAddress: InetSocketAddress, localAddress: InetSocketAddress,
options: JIterable[SocketOption]) = Connect(remoteAddress, Some(localAddress), options) options: JIterable[SocketOption]): Command = Connect(remoteAddress, Some(localAddress), options)
def connect(remoteAddress: InetSocketAddress, def connect(remoteAddress: InetSocketAddress,
options: JIterable[SocketOption]) = Connect(remoteAddress, None, options) options: JIterable[SocketOption]): Command = Connect(remoteAddress, None, options)
def connect(remoteAddress: InetSocketAddress) = Connect(remoteAddress, None, Nil) def connect(remoteAddress: InetSocketAddress): Command = Connect(remoteAddress, None, Nil)
def bind(handler: ActorRef, def bind(handler: ActorRef,
endpoint: InetSocketAddress, endpoint: InetSocketAddress,
backlog: Int, backlog: Int,
options: JIterable[SocketOption]) = Bind(handler, endpoint, backlog, options) options: JIterable[SocketOption]): Command = Bind(handler, endpoint, backlog, options)
def bind(handler: ActorRef, def bind(handler: ActorRef,
endpoint: InetSocketAddress, endpoint: InetSocketAddress,
backlog: Int) = Bind(handler, endpoint, backlog, Nil) backlog: Int): Command = Bind(handler, endpoint, backlog, Nil)
def register(handler: ActorRef) = Register(handler) def register(handler: ActorRef): Command = Register(handler)
def unbind = Unbind def unbind: Command = Unbind
def close = Close def close: Command = Close
def confirmedClose = ConfirmedClose def confirmedClose: Command = ConfirmedClose
def abort = Abort def abort: Command = Abort
def noAck = NoAck def noAck: NoAck = NoAck
def noAck(token: AnyRef) = NoAck(token) def noAck(token: AnyRef): NoAck = NoAck(token)
def write(data: ByteString) = Write(data) def write(data: ByteString): Command = Write(data)
def write(data: ByteString, ack: AnyRef) = Write(data, ack) def write(data: ByteString, ack: AnyRef): Command = Write(data, ack)
def stopReading = StopReading def stopReading: Command = StopReading
def resumeReading = ResumeReading def resumeReading: Command = ResumeReading
implicit private def fromJava[T](coll: JIterable[T]): immutable.Traversable[T] = { implicit private def fromJava[T](coll: JIterable[T]): immutable.Traversable[T] = {
import scala.collection.JavaConverters._ import scala.collection.JavaConverters._

View file

@ -20,6 +20,8 @@ import akka.io.SelectionHandler._
/** /**
* Base class for TcpIncomingConnection and TcpOutgoingConnection. * Base class for TcpIncomingConnection and TcpOutgoingConnection.
*
* INTERNAL API
*/ */
private[io] abstract class TcpConnection(val channel: SocketChannel, private[io] abstract class TcpConnection(val channel: SocketChannel,
val tcp: TcpExt) extends Actor with ActorLogging { val tcp: TcpExt) extends Actor with ActorLogging {
@ -298,6 +300,9 @@ private[io] abstract class TcpConnection(val channel: SocketChannel,
} }
} }
/**
* INTERNAL API
*/
private[io] object TcpConnection { private[io] object TcpConnection {
sealed trait ReadResult sealed trait ReadResult
object NoData extends ReadResult object NoData extends ReadResult

View file

@ -13,6 +13,8 @@ import akka.io.SelectionHandler.{ ChannelRegistered, RegisterChannel }
/** /**
* An actor handling the connection state machine for an incoming, already connected * An actor handling the connection state machine for an incoming, already connected
* SocketChannel. * SocketChannel.
*
* INTERNAL API
*/ */
private[io] class TcpIncomingConnection(_channel: SocketChannel, private[io] class TcpIncomingConnection(_channel: SocketChannel,
_tcp: TcpExt, _tcp: TcpExt,

View file

@ -15,6 +15,9 @@ import akka.io.Inet.SocketOption
import akka.io.Tcp._ import akka.io.Tcp._
import akka.io.IO.HasFailureMessage import akka.io.IO.HasFailureMessage
/**
* INTERNAL API
*/
private[io] object TcpListener { private[io] object TcpListener {
case class RegisterIncoming(channel: SocketChannel) extends HasFailureMessage { case class RegisterIncoming(channel: SocketChannel) extends HasFailureMessage {
@ -25,6 +28,9 @@ private[io] object TcpListener {
} }
/**
* INTERNAL API
*/
private[io] class TcpListener(val selectorRouter: ActorRef, private[io] class TcpListener(val selectorRouter: ActorRef,
val tcp: TcpExt, val tcp: TcpExt,
val bindCommander: ActorRef, val bindCommander: ActorRef,

View file

@ -9,6 +9,8 @@ import akka.actor.{ ActorLogging, Props }
import akka.io.IO.SelectorBasedManager import akka.io.IO.SelectorBasedManager
/** /**
* INTERNAL API
*
* TcpManager is a facade for accepting commands ([[akka.io.Tcp.Command]]) to open client or server TCP connections. * TcpManager is a facade for accepting commands ([[akka.io.Tcp.Command]]) to open client or server TCP connections.
* *
* TcpManager is obtainable by calling {{{ IO(Tcp) }}} (see [[akka.io.IO]] and [[akka.io.Tcp]]) * TcpManager is obtainable by calling {{{ IO(Tcp) }}} (see [[akka.io.IO]] and [[akka.io.Tcp]])

View file

@ -15,6 +15,8 @@ import scala.collection.immutable
/** /**
* An actor handling the connection state machine for an outgoing connection * An actor handling the connection state machine for an outgoing connection
* to be established. * to be established.
*
* INTERNAL API
*/ */
private[io] class TcpOutgoingConnection(_tcp: TcpExt, private[io] class TcpOutgoingConnection(_tcp: TcpExt,
commander: ActorRef, commander: ActorRef,
@ -53,7 +55,10 @@ private[io] class TcpOutgoingConnection(_tcp: TcpExt,
} }
object TcpOutgoingConnection { /**
* INTERNAL API
*/
private[io] object TcpOutgoingConnection {
private def newSocketChannel() = { private def newSocketChannel() = {
val channel = SocketChannel.open() val channel = SocketChannel.open()
channel.configureBlocking(false) channel.configureBlocking(false)

View file

@ -7,7 +7,10 @@ import akka.actor.Props
import akka.io.IO.SelectorBasedManager import akka.io.IO.SelectorBasedManager
import akka.io.UdpConn.Connect import akka.io.UdpConn.Connect
class UdpConnManager(udpConn: UdpConnExt) extends SelectorBasedManager(udpConn.settings, udpConn.settings.NrOfSelectors) { /**
* INTERNAL API
*/
private[io] class UdpConnManager(udpConn: UdpConnExt) extends SelectorBasedManager(udpConn.settings, udpConn.settings.NrOfSelectors) {
def receive = workerForCommandHandler { def receive = workerForCommandHandler {
case c: Connect case c: Connect

View file

@ -13,6 +13,9 @@ import java.nio.channels.SelectionKey._
import scala.annotation.tailrec import scala.annotation.tailrec
import scala.util.control.NonFatal import scala.util.control.NonFatal
/**
* INTERNAL API
*/
private[io] class UdpConnection(val udpConn: UdpConnExt, private[io] class UdpConnection(val udpConn: UdpConnExt,
val commander: ActorRef, val commander: ActorRef,
val connect: Connect) extends Actor with ActorLogging { val connect: Connect) extends Actor with ActorLogging {

View file

@ -14,6 +14,9 @@ import java.nio.channels.SelectionKey._
import scala.annotation.tailrec import scala.annotation.tailrec
import scala.util.control.NonFatal import scala.util.control.NonFatal
/**
* INTERNAL API
*/
private[io] class UdpFFListener(val udpFF: UdpFFExt, private[io] class UdpFFListener(val udpFF: UdpFFExt,
val bindCommander: ActorRef, val bindCommander: ActorRef,
val bind: Bind) val bind: Bind)

View file

@ -8,6 +8,8 @@ import akka.io.IO.SelectorBasedManager
import akka.io.UdpFF._ import akka.io.UdpFF._
/** /**
* INTERNAL API
*
* UdpFFManager is a facade for simple fire-and-forget style UDP operations * UdpFFManager is a facade for simple fire-and-forget style UDP operations
* *
* UdpFFManager is obtainable by calling {{{ IO(UdpFF) }}} (see [[akka.io.IO]] and [[akka.io.UdpFF]]) * UdpFFManager is obtainable by calling {{{ IO(UdpFF) }}} (see [[akka.io.IO]] and [[akka.io.UdpFF]])

View file

@ -13,6 +13,8 @@ import scala.util.control.NonFatal
/** /**
* Base class for TcpIncomingConnection and TcpOutgoingConnection. * Base class for TcpIncomingConnection and TcpOutgoingConnection.
*
* INTERNAL API
*/ */
private[io] class UdpFFSender(val udpFF: UdpFFExt, options: immutable.Traversable[SocketOption], val commander: ActorRef) private[io] class UdpFFSender(val udpFF: UdpFFExt, options: immutable.Traversable[SocketOption], val commander: ActorRef)
extends Actor with ActorLogging with WithUdpFFSend { extends Actor with ActorLogging with WithUdpFFSend {

View file

@ -8,6 +8,9 @@ import akka.io.UdpFF.{ CommandFailed, Send }
import akka.io.SelectionHandler._ import akka.io.SelectionHandler._
import java.nio.channels.DatagramChannel import java.nio.channels.DatagramChannel
/**
* INTERNAL API
*/
private[io] trait WithUdpFFSend { private[io] trait WithUdpFFSend {
me: Actor with ActorLogging me: Actor with ActorLogging

View file

@ -87,13 +87,5 @@ public class IODocTest {
static ActorSystem system; static ActorSystem system;
@BeforeClass // This is currently only a compilation test, nothing is run
static public void setup() {
system = ActorSystem.create("IODocTest");
}
@Test
public void demonstrateConnect() {
}
} }