yy1717
2024-02-28 27fc91fbe8f88b6885356e68828cfe1ce1db7601
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
}