/
{
"Type" : "type001,"
"MSG" : {
"Status" : true,
"Location", "Shanghai", "
}
},
{
"Type" : "type001,"
"MSG" : {
"Status" : true,
"Location" : "Beijing", "
}
},
{
"Type" : "type002,"
"MSG" : {
"Status" : false,
"Location" : "through"
}
},
{
"Type" : "type003,"
"MSG" : {
"Status" : true,
"Location" : "Hong Kong", "
}
}
]
Such as an interface that will receive the list data to come over, and then the corresponding processing, want to use multiple threads processing, specific as follows:
The same type of data in a separate thread processing,
Like the first time a type001 and type002 two kinds of data type, then create two threads to separate the two type of data,
Second type001, type002 and type03, then type001, type002 first create the corresponding thread processing, type03 before will also create a thread to handle alone,
Back again as long as the new type can create a new thread to handle this type of data,
Each type, type of data in short has a separate thread processing, each thread only deal with the all the data type, the type has a cap would not have been increased number
This is how to create a thread, or how to design to realize more appropriate, best code
Thank you for your warrior directions
CodePudding user response:
Which master has train of thoughtCodePudding user response:
Create a dictionary, the key is the type, the value is the corresponding data array (can consider to use queue, first in first out),Then different thread to monitor these array processing,
CodePudding user response: