akka.actor
Class IOManager

java.lang.Object
  extended by akka.actor.IOManager
All Implemented Interfaces:
Extension

public final class IOManager
extends java.lang.Object
implements Extension

IOManager contains a reference to the IOManagerActor for an ActorSystem.

This is the recommended entry point to creating sockets for performing IO.

Use the companion object to retrieve the instance of this class for an ActorSystem.


 val ioManager = IOManager(context.system)
 val socket = ioManager.connect("127.0.0.1")
 

An IOManager does not need to be manually stopped when not in use as it will automatically enter an idle state when it has no channels to manage.


Nested Class Summary
static class IOManager.Settings
           
static class IOManager.Settings$
           
 
Method Summary
 ActorRef actor()
          A reference to the IOManagerActor that performs the actual IO.
 IO.SocketHandle connect(java.net.SocketAddress address, scala.collection.immutable.Seq<IO.SocketOption> options, ActorRef owner)
          Create a SocketChannel connecting to an address.
 IO.SocketHandle connect(java.lang.String host, int port, ActorRef owner)
          Create a SocketChannel connecting to a host and port.
static IOManager createExtension(ExtendedActorSystem system)
           
 IO.ServerHandle listen(java.net.SocketAddress address, ActorRef owner)
          Create a ServerSocketChannel listening on an address.
 IO.ServerHandle listen(java.net.SocketAddress address, scala.collection.immutable.Seq<IO.ServerSocketOption> options, ActorRef owner)
          Create a ServerSocketChannel listening on an address.
 IO.ServerHandle listen(java.lang.String host, int port, scala.collection.immutable.Seq<IO.ServerSocketOption> options, ActorRef owner)
          Create a ServerSocketChannel listening on a host and port.
static IOManager$ lookup()
           
 IOManager.Settings settings()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

lookup

public static IOManager$ lookup()

createExtension

public static IOManager createExtension(ExtendedActorSystem system)

settings

public IOManager.Settings settings()

actor

public ActorRef actor()
A reference to the IOManagerActor that performs the actual IO. It communicates with other actors using subclasses of IO.IOMessage.


listen

public IO.ServerHandle listen(java.net.SocketAddress address,
                              scala.collection.immutable.Seq<IO.ServerSocketOption> options,
                              ActorRef owner)
Create a ServerSocketChannel listening on an address. Messages will be sent from the IOManagerActor to the owner ActorRef.

Parameters:
address - the address to listen on
owner - the ActorRef that will receive messages from the IOManagerActor
option - Seq of akka.actor.IO.ServerSocketOptions to setup on socket
Returns:
a IO.ServerHandle to uniquely identify the created socket

listen

public IO.ServerHandle listen(java.net.SocketAddress address,
                              ActorRef owner)
Create a ServerSocketChannel listening on an address. Messages will be sent from the IOManagerActor to the owner ActorRef.

Parameters:
address - the address to listen on
owner - the ActorRef that will receive messages from the IOManagerActor
Returns:
a IO.ServerHandle to uniquely identify the created socket

listen

public IO.ServerHandle listen(java.lang.String host,
                              int port,
                              scala.collection.immutable.Seq<IO.ServerSocketOption> options,
                              ActorRef owner)
Create a ServerSocketChannel listening on a host and port. Messages will be sent from the IOManagerActor to the owner ActorRef.

Parameters:
host - the hostname or IP to listen on
port - the port to listen on
options - Seq of IO.ServerSocketOption to setup on socket
owner - the ActorRef that will receive messages from the IOManagerActor
Returns:
a IO.ServerHandle to uniquely identify the created socket

connect

public IO.SocketHandle connect(java.net.SocketAddress address,
                               scala.collection.immutable.Seq<IO.SocketOption> options,
                               ActorRef owner)
Create a SocketChannel connecting to an address. Messages will be sent from the IOManagerActor to the owner ActorRef.

Parameters:
address - the address to connect to
options - Seq of IO.SocketOption to setup on established socket
owner - the ActorRef that will receive messages from the IOManagerActor
Returns:
a IO.SocketHandle to uniquely identify the created socket

connect

public IO.SocketHandle connect(java.lang.String host,
                               int port,
                               ActorRef owner)
Create a SocketChannel connecting to a host and port. Messages will be sent from the IOManagerActor to the owner ActorRef.

Parameters:
host - the hostname or IP to connect to
port - the port to connect to
options - Seq of IO.SocketOption to setup on established socket
owner - the ActorRef that will receive messages from the IOManagerActor
Returns:
a IO.SocketHandle to uniquely identify the created socket