package com.anyun.exam.lib
|
|
import android.content.Context
|
import com.anyun.exam.lib.net.NtripTcpClient
|
import java.lang.Exception
|
import java.util.concurrent.Executors
|
|
class ActionManager {
|
val actionList = mutableListOf<BaseAction>()
|
var executor = Executors.newFixedThreadPool(10)
|
|
init {
|
actionList.add(ActionRtcm())
|
}
|
|
fun execute(args: ActionArgs)
|
{
|
//使用线程池处理
|
executor.submit{
|
actionList.forEach {
|
try {
|
it.execute(args)
|
}
|
catch (ex: Exception)
|
{
|
|
}
|
}
|
}
|
|
}
|
}
|
|
class ActionArgs
|
{
|
lateinit var message:ByteArray
|
lateinit var context: Context
|
lateinit var tcpClient: NtripTcpClient
|
}
|