Enhanced the RemoteServer/RemoteClient listener API
This commit is contained in:
parent
70d61b118a
commit
2d20294d0f
5 changed files with 59 additions and 59 deletions
|
|
@ -1,15 +1,15 @@
|
||||||
h1. Akka
|
h1. Akka
|
||||||
|
|
||||||
We believe that writing correct concurrent, fault-tolerant and scalable applications is too hard. Most of the time it's because we are using the wrong tools and the wrong level of abstraction.
|
We believe that writing correct concurrent, fault-tolerant and scalable applications is too hard. Most of the time it's because we are using the wrong tools and the wrong level of abstraction.
|
||||||
|
|
||||||
Akka is here to change that.
|
Akka is here to change that.
|
||||||
|
|
||||||
Using the Actor Model together with Software Transactional Memory we raise the abstraction level and provide a better platform to build correct concurrent and scalable applications.
|
Using the Actor Model together with Software Transactional Memory we raise the abstraction level and provide a better platform to build correct concurrent and scalable applications.
|
||||||
|
|
||||||
For fault-tolerance we adopt the "Let it crash" / "Embrace failure" model which have been used with great success in the telecom industry to build applications that self-heal, systems that never stop.
|
For fault-tolerance we adopt the "Let it crash" / "Embrace failure" model which have been used with great success in the telecom industry to build applications that self-heal, systems that never stop.
|
||||||
|
|
||||||
Actors also provide the abstraction for transparent distribution and the basis for truly scalable and fault-tolerant applications.
|
Actors also provide the abstraction for transparent distribution and the basis for truly scalable and fault-tolerant applications.
|
||||||
|
|
||||||
Akka is Open Source and available under the Apache 2 License.
|
Akka is Open Source and available under the Apache 2 License.
|
||||||
|
|
||||||
Learn more at "http://akkasource.org":http://akkasource.org
|
Learn more at "http://akkasource.org":http://akkasource.org.
|
||||||
|
|
@ -52,7 +52,9 @@ case class RemoteClientDisconnected(
|
||||||
@BeanProperty val client: RemoteClient) extends RemoteClientLifeCycleEvent
|
@BeanProperty val client: RemoteClient) extends RemoteClientLifeCycleEvent
|
||||||
case class RemoteClientConnected(
|
case class RemoteClientConnected(
|
||||||
@BeanProperty val client: RemoteClient) extends RemoteClientLifeCycleEvent
|
@BeanProperty val client: RemoteClient) extends RemoteClientLifeCycleEvent
|
||||||
case class RemoteClientStopped(
|
case class RemoteClientStarted(
|
||||||
|
@BeanProperty val client: RemoteClient) extends RemoteClientLifeCycleEvent
|
||||||
|
case class RemoteClientShutdown(
|
||||||
@BeanProperty val client: RemoteClient) extends RemoteClientLifeCycleEvent
|
@BeanProperty val client: RemoteClient) extends RemoteClientLifeCycleEvent
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -213,6 +215,7 @@ class RemoteClient private[akka] (val hostname: String, val port: Int, val loade
|
||||||
foreachListener(l => l ! RemoteClientError(connection.getCause, this))
|
foreachListener(l => l ! RemoteClientError(connection.getCause, this))
|
||||||
log.error(connection.getCause, "Remote client connection to [%s:%s] has failed", hostname, port)
|
log.error(connection.getCause, "Remote client connection to [%s:%s] has failed", hostname, port)
|
||||||
}
|
}
|
||||||
|
foreachListener(l => l ! RemoteClientStarted(this))
|
||||||
isRunning = true
|
isRunning = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -221,11 +224,11 @@ class RemoteClient private[akka] (val hostname: String, val port: Int, val loade
|
||||||
log.info("Shutting down %s", name)
|
log.info("Shutting down %s", name)
|
||||||
if (isRunning) {
|
if (isRunning) {
|
||||||
isRunning = false
|
isRunning = false
|
||||||
|
foreachListener(l => l ! RemoteClientShutdown(this))
|
||||||
timer.stop
|
timer.stop
|
||||||
openChannels.close.awaitUninterruptibly
|
openChannels.close.awaitUninterruptibly
|
||||||
bootstrap.releaseExternalResources
|
bootstrap.releaseExternalResources
|
||||||
log.info("%s has been shut down", name)
|
log.info("%s has been shut down", name)
|
||||||
foreachListener(l => l ! RemoteClientStopped(this))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -406,7 +406,7 @@ class RemoteServerHandler(
|
||||||
def operationComplete(future: ChannelFuture): Unit = {
|
def operationComplete(future: ChannelFuture): Unit = {
|
||||||
if (future.isSuccess) {
|
if (future.isSuccess) {
|
||||||
openChannels.add(future.getChannel)
|
openChannels.add(future.getChannel)
|
||||||
server.foreachListener(_ ! RemoteServerClientConnected(server))
|
server.foreachListener(_ ! RemoteServerClientConnected(server))
|
||||||
} else future.getChannel.close
|
} else future.getChannel.close
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
@ -415,7 +415,7 @@ class RemoteServerHandler(
|
||||||
|
|
||||||
override def channelClosed(ctx: ChannelHandlerContext, event: ChannelStateEvent) = {
|
override def channelClosed(ctx: ChannelHandlerContext, event: ChannelStateEvent) = {
|
||||||
log.debug("Remote client disconnected from [%s]", server.name)
|
log.debug("Remote client disconnected from [%s]", server.name)
|
||||||
server.foreachListener(_ ! RemoteServerClientDisconnected(server))
|
server.foreachListener(_ ! RemoteServerClientDisconnected(server))
|
||||||
}
|
}
|
||||||
|
|
||||||
override def handleUpstream(ctx: ChannelHandlerContext, event: ChannelEvent) = {
|
override def handleUpstream(ctx: ChannelHandlerContext, event: ChannelEvent) = {
|
||||||
|
|
|
||||||
|
|
@ -45,33 +45,30 @@ class AkkaLoader extends Logging {
|
||||||
}
|
}
|
||||||
|
|
||||||
private def printBanner = {
|
private def printBanner = {
|
||||||
log.info(
|
log.info("==================================================")
|
||||||
"""
|
log.info(" t")
|
||||||
t
|
log.info(" t t t")
|
||||||
t t t
|
log.info(" t t tt t")
|
||||||
t t tt t
|
log.info(" tt t t tt t")
|
||||||
tt t t tt t
|
log.info(" t ttttttt t ttt t")
|
||||||
t ttttttt t ttt t
|
log.info(" t tt ttt t ttt t")
|
||||||
t tt ttt t ttt t
|
log.info(" t t ttt t ttt t t")
|
||||||
t t ttt t ttt t t
|
log.info(" tt t ttt ttt ttt t")
|
||||||
tt t ttt ttt ttt t
|
log.info(" t t ttt ttt t tt t")
|
||||||
t t ttt ttt t tt t
|
log.info(" t ttt ttt t t")
|
||||||
t ttt ttt t t
|
log.info(" tt ttt ttt t")
|
||||||
tt ttt ttt t
|
log.info(" ttt ttt")
|
||||||
ttt ttt
|
log.info(" tttttttt ttt ttt ttt ttt tttttttt")
|
||||||
tttttttt ttt ttt ttt ttt tttttttt
|
log.info(" ttt tt ttt ttt ttt ttt ttt ttt")
|
||||||
ttt tt ttt ttt ttt ttt ttt ttt
|
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
|
||||||
ttt ttt ttt ttt ttt ttt ttt ttt
|
log.info(" ttt ttt ttt ttt ttt tt ttt ttt")
|
||||||
ttt ttt ttt ttt ttt tt ttt ttt
|
log.info(" tttt ttttttttt tttttttt tttt")
|
||||||
tttt ttttttttt tttttttt tttt
|
log.info(" ttttttttt ttt ttt ttt ttt ttttttttt")
|
||||||
ttttttttt ttt ttt ttt ttt ttttttttt
|
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
|
||||||
ttt ttt ttt ttt ttt ttt ttt ttt
|
log.info(" ttt ttt ttt ttt ttt ttt ttt ttt")
|
||||||
ttt ttt ttt ttt ttt ttt ttt ttt
|
log.info(" ttt tt ttt ttt ttt ttt ttt ttt")
|
||||||
ttt tt ttt ttt ttt ttt ttt ttt
|
log.info(" tttttttt ttt ttt ttt ttt tttttttt")
|
||||||
tttttttt ttt ttt ttt ttt tttttttt
|
log.info("==================================================")
|
||||||
|
|
||||||
==================================================
|
|
||||||
""")
|
|
||||||
log.info(" Running version %s", Config.VERSION)
|
log.info(" Running version %s", Config.VERSION)
|
||||||
log.info("==================================================")
|
log.info("==================================================")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,20 +81,20 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
|
||||||
// Versions
|
// Versions
|
||||||
// -------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
lazy val ATMO_VERSION = "0.6.1"
|
lazy val ATMO_VERSION = "0.6.1"
|
||||||
lazy val CAMEL_VERSION = "2.4.0"
|
lazy val CAMEL_VERSION = "2.4.0"
|
||||||
lazy val CASSANDRA_VERSION = "0.6.1"
|
lazy val CASSANDRA_VERSION = "0.6.1"
|
||||||
lazy val DispatchVersion = "0.7.4"
|
lazy val DISPATCH_VERSION = "0.7.4"
|
||||||
lazy val HAWTDISPATCH_VERSION = "1.0"
|
lazy val HAWT_DISPATCH_VERSION = "1.0"
|
||||||
lazy val JacksonVersion = "1.2.1"
|
lazy val JACKSON_VERSION = "1.2.1"
|
||||||
lazy val JERSEY_VERSION = "1.2"
|
lazy val JERSEY_VERSION = "1.2"
|
||||||
lazy val LIFT_VERSION = "2.1-M1"
|
lazy val LIFT_VERSION = "2.1-M1"
|
||||||
lazy val MULTIVERSE_VERSION = "0.6"
|
lazy val MULTIVERSE_VERSION = "0.6"
|
||||||
lazy val SCALATEST_VERSION = "1.2-for-scala-2.8.0.final-SNAPSHOT"
|
lazy val SCALATEST_VERSION = "1.2-for-scala-2.8.0.final-SNAPSHOT"
|
||||||
lazy val LOGBACK_VERSION = "0.9.24"
|
lazy val LOGBACK_VERSION = "0.9.24"
|
||||||
lazy val SLF4J_VERSION = "1.6.0"
|
lazy val SLF4J_VERSION = "1.6.0"
|
||||||
lazy val SPRING_VERSION = "3.0.3.RELEASE"
|
lazy val SPRING_VERSION = "3.0.3.RELEASE"
|
||||||
lazy val WerkzVersion = "2.2.1"
|
lazy val ASPECTWERKZ_VERSION = "2.2.1"
|
||||||
|
|
||||||
// -------------------------------------------------------------------------------------------------------------------
|
// -------------------------------------------------------------------------------------------------------------------
|
||||||
// Dependencies
|
// Dependencies
|
||||||
|
|
@ -131,8 +131,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
|
||||||
|
|
||||||
lazy val configgy = "net.lag" % "configgy" % "2.8.0-1.5.5" % "compile"
|
lazy val configgy = "net.lag" % "configgy" % "2.8.0-1.5.5" % "compile"
|
||||||
|
|
||||||
lazy val dispatch_http = "net.databinder" % "dispatch-http_2.8.0" % DispatchVersion % "compile"
|
lazy val dispatch_http = "net.databinder" % "dispatch-http_2.8.0" % DISPATCH_VERSION % "compile"
|
||||||
lazy val dispatch_json = "net.databinder" % "dispatch-json_2.8.0" % DispatchVersion % "compile"
|
lazy val dispatch_json = "net.databinder" % "dispatch-json_2.8.0" % DISPATCH_VERSION % "compile"
|
||||||
|
|
||||||
lazy val grizzly = "com.sun.grizzly" % "grizzly-comet-webserver" % "1.9.18-i" % "compile"
|
lazy val grizzly = "com.sun.grizzly" % "grizzly-comet-webserver" % "1.9.18-i" % "compile"
|
||||||
|
|
||||||
|
|
@ -140,11 +140,11 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
|
||||||
|
|
||||||
lazy val h2_lzf = "voldemort.store.compress" % "h2-lzf" % "1.0" % "compile"
|
lazy val h2_lzf = "voldemort.store.compress" % "h2-lzf" % "1.0" % "compile"
|
||||||
|
|
||||||
lazy val hawtdispatch = "org.fusesource.hawtdispatch" % "hawtdispatch-scala" % HAWTDISPATCH_VERSION % "compile"
|
lazy val hawtdispatch = "org.fusesource.hawtdispatch" % "hawtdispatch-scala" % HAWT_DISPATCH_VERSION % "compile"
|
||||||
|
|
||||||
lazy val jackson = "org.codehaus.jackson" % "jackson-mapper-asl" % JacksonVersion % "compile"
|
lazy val jackson = "org.codehaus.jackson" % "jackson-mapper-asl" % JACKSON_VERSION % "compile"
|
||||||
lazy val jackson_core = "org.codehaus.jackson" % "jackson-core-asl" % JacksonVersion % "compile"
|
lazy val jackson_core = "org.codehaus.jackson" % "jackson-core-asl" % JACKSON_VERSION % "compile"
|
||||||
lazy val jackson_core_asl = "org.codehaus.jackson" % "jackson-core-asl" % JacksonVersion % "compile"
|
lazy val jackson_core_asl = "org.codehaus.jackson" % "jackson-core-asl" % JACKSON_VERSION % "compile"
|
||||||
|
|
||||||
lazy val jersey = "com.sun.jersey" % "jersey-core" % JERSEY_VERSION % "compile"
|
lazy val jersey = "com.sun.jersey" % "jersey-core" % JERSEY_VERSION % "compile"
|
||||||
lazy val jersey_json = "com.sun.jersey" % "jersey-json" % JERSEY_VERSION % "compile"
|
lazy val jersey_json = "com.sun.jersey" % "jersey-json" % JERSEY_VERSION % "compile"
|
||||||
|
|
@ -196,8 +196,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) {
|
||||||
|
|
||||||
lazy val thrift = "com.facebook" % "thrift" % "r917130" % "compile"
|
lazy val thrift = "com.facebook" % "thrift" % "r917130" % "compile"
|
||||||
|
|
||||||
lazy val werkz = "org.codehaus.aspectwerkz" % "aspectwerkz-nodeps-jdk5" % WerkzVersion % "compile"
|
lazy val werkz = "org.codehaus.aspectwerkz" % "aspectwerkz-nodeps-jdk5" % ASPECTWERKZ_VERSION % "compile"
|
||||||
lazy val werkz_core = "org.codehaus.aspectwerkz" % "aspectwerkz-jdk5" % WerkzVersion % "compile"
|
lazy val werkz_core = "org.codehaus.aspectwerkz" % "aspectwerkz-jdk5" % ASPECTWERKZ_VERSION % "compile"
|
||||||
|
|
||||||
// Test
|
// Test
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue