Added exception handlers to deskshare actors and refactored the akka ones

This commit is contained in:
Pedro Beschorner Marin 2016-02-03 18:41:49 +00:00
parent d74c571958
commit e9cc024e5e
11 changed files with 55 additions and 16 deletions

View File

@ -38,10 +38,10 @@ class BigBlueButtonActor(val system: ActorSystem, recorderApp: RecorderApplicati
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
case e: Exception => {
log.warning("An exception has been thrown on BigBlueButtonActor, exception message [" + e.getMessage() + "] (full stacktrace below)")
val sw: StringWriter = new StringWriter()
sw.write("An exception has been thrown on BigBlueButtonActor, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.warning(sw.toString())
log.error(sw.toString())
Resume
}
}

View File

@ -40,10 +40,10 @@ class MeetingActor(val mProps: MeetingProperties, val outGW: OutMessageGateway)
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
case e: Exception => {
log.warning("An exception has been thrown on MeetingActor, exception message [" + e.getMessage() + "] (full stacktrace below)")
val sw: StringWriter = new StringWriter()
sw.write("An exception has been thrown on MeetingActor, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.warning(sw.toString())
log.error(sw.toString())
Resume
}
}

View File

@ -43,10 +43,10 @@ class MessageSenderActor(val meetingId: String, val service: MessageSender)
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
case e: Exception => {
log.warning("An exception has been thrown on MessageSenderActor, exception message [" + e.getMessage() + "] (full stacktrace below)")
val sw: StringWriter = new StringWriter()
sw.write("An exception has been thrown on MessageSenderActor, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.warning(sw.toString())
log.error(sw.toString())
Resume
}
}

View File

@ -29,10 +29,10 @@ class OutMessageGatewayActor(val meetingId: String, val recorder: RecorderApplic
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
case e: Exception => {
log.warning("An exception has been thrown on OutMessageGatewayActor, exception message [" + e.getMessage() + "] (full stacktrace below)")
val sw: StringWriter = new StringWriter()
sw.write("An exception has been thrown on OutMessageGatewayActor, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.warning(sw.toString())
log.error(sw.toString())
Resume
}
}

View File

@ -47,10 +47,10 @@ class RecorderActor(val meetingId: String, val recorder: RecorderApplication)
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
case e: Exception => {
log.warning("An exception has been thrown on RecorderActor, exception message [" + e.getMessage() + "] (full stacktrace below)")
val sw: StringWriter = new StringWriter()
sw.write("An exception has been thrown on RecorderActor, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.warning(sw.toString())
log.error(sw.toString())
Resume
}
}

View File

@ -34,10 +34,10 @@ class AppsRedisSubscriberActor(msgReceiver: RedisMessageReceiver, redisHost: Str
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
case e: Exception => {
log.warning("An exception has been thrown on AppsRedisSubscriberActor, exception message [" + e.getMessage() + "] (full stacktrace below)")
val sw: StringWriter = new StringWriter()
sw.write("An exception has been thrown on AppsRedisSubscriberActor, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.warning(sw.toString())
log.error(sw.toString())
Resume
}
}

View File

@ -37,10 +37,10 @@ class AppsRedisSubscriberActor(val system: ActorSystem, msgReceiver: RedisMessag
override val supervisorStrategy = OneForOneStrategy(maxNrOfRetries = 10, withinTimeRange = 1 minute) {
case e: Exception => {
log.warning("An exception has been thrown on AppsRedisSubscriberActor, exception message [" + e.getMessage() + "] (full stacktrace below)")
val sw: StringWriter = new StringWriter()
sw.write("An exception has been thrown on AppsRedisSubscriberActor, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.warning(sw.toString())
log.error(sw.toString())
Resume
}
}

View File

@ -25,6 +25,7 @@ import scala.collection.mutable.HashMap
import org.bigbluebutton.deskshare.server.svc1.Dimension
import org.bigbluebutton.deskshare.server.stream.StreamManager
import java.awt.Point
import java.io.{PrintWriter, StringWriter}
case class CreateSession(room: String, screenDim: Dimension, blockDim: Dimension, seqNum: Int, useSVC2: Boolean)
case class RemoveSession(room: String)
@ -40,7 +41,16 @@ class SessionManagerSVC(streamManager: StreamManager, keyFrameInterval: Int, int
private val sessions = new HashMap[String, SessionSVC]
private val stoppedSessions = new HashMap[String, String]
override def exceptionHandler() = {
case e: Exception => {
val sw:StringWriter = new StringWriter()
sw.write("An exception has been thrown on SessionManagerSVC, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.error(sw.toString())
}
}
def act() = {
loop {
react {

View File

@ -26,6 +26,7 @@ import scala.actors.Actor
import scala.actors.Actor._
import net.lag.logging.Logger
import java.awt.Point
import java.io.{PrintWriter, StringWriter}
case object StartSession
case class UpdateSessionBlock(position: Int, blockData: Array[Byte], keyframe: Boolean, seqNum: Int)
@ -50,6 +51,15 @@ class SessionSVC(sessionManager:SessionManagerSVC, room: String, screenDim: Dime
private var streamStartedOn = 0L
private var streamStarted = false
override def exceptionHandler() = {
case e: Exception => {
val sw:StringWriter = new StringWriter()
sw.write("An exception has been thrown on SessionSVC, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.error(sw.toString())
}
}
/*
* Schedule to generate a key frame after 30seconds of a request.
* This prevents us from generating unnecessary key frames when

View File

@ -29,6 +29,7 @@ import org.red5.server.net.rtmp.event.VideoData;
import org.red5.server.stream.IProviderService
import org.red5.server.net.rtmp.message.Constants;
import org.apache.mina.core.buffer.IoBuffer
import java.io.{PrintWriter, StringWriter}
import java.util.ArrayList
import scala.actors.Actor
import scala.actors.Actor._
@ -41,6 +42,15 @@ class DeskshareStream(app: DeskshareApplication, name: String, val width: Int, v
private var dsClient:RtmpClientAdapter = null
var startTimestamp: Long = System.currentTimeMillis()
override def exceptionHandler() = {
case e: Exception => {
val sw:StringWriter = new StringWriter()
sw.write("An exception has been thrown on DeskshareStream, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.error(sw.toString())
}
}
def act() = {
loop {

View File

@ -22,6 +22,7 @@ import org.bigbluebutton.deskshare.server.red5.DeskshareApplication
import org.red5.server.api.scope.IScope
import org.red5.server.api.so.ISharedObject
import java.io.{PrintWriter, StringWriter}
import java.util.ArrayList
import scala.actors.Actor
@ -47,7 +48,15 @@ class StreamManager(record:Boolean, recordingService:RecordingService) extends A
private case class RemoveStream(room: String)
private val streams = new HashMap[String, DeskshareStream]
override def exceptionHandler() = {
case e: Exception => {
val sw:StringWriter = new StringWriter()
sw.write("An exception has been thrown on StreamManager, exception message [" + e.getMessage() + "] (full stacktrace below)\n")
e.printStackTrace(new PrintWriter(sw))
log.error(sw.toString())
}
}
def act() = {
loop {