CN101882089B - Method for processing business conversational application with multi-thread and device thereof - Google Patents

Method for processing business conversational application with multi-thread and device thereof Download PDF

Info

Publication number
CN101882089B
CN101882089B CN 200910138374 CN200910138374A CN101882089B CN 101882089 B CN101882089 B CN 101882089B CN 200910138374 CN200910138374 CN 200910138374 CN 200910138374 A CN200910138374 A CN 200910138374A CN 101882089 B CN101882089 B CN 101882089B
Authority
CN
China
Prior art keywords
message
service conversation
data
thread
node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN 200910138374
Other languages
Chinese (zh)
Other versions
CN101882089A (en
Inventor
田贞朗
钱建阳
吴豫宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by ZTE Corp filed Critical ZTE Corp
Priority to CN 200910138374 priority Critical patent/CN101882089B/en
Publication of CN101882089A publication Critical patent/CN101882089A/en
Application granted granted Critical
Publication of CN101882089B publication Critical patent/CN101882089B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Multi Processors (AREA)

Abstract

The invention discloses a method for processing business conversational application with a multi-thread and a device thereof. The method comprises that a business conversational application program creates and activates a message delivery thread and a plurality of data processing threads in advance, and allocates a data area only associated with each data processing thread for each data processing thread; when receiving message from an external message entity, the message delivery thread only associates the business conversation of the message with one data processing thread, and deliveries the message to the data processing thread; when receiving the message delivered by the message delivery thread, the data processing thread performs the corresponding process to the corresponding data area according to the status of the message, and feeds back the processed result to the external message entity. The invention avoids the defects of synchronization and mutual exclusion mechanism, and greatly reduces the complexity of the system process while ensuring the safe and effective operation of the system.

Description

A kind of method and device that adopts multithreading to process the business conversation applications
Technical field
The present invention relates to adopt multithreading to process the technology of application process in the engineering application, relate in particular to the method and apparatus that adopts multithreading to process service conversation (Session) application.
Background technology
Multithreading is the mechanism of a kind of permission a plurality of instruction streams of concurrent execution in program, and wherein each instruction stream is called a thread, and is independent mutually to each other.Thread is called again Lightweight Process, and its has the same with process is independently carried out control, is responsible for scheduling by operating system.
In engineering was used, multithreading often was applied to improve the operational efficiency of software systems.Along with the configuration of hardware device more and more trends towards high-endization, namely adopt many CPU (central processing unit), large internal memory etc., therefore how to utilize fully system resource also to become a problem thereupon.Reasonably the utilization of multithreading, can utilize system resource fully, and the different threads instruction stream can be distributed in the upper operation of different CPU, realizes the parallel work-flow of multitask, greatly improves thus the operational efficiency of system.
Certainly, adopt multithreading must consider the synchronous and mutual exclusion of each thread, to guarantee thread-safe.Usually system can adopt following several mode to realize multithreading synchronously and the mechanism of mutual exclusion:
(1) critical section: visit public resource or one section code by the serialization to multithreading, its speed is fast, is fit to control data access
Namely only allow at any time a thread that sharing data resources is conducted interviews.If there are a plurality of threads to attempt to access simultaneously the critical section, so after having a thread to enter, other all attempt to access this critical section thread will be suspended, and be continued until that the thread that enters the critical section leaves.Only after the critical section was released, other thread just can continue to seize, and reaches the purpose of multithreading shared resource with this.
(2) mutex: design for coordinating common independent access to a shared resource
Mutex is very similar to the critical section, and the thread that only has Mutex object just has the authority of access resources, because Mutex object only has one, has just determined that therefore under any circumstance this shared resource can not accessed by a plurality of thread simultaneously.The current thread that occupies resource should be surrendered the Mutex object authority that has after task is handled, so that other thread is able to access resources after acquisition.
Mutex is more complicated than the critical section.Because use mutual exclusion not only can realize in the same application different threads that the safety of resource is shared, and can realize the safety of resource is shared between the thread of different application.
(3) semaphore: have the limited quantity user resources and design for controlling
Different from the front several method, this method allows a plurality of threads in the same resource of synchronization access, but need to be limited in the thread maximum number that synchronization is accessed this resource by semaphore.
(4) event: be used for notifying thread to have some events to occur, thereby start the beginning of subsequent tasks
Event object also can keep by the mode that notice operates the synchronous of thread, and can realize the thread synchronization operation in different processes.
Utilize above these several modes to realize the synchronous and mutual exclusion of thread, can guarantee the safety of thread, but the complicacy that the system that also increases simultaneously processes, and to a certain extent can reduction the efficient of system's operation.
Summary of the invention
Technical matters to be solved by this invention is to provide a kind of method and device that adopts multithreading to process the business conversation applications, can be when guaranteeing security of system, efficient operation, and the complicacy that the reduction system processes.
For solving the problems of the technologies described above, the invention provides a kind of method that adopts multithreading to process the business conversation applications, comprising:
The service conversation application program is pre-created and activates message distribution thread and a plurality of data processing threads, and is that each data processing threads distributes a data field of unique association with it;
When the message distribution thread receives message from the external message entity, the service conversation in this message is unique related with a data processing threads, and this message distribution is arrived this data processing threads;
When the data processing threads receives the message of message distribution thread distribution, process accordingly according to the state of this message in corresponding data field, and result is fed back to the external message entity.
Further,
A data field of unique association refers to the service conversation application program for each data processing threads distributes with it: this service conversation application program identifies each data processing threads by the thread sequence number, and by the thread sequence number, that the data processing threads is unique related with the data field of distribution;
The data processing threads regularly scans corresponding data field, moves to database with the in time cleaning of data with the node of the service conversation of overtime store data.
Further, the message distribution thread is with the service conversation in message and unique related referring to of data processing threads: this message distribution thread is resolved the feature field in message content, this feature field is used for the unique identification service conversation, this feature field is carried out calculation process obtain unique thread sequence number, by this thread sequence number, that service conversation is unique related with the data processing threads.
Further, feature field being carried out calculation process obtains unique thread sequence number and refer to: this feature field comprises system time at least, and this system time is carried out modulo operation with the number of data processing threads, and the result of computing is the thread sequence number.
Further, when the data processing threads receives the message of message distribution thread distribution, process accordingly according to the state of this message in corresponding data field, and result is fed back to the external message entity, that is:
The data processing threads carries out verification, parsing to the message that receives, and obtains operational code and the feature field of service conversation, determines the processing operation of the node of described service conversation as the status indicator of message according to this operational code:
When this operational code is designated the new business session, create the node of this service conversation in corresponding data field formation, take feature field as this node unique identification, the information of preserving simultaneously service conversation, and successful information is returned to the external message entity;
Perhaps, when operational code is designated the inquiry business session, search the node of service conversation according to this feature field in corresponding data field formation, and obtain the information of this service conversation from the data field, information and the successful information with this service conversation returns to the external message entity simultaneously;
Perhaps, when operational code is designated the renewal service conversation, search the node of service conversation according to this feature field in corresponding data field formation, and upgrade the information of this service conversation in the data field, simultaneously successful information is returned to the external message entity;
Perhaps, when operational code is designated the deletion service conversation, searches the node of service conversation according to this feature field in corresponding data field formation, and delete this node, simultaneously successful information is returned to the external message entity, the sign service conversation finishes.
For solving the problems of the technologies described above, the invention provides a kind of device that adopts multithreading to process the business conversation applications, comprise the thread creation module, message distribution module, the message processing module that connect successively, also comprise the data communication module that is connected with described message distribution module; Wherein:
The thread creation module is used for application and is pre-created message distribution thread and a plurality of data processing threads, and is that each data processing threads distributes a data field of unique association with it; And the message distribution thread that will create, activate exports to the message distribution module, and message processing module is exported in a plurality of data processing threads and the data field thereof that create, activate;
The data communication module is used for the communication connection between described device and external message entity;
The message distribution module is used for receiving by the data communication module message that the external message entity sends, and the service conversation in this message is unique related with a data processing threads, and this message distribution is arrived this data processing threads;
Message processing module is used for the message of input being processed accordingly according to its state in corresponding data field by each data processing threads, and result is fed back to the external message entity by the data communication module.
Further, the message distribution module comprises message adapter, session-thread relating module and the message groups bag module that connects successively, wherein:
Message adapter is used for the message that receives is identified, after verification, exported to session-thread relating module;
Session-thread relating module, after being used for the message of input is resolved, feature field with unique identification service conversation in the message of resolving, number to the data processing threads known by message processing module is carried out modulo operation, obtain unique thread sequence number according to the result of computing, with this thread sequence number and described message with together with export to message groups bag module;
Message groups bag module is connected with described message processing module, is used for according to the thread sequence number of input, described message being packaged into the message groups bag, and this thread sequence number and this message groups bag are distributed to message processing module.
Further, message processing module comprises message adapter, data processor and the message groups bag module that connects successively; Wherein:
Message adapter, be used for the number announcement session of data processing threads-thread relating module, to carry out verification from the message groups bag of message groups bag module distribution, after parsing, according to the thread sequence number, feature field and the opcode field of service conversation are exported to corresponding data processing threads in data processor;
Data processor, be used for determining as the status indicator of service conversation according to the opcode field of input by corresponding data processing threads that the processing of the node of service conversation operates, and after carrying out corresponding processing end, corresponding result is exported to message groups bag module;
Message groups bag module is used for the result encapsulation of input is wrapped in groups, sends to the external message entity by the data communication module.
Further, corresponding data processing threads is determined the processing operation of the node of service conversation according to opcode field, and is carrying out after corresponding processing finishes, corresponding result being exported to message groups bag module, that is:
When operational code is designated the new business session, create the node of this service conversation in corresponding data field formation, take feature field as this node unique identification, the information of preserving simultaneously this service conversation, and successful information is exported to message groups bag module;
Perhaps, when operational code is designated the inquiry business session, search the node of this service conversation according to this feature field in corresponding data field formation, and obtain the information of this service conversation from the data field, simultaneously information and the successful information of this service conversation are exported to message groups bag module;
Perhaps, when operational code is designated the renewal service conversation, search the node of this service conversation according to this feature field in corresponding data field formation, and upgrade the information of this service conversation in the data field, simultaneously successful information is exported to message groups bag module;
Perhaps, when operational code is designated the deletion service conversation, searches the node of this service conversation according to this feature field in corresponding data field formation, and delete this node, simultaneously successful information is exported to message groups bag module, the sign service conversation finishes.
Further, described device also comprises database, and message processing module comprises the data mover that is connected with data processor, wherein:
Data processor also is used for regularly corresponding data field being scanned, and so that the data of the node of the service conversation of overtime store data are exported to data mover with feature field, and empties the data field of this node;
Data mover is used for take feature field as index, the conversation message Data Migration of input being preserved to database.
Compared with prior art, the present invention needn't adopt complicated multithreading synchronization and mutex technology, but independently process service conversation in the data field by each thread, realize independent operating between thread and the consistance of service conversation, avoided the drawback of synchronous and mutual exclusion mechanism, when guaranteeing security of system, efficient operation, greatly reduce the complicacy that system processes.
Description of drawings
Fig. 1 is the method application model schematic diagram that employing multithreading of the present invention is processed service conversation;
Fig. 2 be the present invention adopt multithreading process service conversation the structured flowchart of device embodiment;
Fig. 3 is that the present invention adopts multithreading to process the method flow diagram of service conversation;
Fig. 4 is the concrete steps process flow diagram of step 300 in method shown in Figure 3;
Fig. 5 is the concrete steps process flow diagram of step 400 in method shown in Figure 3;
Fig. 6 is the concrete steps process flow diagram of step 500 in method shown in Figure 3;
Fig. 7 is the process flow diagram of each data field of data processing threads periodic cleaning.
Embodiment
A kind of method and device that adopts multithreading to process the business conversation applications provided by the invention, its inventive concept is, the service conversation application program creates message distribution thread and a plurality of data processing threads in advance in thread pool, and is that each data processing threads distributes a data field of unique association with it; When the message distribution thread receives message from the external message entity, the service conversation in message is unique related with a data processing threads, and this message distribution is arrived this data processing threads; The data processing threads is processed according to the state of receipt message accordingly in corresponding data field, and result is fed back to the external message entity; Simultaneously, each data processing threads regularly scans corresponding data field, moves to database with the in time cleaning of data with the node of the service conversation of overtime store data.
Below in conjunction with accompanying drawing and preferred embodiment, design launches narration to foregoing invention of the present invention, with in detail, clearly reveal out technical scheme of the present invention.
By Fig. 1, can recognize application model of the present invention.At first the present invention creates thread in thread pool, wherein comprise at least a message distribution thread and a plurality of data processing threads (1~n); Connected the message that receives each service conversation from the external message entity by TCP by the message distribution thread, and with each message distribution to the unique related data processing threads of service conversation in; (in 1~n), message is carried out all kinds of processing, and result is fed back to the external message entity in corresponding data field by corresponding data processing threads.
As shown in Figure 2, process device one embodiment of business conversation applications for employing multithreading provided by the invention, this device 20 comprises thread creation module 21, message distribution module 23, message processing module 24, database (DB) 25 successively, also comprises the data communication module 22 that is connected with the message distribution module; Wherein:
Thread creation module 21 is used for creating at least one message distribution thread and a plurality of data processing threads, and is the data field that each data processing threads distributes associated; The number of the data processing threads of the message distribution thread that activates and activation is exported to message distribution module 23, message processing module 24 is exported in a plurality of data processing threads and the data field thereof activated;
At this, the number that creates the data processing threads determines according to the performance index of engineering application demand and system equipment, namely take maximum practical requirement with fully, rationally utilize system resource to be limit.
Data field for each data processing threads distribution, by the thread sequence number (such as 1,2 etc.), identify each data processing threads (such as data processing threads 1, data processing threads 2 etc.), and by this thread sequence number, with each data processing threads and corresponding data field (such as data field 1, data field 2 etc.) carry out association, form relation one to one.
Data communication module 22 is used for the communication connection between this device and described external message entity;
Message distribution module 23, be used for receiving by data communication module 22 message that the external message entity sends over each service conversation, and with each message identify, verification and resolve after, be distributed in message processing module 24 with message in the unique related data processing threads of service conversation in;
Feature field in message content is carried out dissection process, and this feature field is used for the service conversation of unique identification message, and namely the feature field in same Dialog processing process remains unchanged.
According to this feature field is carried out computing, make all conversation messages be uniformly distributed in each data processing threads, to take full advantage of multithreading, improve running efficiency of system.Certainly, as long as make all conversation messages be distributed in different data processing threads, also can usually play the effect that utilizes multithreading to improve running efficiency of system, just not as equally distributed better effects if.
Message processing module 24 after being used for by each data processing threads, the message of input being carried out verification, resolving, carrying out data manipulation according to the state of message to corresponding data field, and result is fed back to the external message entity by data communication module 22; Simultaneously, by each data processing threads periodic scanning data field separately, the data of the node of the service conversation of overtime store data are in time moved in database D B, and empty the data field of this node;
Database 25 is as physical database, for the data of the overtime data field of depositing message processing module 24 data processing threads.
In a single day external entity is searched less than session information in the data field of internal memory, can arrive in database 25 and inquire about and operate.
Message distribution module 23 in Fig. 2 further comprises the message adapter 231, session-thread relating module 232 and the message groups bag module 233 that connect successively, wherein:
Message adapter 231 is used for the conversation message that receives is identified, after verification, exported to session-thread relating module 232;
Such as, in a piece of news, the feature field of sign service conversation is MsgID, its formation is: and type of service+...+system time (relative time is take millisecond as unit count).
Session-thread relating module 232, after being used for the conversation message of input is resolved, feature field to message acceptance of the bid knowledge service conversation is carried out computing, thread sequence number according to the definite data processing threads that will distribute of operation result, and the thread sequence number is exported to message groups bag module 233 with conversation message, by this thread sequence number, that the service conversation in message is unique related with this data processing threads;
For example, to the system time of feature field MsgID number (being known by the message processing module) delivery with the data processing threads, the thread sequence number of the data processing threads that its operation result is namely distributed.Because each session is identified by unique feature field, so just guarantee that same conversation message only processed by same data processing threads, thereby guaranteed consistance, the security of data.
Message groups bag module 233 is used for will talking about message encapsulation bag in groups according to the thread sequence number of input, and thread sequence number and message groups bag is distributed to message processing module 24.
Message processing module 24 in Fig. 2 further comprises message adapter 241, data processor 242 and the message groups bag module 243 that connects successively; Wherein:
Message adapter 241, for the session of the number of data processing threads being notified described message distribution module 23-thread relating module 232, to carry out verification from the message groups bag of message distribution module 23 distributions, resolve, according to the thread sequence number, feature field and the opcode field of service conversation are exported to corresponding data processing threads in data processor;
Data processor 242 is used for identifying to determine the processing operation of session node as session status according to the session operational code of inputting by corresponding data processing threads, and operating result is exported to message groups bag module 243 after EO;
When having more than one a plurality of sessions be assigned to same data processing threads to process, process a plurality of sessions by formation the data field of each data processing threads, be that each session becomes a node in formation, each session node is unique index by feature field.New session has come, and can append node at the formation afterbody, guarantees that thus new session can not cover original session.The data processing threads can take out successively session node when processing and process from formation, and discharges the node that is disposed, so that the next node in formation is processed.
When the session operational code is designated newly-built session, create the service conversation node in corresponding data field, this node is preserved simultaneously session information, and is return success take feature field as unique identification.
When the session operational code is designated inquiry session, search session node according to feature field, and obtain session information from corresponding data field, return to simultaneously session information and the successful information obtained.
When the session operational code is designated more new session, search session node according to feature field, and upgrade the session information in corresponding data district, return success simultaneously.
When the session operational code is designated the deletion session, search session node according to feature field, and delete corresponding node, return success simultaneously.
Message groups bag module 243 is used for and will be wrapped in groups by the operating result encapsulation of data processor 242 inputs, sends to the external message entity by data communication module 22.
Message processing module 24 further comprises the data mover 244 that is connected with data processor 242, wherein:
Data processor 242 also for the data field of each session node of periodic scanning, in case find to have the node of overtime store data, is exported to data mover 244 with the conversation message data of preserving in its data field with feature field, and is emptied this data field;
Data mover 244 is used for take feature field as index, the conversation message Data Migration of input being preserved to database 25.
To the conversation message of preserving in each node data district, because it accounts for limited time in internal memory, in case the time that limits expires, the data in session node corresponding data district will be migrated in physical database, unrestrictedly not taken with the assurance Installed System Memory.
As shown in Figure 3, process the method flow of business conversation applications for the present invention adopts multithreading, comprise the steps:
300: the service conversation application program creates each thread in thread pool, and the thread of establishment comprises message distribution thread and a plurality of data processing threads at least, is respectively each data processing threads and distributes a data field independently;
400: receive conversation message from the external message entity by the message distribution thread, the service conversation in message is associated with unique data processing threads, and distributes this conversation message to this data processing threads;
500: in corresponding data field, the message that receives is carried out corresponding the processing according to its state by the data processing threads and operate, and result is fed back to the external message entity.
In addition, by the corresponding data field of data processing threads periodic scanning, the in time cleaning of node data of the service conversation of the overtime store data in data field is moved to physical database preserve.
What Fig. 4 represented is the idiographic flow of step 300 in Fig. 3, comprises the steps:
310: the service conversation application program creates a message distribution thread and a plurality of data processing threads in thread pool;
The number that creates the data processing threads determines according to the performance index of engineering application demand and system equipment, namely take maximum practical requirement with fully, rationally utilize system resource to be limit.
320: for each data processing threads distributes a data field of unique association with it;
Data field for each data processing threads distributes identifies each data processing threads by the thread sequence number, and sets up the unique incidence relation of data processing threads and data field by this thread sequence number.
330: activate each thread that creates.
The data processing threads will be in state of activation by the driving of message distribution thread always.
What Fig. 5 represented is the idiographic flow of step 400 in Fig. 3, comprises the steps:
410: after receiving conversation message, to this message identify, verification and parsing;
Feature field in message content is carried out dissection process, and this feature field is used for service conversation of unique identification, and namely the feature field in same Dialog processing process remains unchanged.
For example feature field is MsgID, and its formation is: type of service+...+system time (relative time is take millisecond as unit count).Perhaps, with a unique serial number as feature field MsgID etc.
420: obtain unique thread sequence number by feature field being carried out calculation process, by this thread sequence number, that this session is unique related with a data processing threads;
For example, the system time of feature field MsgID is used the number delivery of data processing threads, the thread sequence number of the data processing threads that its operation result is namely distributed.Because each session is identified by unique feature field, so just guarantee that same conversation message only processed by same data processing threads, thereby guaranteed consistance, the security of data.Perhaps, the feature field MsgID that will have unique serial number is divided by with the number of data processing threads, and the integer of obtaining is as the sequence number of data processing threads, etc.
As long as make each conversation message be distributed in different data processing threads, also can usually play the effect that utilizes multithreading to improve running efficiency of system, just not as equally distributed better effects if.
430: according to the thread sequence number that calculates, session message is sent to corresponding data processing threads.
Fig. 6 has represented the idiographic flow of step 500 in Fig. 3, comprises the steps:
501: after receiving conversation message from the message distribution thread, message is carried out verification, parsing, obtain operational code and the feature field of service conversation;
When having more than one a plurality of sessions be assigned to same data processing threads to process, process a plurality of sessions by formation the data field of each data processing threads, be that each session becomes a node in formation, each session node is unique index by feature field.New session has come, and can append node at the formation afterbody, guarantees that thus original session can not appear covering in new session.The data processing threads can take out successively session node when processing and process from formation, and discharges the node that is disposed, so that the next node in formation is processed.
502~510: identify to determine the processing operation of session node as session status according to the operational code of this session, and operating result is returned to the external message entity after EO.
When the session operational code is designated newly-built session, create the service conversation node in corresponding data field formation, this node is preserved simultaneously session information, and is return success take feature field as unique identification.
When the session operational code is designated inquiry session, search session node according to feature field in the formation of data field, and obtain session information from corresponding data field, return to simultaneously session information and the successful information obtained.
When the session operational code is designated more new session, search session node according to feature field in the formation of data field, and upgrade the session information in corresponding data district, return success simultaneously.
When the session operational code is designated the deletion session, search session node according to feature field in the formation of data field, and delete corresponding node, return success simultaneously the sign conversation end.
The data processing threads is driven by the message distribution Thread Messages, is in state of activation always.
Fig. 7 has represented the flow process of data processing threads periodic cleaning respective nodes data field data, comprises the steps:
520: regularly each node data district is scanned;
530~540: if judgement has the time of store data in node its data field of service conversation to surpass the default duration, this node data is migrated to the database preservation, and empty the data field of this node.
Method provided by the invention and device in keeping the process of service conversation, in order fast addressing to be carried out in session, adopt multithreading independent data district technology to realize that the high speed of mass data reads, and revise and deletion action the maintenance of finishing service session.Complicated multithreading synchronization and mutex mechanism has been avoided in the use in independent data district, has guaranteed the consistance of data security and session data.Simultaneously, utilize the independent data district to preserve service conversation information in internal memory, avoid immediate data storehouse access as far as possible, improve the work efficiency of system.
Certainly; the present invention also can have other various embodiments; in the situation that do not deviate from spirit of the present invention and essence thereof; those of ordinary skill in the art work as can make according to the present invention various corresponding changes and distortion, but these corresponding changes and distortion all should belong to the protection domain of the appended claim of the present invention.

Claims (9)

1. method that adopts multithreading to process the business conversation applications comprises:
The service conversation application program is pre-created and activates message distribution thread and a plurality of data processing threads, and is that each data processing threads distributes a data field of unique association with it;
When described message distribution thread receives message from the external message entity, the service conversation in described message is unique related with a data processing threads, and described message distribution is arrived this data processing threads;
When described data processing threads receives the message of message distribution thread distribution, process accordingly according to the state of this message in corresponding data field, and result is fed back to described external message entity;
Wherein, when described data processing threads receives the message of message distribution thread distribution, process accordingly according to the state of this message in corresponding data field, and result is fed back to described external message entity, that is:
Described data processing threads carries out verification, parsing to the described message that receives, and obtains operational code and the feature field of service conversation, determines the processing operation of the node of described service conversation as the status indicator of described message according to described operational code:
When described operational code is designated the new business session, create the node of this service conversation in corresponding data field formation, take described feature field as this node unique identification, the information of preserving simultaneously described service conversation, and successful information is returned to described external message entity;
Perhaps, when described operational code is designated the inquiry business session, search the node of described service conversation in corresponding data field formation according to described feature field, and obtain the information of described service conversation from described data field, information and the successful information with described service conversation returns to described external message entity simultaneously;
Perhaps, when described operational code is designated the renewal service conversation, search the node of described service conversation according to described feature field in corresponding data field formation, and upgrade the information of described service conversation in described data field, simultaneously successful information is returned to described external message entity;
Perhaps, when described operational code is designated the deletion service conversation, searches the node of described service conversation according to described feature field in corresponding data field formation, and delete this node, simultaneously successful information is returned to described external message entity, indicate that described service conversation finishes.
2. in accordance with the method for claim 1, it is characterized in that,
A data field of unique association refers to described service conversation application program for each data processing threads distributes with it: described service conversation application program identifies each data processing threads by the thread sequence number, and by described thread sequence number, that described data processing threads is unique related with the described data field of distribution;
Described data processing threads regularly scans corresponding data field, moves to database with the in time cleaning of data with the node of the described service conversation of overtime store data.
3. in accordance with the method for claim 2, it is characterized in that, described message distribution thread is with the service conversation in described message and unique related referring to of data processing threads: described message distribution thread is resolved the feature field in described message content, this feature field is used for the described service conversation of unique identification, described feature field is carried out calculation process obtain unique described thread sequence number, by this thread sequence number, that described service conversation is unique related with described data processing threads.
4. in accordance with the method for claim 3, it is characterized in that, described feature field is carried out calculation process to be obtained unique described thread sequence number and refer to: described feature field comprises system time at least, described system time is carried out modulo operation with the number of data processing threads, and the result of described computing is described thread sequence number.
5. a device that adopts multithreading to process the business conversation applications, comprise the thread creation module, message distribution module, the message processing module that connect successively, also comprises the data communication module that is connected with described message distribution module; Wherein:
Described thread creation module is used for application and is pre-created message distribution thread and a plurality of data processing threads, and is that each data processing threads distributes a data field of unique association with it; And the described message distribution thread that will create, activate exports to described message distribution module, and described message processing module is exported in the described a plurality of data processing threads and the data field thereof that create, activate;
Described data communication module is used for the communication connection between described device and external message entity;
Described message distribution module is used for receiving by described data communication module the message that described external message entity sends, and the service conversation in described message is unique related with a data processing threads, and described message distribution is arrived this data processing threads;
Described message processing module is used for the described message of input being processed accordingly according to its state in corresponding data field by each data processing threads, and result is fed back to described external message entity by described data communication module;
Described each data processing threads is determined the processing operation of the node of described service conversation according to opcode field, and is carrying out after corresponding processing finishes, corresponding result being fed back output, that is:
When described operational code is designated the new business session, create the node of this service conversation in corresponding data field formation, take feature field as this node unique identification, the information of preserving simultaneously described service conversation, and successful information is exported;
Perhaps, when described operational code is designated the inquiry business session, search the node of described service conversation according to described feature field in corresponding data field formation, and obtain the information of described service conversation from described data field, simultaneously information and the successful information of described service conversation are exported;
Perhaps, when described operational code is designated the renewal service conversation, searches the node of described service conversation according to described feature field in corresponding data field formation, and upgrade the information of described service conversation in described data field, simultaneously successful information is exported;
Perhaps, when described operational code is designated the deletion service conversation, searches the node of described service conversation according to described feature field in corresponding data field formation, and delete this node, simultaneously successful information is exported.
6. according to device claimed in claim 5, it is characterized in that, described message distribution module comprises message adapter, session-thread relating module and the message groups bag module that connects successively, wherein:
Described message adapter, the described message that is used for receiving is identified, after verification, export to described session-thread relating module;
Described session-thread relating module, after being used for the described message of input is resolved, feature field with unique identification service conversation in the described message of resolving, number to the described data processing threads known by described message processing module is carried out modulo operation, obtain unique thread sequence number according to the result of described computing, with described thread sequence number and described message with together with export to described message groups bag module;
Described message groups bag module is connected with described message processing module, is used for according to the described thread sequence number of input, described message being packaged into the message groups bag, and described thread sequence number and described message groups bag are distributed to described message processing module.
7. according to device claimed in claim 6, it is characterized in that, described message processing module comprises message adapter, data processor and the message groups bag module that connects successively; Wherein:
Described message adapter, be used for notifying described session-thread relating module with the number of described data processing threads, to carry out verification from the described message groups bag of described message groups bag module distribution, after parsing, according to described thread sequence number, feature field and the opcode field of described service conversation are exported to corresponding data processing threads in described data processor;
Described data processor, be used for determining as the status indicator of described service conversation according to the opcode field of input by corresponding data processing threads that the processing of the node of described service conversation operates, and after carrying out corresponding processing end, corresponding result is exported to described message groups bag module;
Described message groups bag module, the described result encapsulation that is used for inputting is wrapped in groups, sends to described external message entity by described data communication module.
8. according to device claimed in claim 7, it is characterized in that, corresponding data processing threads is determined the processing operation of the node of described service conversation according to described opcode field, and is carrying out after corresponding processing finishes, corresponding result being exported to described message groups bag module, that is:
When described operational code is designated the new business session, create the node of this service conversation in corresponding data field formation, take described feature field as this node unique identification, the information of preserving simultaneously described service conversation, and successful information is exported to described message groups bag module;
Perhaps, when described operational code is designated the inquiry business session, search the node of described service conversation in corresponding data field formation according to described feature field, and obtain the information of described service conversation from described data field, simultaneously information and the successful information of described service conversation are exported to described message groups bag module;
Perhaps, when described operational code is designated the renewal service conversation, search the node of described service conversation according to described feature field in corresponding data field formation, and upgrade the information of described service conversation in described data field, simultaneously successful information is exported to described message groups bag module;
Perhaps, when described operational code is designated the deletion service conversation, searches the node of described service conversation according to described feature field in corresponding data field formation, and delete this node, simultaneously successful information is exported to described message groups bag module, indicated that described service conversation finishes.
9. according to device claimed in claim 8, it is characterized in that, described device also comprises database, and described message processing module comprises the data mover that is connected with described data processor, wherein:
Described data processor also is used for regularly corresponding data field being scanned, and so that the data of the node of the described service conversation of overtime store data are exported to described data mover with feature field, and empties the data field of this node;
Described data mover is used for take feature field as index, the conversation message Data Migration of input being preserved to described database.
CN 200910138374 2009-05-07 2009-05-07 Method for processing business conversational application with multi-thread and device thereof Expired - Fee Related CN101882089B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200910138374 CN101882089B (en) 2009-05-07 2009-05-07 Method for processing business conversational application with multi-thread and device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200910138374 CN101882089B (en) 2009-05-07 2009-05-07 Method for processing business conversational application with multi-thread and device thereof

Publications (2)

Publication Number Publication Date
CN101882089A CN101882089A (en) 2010-11-10
CN101882089B true CN101882089B (en) 2013-05-08

Family

ID=43054109

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200910138374 Expired - Fee Related CN101882089B (en) 2009-05-07 2009-05-07 Method for processing business conversational application with multi-thread and device thereof

Country Status (1)

Country Link
CN (1) CN101882089B (en)

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9432321B2 (en) * 2011-12-19 2016-08-30 Alcatel Lucent Method and apparatus for messaging in the cloud
CN102831017B (en) * 2012-08-31 2014-09-10 河海大学 High-efficiency distributed parallel authentication system
CN103905484B (en) * 2012-12-26 2017-08-01 北京新媒传信科技有限公司 Handle the method and device of hypertext transfer protocol requests
CN104426964B (en) * 2013-08-29 2018-07-27 腾讯科技(深圳)有限公司 Data transmission method, device and terminal, computer storage media
CN104243212A (en) * 2014-09-24 2014-12-24 杭州华三通信技术有限公司 Session maintenance method and dialogue maintenance device
CN105610730B (en) * 2014-11-19 2020-03-13 中兴通讯股份有限公司 Message interaction method and system between CPU and network equipment
CN105843820B (en) * 2015-01-16 2019-10-08 阿里巴巴集团控股有限公司 Data migration method and device
CN106528065B (en) * 2015-09-14 2019-11-08 阿里巴巴集团控股有限公司 A kind of thread acquisition methods and equipment
CN105204950B (en) * 2015-09-25 2019-01-11 深圳怡化电脑股份有限公司 Queue communication method and device between a kind of task
CN105391968B (en) * 2015-11-03 2019-05-24 浙江大华技术股份有限公司 A kind of video session distribution method and device
CN106708895B (en) * 2015-11-17 2020-06-02 腾讯科技(深圳)有限公司 Method and device for displaying messages in mobile social application
CN105528254B (en) * 2015-12-07 2019-02-22 贵阳朗玛信息技术股份有限公司 A kind of method for processing business and device
CN107957910A (en) * 2016-10-18 2018-04-24 北京京东尚科信息技术有限公司 Message treatment method and message processing apparatus
CN108462682A (en) * 2017-02-22 2018-08-28 成都鼎桥通信技术有限公司 The distribution method and device of initial dialog protocol SIP messages
CN107678856B (en) * 2017-09-20 2022-04-05 苏宁易购集团股份有限公司 Method and device for processing incremental information in business entity
CN110018911B (en) * 2018-01-09 2024-01-23 斑马智行网络(香港)有限公司 Process management and inter-process communication method and device, computing equipment and storage medium
CN108446183A (en) * 2018-04-13 2018-08-24 广东亿迅科技有限公司 Processing method and processing device based on message distribution
CN109413489B (en) * 2018-09-29 2021-02-02 武汉斗鱼网络科技有限公司 Serial multi-thread bullet screen distribution method, device, equipment and storage medium
CN109379605B (en) * 2018-09-29 2020-10-16 武汉斗鱼网络科技有限公司 Bullet screen distribution method, device, equipment and storage medium based on bullet screen sequence
CN111817979A (en) * 2020-06-23 2020-10-23 成都深思科技有限公司 Multi-dimensional flow association data packet processing method based on sniffing mode
CN111835770B (en) * 2020-07-14 2021-01-29 全时云商务服务股份有限公司 Data processing method, device, server and storage medium
CN116107725B (en) * 2023-04-12 2023-07-14 中国人民解放军63921部队 Radar data processing system and method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1584842A (en) * 2004-06-09 2005-02-23 中兴通讯股份有限公司 Method for applied server of computer system
CN1605987A (en) * 2004-11-17 2005-04-13 中兴通讯股份有限公司 Method for realizing real time threads state monitoring in multiple thread system
CN1614555A (en) * 2003-11-06 2005-05-11 国际商业机器公司 Apparatus and method for autonomic hardware assisted thread stack tracking
CN1874538A (en) * 2005-07-20 2006-12-06 华为技术有限公司 Concurrent method for treating calling events
CN101299194A (en) * 2008-06-26 2008-11-05 上海交通大学 Heterogeneous multi-core system thread-level dynamic dispatching method based on configurable processor
CN101409877A (en) * 2008-11-28 2009-04-15 中兴通讯股份有限公司 Method for generating call ticket

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1614555A (en) * 2003-11-06 2005-05-11 国际商业机器公司 Apparatus and method for autonomic hardware assisted thread stack tracking
CN1584842A (en) * 2004-06-09 2005-02-23 中兴通讯股份有限公司 Method for applied server of computer system
CN1605987A (en) * 2004-11-17 2005-04-13 中兴通讯股份有限公司 Method for realizing real time threads state monitoring in multiple thread system
CN1874538A (en) * 2005-07-20 2006-12-06 华为技术有限公司 Concurrent method for treating calling events
CN101299194A (en) * 2008-06-26 2008-11-05 上海交通大学 Heterogeneous multi-core system thread-level dynamic dispatching method based on configurable processor
CN101409877A (en) * 2008-11-28 2009-04-15 中兴通讯股份有限公司 Method for generating call ticket

Also Published As

Publication number Publication date
CN101882089A (en) 2010-11-10

Similar Documents

Publication Publication Date Title
CN101882089B (en) Method for processing business conversational application with multi-thread and device thereof
US8270299B2 (en) Communicator-based token/buffer management for eager protocol support in collective communication operations
CN103679392B (en) A kind of task scheduling processing method and system
CN107193539B (en) Multithreading concurrent processing method and multithreading concurrent processing system
US20080148275A1 (en) Efficient Order-Preserving Delivery of Concurrent Messages
CN103645909A (en) Handling method and device for timed task
CN107621973A (en) A kind of method for scheduling task and device across cluster
CN105912402B (en) A kind of dispatching method and device based on Actor model
CN103365718A (en) Thread scheduling method, thread scheduling device and multi-core processor system
CN112148455A (en) Task processing method, device and medium
CN108809994A (en) Unified message method for pushing and system based on event and regulation management
CN111104188B (en) Scheduling method and device of vulnerability scanner
CN101645148A (en) Construction order management method applied to operation support system and management system thereof
GB2320594A (en) Dispatching client method calls to parallel execution threads within a server
CN105589751A (en) Physical resource scheduling method and device
CN111078436A (en) Data processing method, device, equipment and storage medium
CN102904961A (en) Method and system for scheduling cloud computing resources
CN110471774A (en) A kind of data processing method and device based on unified task schedule
CN102629220A (en) Dynamic task allocation and management method
CN107623731A (en) A kind of method for scheduling task, client, service cluster and system
CN109347918A (en) Call method, calling device, server, terminal and computer readable storage medium
CN101216780B (en) Method and apparatus for accomplishing multi-instance and thread communication under SMP system
CN110221914B (en) File processing method and device
CN1333343C (en) Concurrent operation of a state machine family
US10135944B2 (en) Processing a unit of work

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20130508

Termination date: 20190507