CN108009022A - A kind of message treatment method and server - Google Patents
A kind of message treatment method and server Download PDFInfo
- Publication number
- CN108009022A CN108009022A CN201711077786.7A CN201711077786A CN108009022A CN 108009022 A CN108009022 A CN 108009022A CN 201711077786 A CN201711077786 A CN 201711077786A CN 108009022 A CN108009022 A CN 108009022A
- Authority
- CN
- China
- Prior art keywords
- message
- pointer
- server
- response status
- response
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5011—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
- G06F9/5016—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/50—Allocation of resources, e.g. of the central processing unit [CPU]
- G06F9/5005—Allocation of resources, e.g. of the central processing unit [CPU] to service a request
- G06F9/5027—Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/12—Messaging; Mailboxes; Announcements
- H04W4/14—Short messaging services, e.g. short message services [SMS] or unstructured supplementary service data [USSD]
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
Abstract
The embodiment of the invention discloses a kind of message treatment method and server, including:Server obtains the first message pointer in pointer alignment, and the message of first message pointer direction is accessed according to first message pointer, then obtains the response status of message, however, it is determined that message has been replied, then first message pointer is deleted from message queue.It can be seen that, the a piece of news sent for server, server is respectively intended to two message pointers of the same message of storage direction by message queue and Hash table, if server receives response message, the response status of the second message pointer modified message in Hash table can be passed through, when the first message in by message queue, which refers to, to be judged for message progress time-out, directly the first message pointer can be deleted from message queue, without carrying out overtime judgement again, it can be seen that, pass through the cooperation of first message pointer and second message pointer, response and timeout treatment are separated, effectively increase the efficiency of Message Processing.
Description
Technical field
The present invention relates to Internet communication technology field, more particularly to a kind of message treatment method and server.
Background technology
In short message service, SP (service provider) service providers connect mobile gateway by SMS platform,
Short message sending service is provided for client.Long connection is established between SMS platform and mobile gateway, is sent out by way of asynchronous transmission
Message is sent, and every message has the time-out time specified, if SMS platform is after a message has been sent in specified time-out time
The response of mobile gateway feedback is not received inside, then it is assumed that this message time-out, follow-up SMS platform will be patrolled according to corresponding business
Collect and the message of time-out is handled.
In the prior art, usually using cachings of the Hash table Map (such as ConcurrentHashMap) as message.Short message
Platform adds the overtime moment of the message in the message when sending message, and is added to using the mark of the message as key
In Map.When SMS platform receives the response of mobile gateway feedback, search and delete from Map using message identifier as key
Message;Meanwhile be additionally provided with SMS platform one scanning thread periodically scan map, by the overtime moment of every message with
Current time is compared, if current time is more than the overtime moment of the message, it is determined that the message has timed out.As it can be seen that only
It can just judge whether the message is overtime after by the overtime moment of certain message compared with current time, thus in time-out
, it is necessary to scan all records in whole Map during judgement, moreover, in the prior art in the time-out time of a certain message
Before arrival, scanning thread usually requires to perform repeatedly, and a piece of news in Map will also tend to be scanned repeatedly, such as, message
Time-out time be arranged to 60s, scan thread run-down per second, then a piece of news in Map arrives at its overtime moment
It will be scanned 60s times before.In this way, in the environment of high concurrent, due to being cached with magnanimity Message Record, scan line in Map
Scanning still needs to scan all records in Map journey every time, and is scanned repeatedly within time-out time, and message time-out will be caused to judge
It is less efficient, and greatly waste CPU.
Therefore, at present there is an urgent need for a kind of message treatment method, for solving the efficiency that message time-out judges in the prior art
It is relatively low, and greatly waste the technical problem of CPU.
The content of the invention
The present invention provides a kind of message treatment method and server, for solving the effect that message time-out judges in the prior art
Rate is relatively low, and greatly wastes the technical problem of CPU.
A kind of message treatment method provided in an embodiment of the present invention, including:
Server obtains the first message pointer in pointer alignment, and accessing described first according to the first message pointer disappears
Cease the message that pointer is directed toward;The first message pointer is that the server is stored in the pointer team according to the sending time of message
Row;
The server obtains the response status of the message, wherein, the response status confirm in the following way:Institute
It is dont answer to state the initial response status of message, if the server receives the response message of the message, is answered according to described
The message identifier in message is answered, the second message pointer for being directed toward the message is searched from Hash table, and disappear according to described second
The response status of the message are changed to reply by breath pointer;The second message pointer is the server with the message
Message identifier be stored in the Hash table for key assignments;
The server determines the response status of the message when having replied, to delete described the from the pointer alignment
One message pointer.
Alternatively, the server determines that the response status of the message are when having replied, to further include:
The second message pointer is deleted from the Hash table.
Alternatively, the method further includes:
The server determines the response status of the message when being dont answer, obtains the sending time of the message;
The server determines whether the message is overtime according to current time and the sending time of the message;If not
Time-out, then periodically obtain the message pointer in the pointer alignment;If the message time-out, time-out is carried out to the message
Processing.
Alternatively, the server carries out the message timeout treatment, including:
The first message pointer is deleted from the pointer alignment and the second message is deleted from the Hash table
Pointer.
Alternatively, before server obtains the first message pointer in pointer alignment, further include:
The response status of the message of transmission, the sending time of the message and the message are stored in by the server
The memory of the server.
Based on same inventive concept, a kind of server provided by the invention, the server includes:
Processing module, for taking the first message pointer in pointer alignment, according to accessing the first message pointer
The message that first message pointer is directed toward;The first message pointer is the server according to described in the sending time deposit of message
Pointer alignment;
Acquisition module, for obtaining the response status of the message, wherein, the response status are true in the following way
Recognize:The initial response status of the message are dont answer, if the server receives the response message of the message, according to institute
The message identifier in response message is stated, searches the second message pointer for being directed toward the message from Hash table, and according to described the
The response status of the message are changed to reply by two message pointers;The second message pointer is the server with described
The message identifier of message is stored in the Hash table for key assignments;
The processing module is additionally operable to, and the response status for determining the message are when having replied, from the pointer alignment
Delete the first message pointer.
Alternatively, the processing module is additionally operable to:
The response status for determining the message are that when having replied, the second message pointer is deleted from the Hash table.
Alternatively, the processing module is additionally operable to:
When the response status for determining the message are dont answer, the sending time of the message is obtained;
According to current time and the sending time of the message, determine whether the message is overtime;If having not timed out, the cycle
Property obtain message pointer in the pointer alignment;If the message time-out, timeout treatment is carried out to the message.
Alternatively, the processing module is specifically used for:
The first message pointer is deleted from the pointer alignment and the second message is deleted from the Hash table
Pointer.
Alternatively, the server further includes transceiver module, is used for:
The response status of the message of transmission, the sending time of the message and the message are stored in the server
Memory.
Another embodiment of the present invention provides a kind of server, it includes memory and processor, wherein, the memory
Instructed for storage program, the processor is used to call the programmed instruction stored in the memory, according to the program of acquisition
Perform any of the above-described kind of method.
Another embodiment of the present invention provides a kind of computer-readable storage medium, and the computer-readable recording medium storage has
Computer executable instructions, the computer executable instructions are used to make the computer perform any of the above-described kind of method.
In the embodiment of the present invention, server obtains the first message pointer in pointer alignment, is visited according to first message pointer
Ask the message that the first message pointer is directed toward, then, obtain the response status of the message, however, it is determined that the message is has replied, then
First message pointer is deleted from message queue.In the embodiment of the present invention, a piece of news that is sent for server, in server
Two message pointers of the same message of storage direction are respectively intended to two kinds of data structures of message queue and Hash table, wherein,
Second message pointer in Hash table is used to, when server receives the corresponding response message of the message, pass through second message pointer
Change the response status of the message, the first message pointer in message queue is used to, when carrying out time-out to the message and judging, obtain
The response status of message are taken, if message is to have replied, directly can be deleted the first message pointer from message queue, without
Overtime judgement is carried out again, and server can so continued at the message to next message pointer direction in message queue
Reason, it is seen then that by the cooperation of first message pointer and second message pointer, the response of message and timeout treatment are separated,
Effectively increase the efficiency of timeout treatment.Further, since when the message pointer stored in message queue is the transmission according to message
Between be stored in message queue, it is contemplated that the first in first out characteristic of queue, server be suitable by the priority of the sending time according to message
Whether time-out is handled the message that sequence is successively directed toward the message pointer in message queue, so as to can effectively avoid to message team
The problem of message pointer in row takes multiple scan, waste cpu resource.
Brief description of the drawings
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment
Attached drawing is briefly introduced, it should be apparent that, drawings in the following description are only some embodiments of the present invention, for this
For the those of ordinary skill in field, without having to pay creative labor, it can also be obtained according to these attached drawings
His attached drawing.
The storage organization schematic diagram that Fig. 1 is applicable in by a kind of message treatment method provided in an embodiment of the present invention;
Fig. 2 is the flow diagram corresponding to a kind of message treatment method provided in an embodiment of the present invention;
Fig. 3 is a kind of structure diagram of server provided in an embodiment of the present invention.
Embodiment
In order to make the object, technical solutions and advantages of the present invention clearer, the present invention is made below in conjunction with attached drawing into
One step it is described in detail, it is clear that described embodiment, only part of the embodiment of the present invention, rather than whole implementation
Example.Based on the embodiments of the present invention, those of ordinary skill in the art are obtained without making creative work
All other embodiment, belongs to the scope of protection of the invention.
The embodiment of the present invention is described in further detail with reference to Figure of description.
The message treatment method provided in the embodiment of the present invention is useful in message and sends field, and the message can be sent
To user mobile phone short message or be sent to the application journey installed in the intelligent terminals such as the mobile phone of user, tablet computer
Built-in message in sequence, the present invention are not particularly limited this.
Specifically, the server in the embodiment of the present invention is also referred to as short message or message desk, it by with telecom operators
Or the gateway of Virtual network operator establishes long connection, and message is sent for user by way of asynchronous transmission.In such a scenario, use
Sender of the family as message, is committed to server by message first, then server according to the user in registration message service
The gateway being allocated during transmission, transmits the message to corresponding gateway, and then message is sent to corresponding reception by gateway again
Side.
In the embodiment of the present invention, every message that server is sent to gateway all has the overtime duration specified, the time-out
The period that Shi Changwei mono- is set, such as 1 second, 10 seconds etc..If server is after a message has been sent, in specified overtime duration
The response message of gateway transmission is not received inside, then message time-out, server need to use corresponding service logic to the message
Carry out timeout treatment.Need it is emphasized that in the embodiment of the present invention, all message that server is sent to gateway all have phase
Same overtime duration.
In the embodiment of the present invention, the telecommunication carrier can be the telecommunications such as China Mobile, China Unicom, China Telecom fortune
Business is sought, network operator's gateway can be all kinds of Internet enterprises etc..
The storage organization schematic diagram that Fig. 1 is applicable in by the method provided in the embodiment of the present invention, as shown in Figure 1, servicing
Include the storage region that message heap memory, message queue, message cache totally 3 types in device.
Specifically, message heap memory is used in storage server the message sent, stored in message heap memory each
Bar message all has multiple fields such as message identifier, response status, sending time.When server sends a piece of news
Afterwards, which can be stored in message heap memory, and records the sending time of the message, the response status of message are arranged to initial
Dont answer state.
In the embodiment of the present invention, server can also just deposit message after the message to be sent of user's submission is received
Enter message heap memory.In this case, the state of message can first be arranged to not send state, then when server disappears in handle
After breath is sent, the sending time of the message is recorded, and the response status for changing message are initial dont answer state.
Message queue and message caching are used for storing the corresponding message pointer of the message sent in message heap memory.
When server sends a certain message, and after message is stored in message heap memory, server can create two it is same
The pointer of the message is directed toward, and a message pointer is stored in message queue, another pointer deposit message caching.
The embodiment of the present invention, make use of the characteristic of the first in first out of this data structure of queue, server is according to message
Sending time, message queue is stored in by the message pointer for being directed toward message.Therefore, the message pointer in message queue is according to message
Sending time sequencing storage, the corresponding message pointer of message first sent be located at before message queue, afterwards send out
The corresponding message pointer of message is sent to be located at behind message queue, in this way, disappearing of being got every time from message queue of server
Pointer is ceased, is all that earliest one of sending time for the message being directed toward in all message pointers stored in current message queue disappears
Cease pointer.Since the sending time of message is more early, the overtime moment arrives also more early, then if what server was obtained from queue
The message that first message pointer is directed toward is not timed-out, then the message that other all message pointers are directed toward after the message pointer is just
All it is not timed-out.
Correspondingly, cached in the embodiment of the present invention using this data structure of Hash table as message.Message caching can
Think specific implementation of this data structures of concurrentHashMap as Hash table, or other can also be used
The Hash table of type realizes that the present invention is not particularly limited this.
In the embodiment of the present invention, server will be directed toward disappearing for the message using the message identifier of a certain message as key assignments key
Ceasing in pointer insertion Hash table, quick due to Hash table searches characteristic, when server receives the response message of gateway transmission,
The message pointer for being directed toward message corresponding with the response message can be quickly located according to the message identifier in response message,
So as to effectively increase the treatment effeciency in acknowledgement messaging.
Based on above-mentioned storage organization, Fig. 2 is shown corresponding to a kind of message treatment method provided in the embodiment of the present invention
Flow diagram, as shown in Fig. 2, the described method includes:
Step S201:Server obtains the first message pointer in pointer alignment, is accessed according to the first message pointer
The message that the first message pointer is directed toward;
Step S202:The server obtains the response status of the message, wherein, the response status pass through such as lower section
Formula confirms:The initial response status of the message are dont answer, if the server receives the response message of the message, root
According to the message identifier in the response message, the second message pointer for being directed toward the message is searched from Hash table, and according to institute
Second message pointer is stated to be changed to reply by the response status of the message;
Step S203:The server determines that the response status of the message are when having replied, from the pointer alignment
Delete the first message pointer.
In the embodiment of the present invention, for a piece of news of server transmission, there is message queue and Hash table in server
Two kinds of data structures are respectively intended to two message pointers that same message is directed toward in storage, wherein, the second message in Hash table refers to
Pin is used to, when server receives the corresponding response message of the message, pass through the response shape of the second message pointer modified message
State, the first message pointer in message queue are used for the response status for when carrying out time-out to the message and judging, obtaining message, if
Message directly can then delete the first message pointer, without carrying out overtime judgement again, so to have replied from message queue
Server can be made to continue to handle the message that next message pointer in message queue is directed toward, it is seen then that disappear by first
The cooperation of pointer and second message pointer is ceased, the response of message and timeout treatment are separated, effectively increase timeout treatment
Efficiency.Further, since the message pointer stored in message queue is to be stored in message queue according to the sending time of message, examine
Consider the first in first out characteristic of queue, server by according to the sequencing of the sending time of message successively in message queue
Whether time-out is handled the message that message pointer is directed toward, so as to can effectively avoid more to the message pointer progress in message queue
The problem of secondary scanning, waste cpu resource.
Specifically, in step s 201, server from the first message pointer of the acquisition in pointer alignment be message team
The overtime moment of first message pointer in row, i.e. message pointed by the first message pointer arrives earliest.
Since what is stored in message pointer is storage address of that message in message heap memory pointed by it,
After server gets first message pointer, that message pointed by it can be accessed by the first message pointer, and with
The response status of the message are obtained in step S202 afterwards.
In the embodiment of the present invention, each transmitted message stored in message heap memory sends it to gateway in server
Afterwards, initial response status are all dont answer, and only server have received gateway and be properly received the response sent after the message
After message, the response status of the message are just to have replied.
Include the message identifier of the message in the corresponding response message of a certain message.Therefore, clothes are worked as in step S202
After business device receives the response message of gateway transmission, it can search and be directed toward from Hash table according to the message identifier in response message
The second message pointer of the message, and be changed to reply by the response status of the message by second message pointer.
In step S203, server is if it is determined that the response status for the message that first message pointer is directed toward are to have replied, then
Directly the first message pointer is deleted from message queue.
Since the second message pointer stored in Hash table is to receive response message, and the response status of message are changed
, if the response status of the message have been modified to reply, server also deletes the second message pointer in the lump.
In addition, in step S202, if server gets the response status of the message as not according to first message pointer
Response, then server need to determine whether the message overtime, it is specific as follows:
The sending time of the message is obtained, according to current time and the sending time got, judges whether the message surpasses
When, if the difference between current time and sending time is more than or equal to the overtime duration of the message, it is determined that message time-out, instead
It, then the message has not timed out.
And then if server determines the message dont answer and has timed out, can be by first message pointer from pointer alignment
Delete, second message pointer is deleted from Hash table, and the message to being stored in message heap memory carries out corresponding time-out
The processing of service logic.
If server determines the message dont answer and has not timed out, the message pointer in pointer alignment can be periodically obtained.
In the embodiment of the present invention, server can be by setting a time-out scanning thread to obtain successively in message queue
Message pointer, and whether the message being directed toward to message pointer replys, whether time-out judges.The message is determined in server not
Response and in the case of having not timed out, message pointer of the server periodically in pointer alignment refer to that server interrupts current
Scanning, then reacquires the message pointer according to the time cycle (such as 2ms, 5ms etc.) of a certain setting, rejudges again
The message pointer be directed toward message whether reply and whether time-out.
As a kind of preferable implementation, in the embodiment of the present invention, in the situation for determining message dont answer and also having not timed out
Under, server can interrupt current scanning, according to the overtime duration of current time He the message, when calculating the wait of the message
It is long, i.e., required time when current time is apart from the arrival of message time-out moment, and after the time by the waiting time
The first message pointer is obtained again, the first message pointer and the first message pointer of previous acquisition are same message pointer,
At this time, the message which is directed toward just has timed out, and server deletes first message pointer and second message pointer, and
Timeout treatment is carried out to the message.
As can be seen that the first message pointer obtained for server, if what server was directed toward in the first message pointer
The overtime moment of message receives the corresponding response message of the message before arriving, then the first message pointer surpasses in its corresponding message
When before, will be deleted from message queue;If the overtime moment for the message that server is directed toward in the first message pointer arrives
The corresponding response message of the message is not received before coming, then for server when the message corresponding overtime moment arrives, determining should
Message has timed out, and first message pointer is deleted from message queue.
Thus, each first message pointer is at least deleted when its corresponding message overtime moment arrives, current
After first message pointer is deleted, server will obtain lower a piece of news pointer from message queue, will descend a piece of news
Pointer performs the process flow in above-mentioned steps S201 to step S203 again as new first message pointer.
The embodiment of the present invention, is assisted by the first message pointer in the second message pointer in Hash table and message queue
The characteristics of work, the message being directed toward using the message pointer before in message queue are had not timed out, and message below also necessarily has not timed out,
The number of invalid scanning can be effectively reduced, improves the resource utilization of system, is lifted at the globality of system under high concurrent environment
Energy.
Based on same inventive concept, the embodiment of the present invention also provides a kind of server, and Fig. 3 is to be carried in the embodiment of the present invention
The structure diagram of a kind of server supplied, as shown in figure 3, the server 300 includes:
Processing module 301, for taking the first message pointer in pointer alignment, institute is accessed according to the first message pointer
State the message of first message pointer direction;The first message pointer is that the server is stored in institute according to the sending time of message
State pointer alignment;
Acquisition module 302, for obtaining the response status of the message, wherein, the response status are in the following way
Confirm:The initial response status of the message are dont answer, if the server receives the response message of the message, basis
Message identifier in the response message, searches the second message pointer for being directed toward the message from Hash table, and according to described
The response status of the message are changed to reply by second message pointer;The second message pointer is the server with institute
The message identifier for stating message is stored in the Hash table for key assignments;
The processing module 301 is additionally operable to, and the response status for determining the message are when having replied, from the pointer alignment
It is middle to delete the first message pointer.
Alternatively, the processing module 301 is additionally operable to:
The response status for determining the message are that when having replied, the second message pointer is deleted from the Hash table.
Alternatively, the processing module 301 is additionally operable to:
When the response status for determining the message are dont answer, the sending time of the message is obtained;
According to current time and the sending time of the message, determine whether the message is overtime;If having not timed out, the cycle
Property obtain message pointer in the pointer alignment;If the message time-out, timeout treatment is carried out to the message.
Alternatively, the processing module 301 is specifically used for:
The first message pointer is deleted from the pointer alignment and the second message is deleted from the Hash table
Pointer.
Alternatively, the server further includes transceiver module 303, is used for:
The response status of the message of transmission, the sending time of the message and the message are stored in the server
Memory.
Based on same inventive concept, the embodiment of the present invention also provides another server, which can include center
Processor (Center Processing Unit, CPU), memory, input-output apparatus etc., input equipment can include key
Disk, mouse, touch-screen etc., output equipment can include display device, such as liquid crystal display (Liquid Crystal
Display, LCD), cathode-ray tube (Cathode Ray Tube, CRT) etc..
Memory can include read-only storage (ROM) and random access memory (RAM), and provide storage to processor
The programmed instruction and data stored in device.In embodiments of the present invention, memory can be used for the timeout treatment side for storing message
The program of method.
By calling the programmed instruction of memory storage, processor is used to perform according to the programmed instruction of acquisition processor
State the timeout treatment method of message.
Based on same inventive concept, an embodiment of the present invention provides a kind of computer-readable storage medium, for saving as
The computer program instructions used in server are stated, it includes the program of the timeout treatment method for performing above-mentioned message.
The computer-readable storage medium can be any usable medium or data storage device that computer can access, bag
Include but be not limited to magnetic storage (such as floppy disk, hard disk, tape, magneto-optic disk (MO) etc.), optical memory (such as CD, DVD,
BD, HVD etc.) and semiconductor memory (such as it is ROM, EPROM, EEPROM, nonvolatile memory (NAND FLASH), solid
State hard disk (SSD)) etc..
By the above it can be seen that:
In the embodiment of the present invention, for a piece of news of server transmission, there is message queue and Hash table in server
Two kinds of data structures are respectively intended to two message pointers that same message is directed toward in storage, wherein, the second message in Hash table refers to
Pin is used to, when server receives the corresponding response message of the message, pass through the response shape of the second message pointer modified message
State, the first message pointer in message queue are used for the response status for when carrying out time-out to the message and judging, obtaining message, if
Message directly can then delete the first message pointer, without carrying out overtime judgement again, so to have replied from message queue
Server can be made to continue to handle the message that next message pointer in message queue is directed toward, it is seen then that disappear by first
The cooperation of pointer and second message pointer is ceased, the response of message and timeout treatment are separated, effectively increase timeout treatment
Efficiency.Further, since the message pointer stored in message queue is to be stored in message queue according to the sending time of message, examine
Consider the first in first out characteristic of queue, server by according to the sequencing of the sending time of message successively in message queue
Whether time-out is handled the message that message pointer is directed toward, so as to can effectively avoid more to the message pointer progress in message queue
The problem of secondary scanning, waste cpu resource.
It should be understood by those skilled in the art that, the embodiment of the present invention can be provided as method, system or computer program
Product.Therefore, the present invention can use the reality in terms of complete hardware embodiment, complete software embodiment or combination software and hardware
Apply the form of example.Moreover, the present invention can be used wherein includes the meter of computer usable program code at one or more
The computer journey that calculation machine usable storage medium is implemented on (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
The form of sequence product.
The present invention be with reference to according to the method for the embodiment of the present invention, the flow of equipment (system) and computer program product
Figure and/or block diagram describe.It should be understood that it can be realized by computer program instructions every first-class in flowchart and/or the block diagram
The combination of flow and/or square frame in journey and/or square frame and flowchart and/or the block diagram.These computer programs can be provided
The processors of all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices is instructed to produce
A raw machine so that the instruction performed by computer or the processor of other programmable data processing devices, which produces, to be used in fact
The function of being specified in present one flow of flow chart or one square frame of two or more flow and/or block diagram or two or more square frame
Device.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing devices with spy
Determine in the computer-readable memory that mode works so that the instruction being stored in the computer-readable memory, which produces, to be included referring to
The manufacture of device is made, which realizes in one flow of flow chart or two or more flow and/or one side of block diagram
The function of being specified in frame or two or more square frame.
These computer program instructions can be also loaded into computer or other programmable data processing devices so that counted
Series of operation steps is performed on calculation machine or other programmable devices to produce computer implemented processing, thus in computer or
The instruction performed on other programmable devices is provided and is used for realization in one flow of flow chart or two or more flow and/or square frame
The step of function of being specified in one square frame of figure or two or more square frame.
Although preferred embodiments of the present invention have been described, but those skilled in the art once know basic creation
Property concept, then can make these embodiments other change and modification.So appended claims be intended to be construed to include it is excellent
Select embodiment and fall into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art
God and scope.In this way, if these modifications and changes of the present invention belongs to the scope of the claims in the present invention and its equivalent technologies
Within, then the present invention is also intended to comprising including these modification and variations.
Claims (12)
- A kind of 1. message treatment method, it is characterised in that the described method includes:Server obtains the first message pointer in pointer alignment, and accessing the first message according to the first message pointer refers to The message that pin is directed toward;The first message pointer is that the server is stored in the pointer alignment according to the sending time of message 's;The server obtains the response status of the message, wherein, the response status confirm in the following way:It is described to disappear It is dont answer to cease initial response status, if the server receives the response message of the message, is disappeared according to the response Message identifier in breath, searches the second message pointer for being directed toward the message from Hash table, and is referred to according to the second message The response status of the message are changed to reply by pin;The second message pointer is the server disappearing with the message Breath is identified as key assignments and is stored in the Hash table;The server determines that the response status of the message are when having replied, described first to be deleted from the pointer alignment and is disappeared Cease pointer.
- 2. according to the method described in claim 1, it is characterized in that, the server determines the response status of the message for During response, further include:The second message pointer is deleted from the Hash table.
- 3. according to the method described in claim 1, it is characterized in that, the method further includes:The server determines the response status of the message when being dont answer, obtains the sending time of the message;The server determines whether the message is overtime according to current time and the sending time of the message;If having not timed out, Then periodically obtain the message pointer in the pointer alignment;If the message time-out, timeout treatment is carried out to the message.
- 4. according to the method described in claim 3, it is characterized in that, the server carries out the message timeout treatment, bag Include:The first message pointer is deleted from the pointer alignment and the second message pointer is deleted from the Hash table.
- 5. method according to any one of claim 1 to 4, it is characterised in that server obtains the in pointer alignment Before one message pointer, further include:The server is by described in the response status deposit of the message of transmission, the sending time of the message and the message The memory of server.
- 6. a kind of server, it is characterised in that the server includes:Processing module, for taking the first message pointer in pointer alignment, described first is accessed according to the first message pointer The message that message pointer is directed toward;The first message pointer is that the server is stored in the pointer according to the sending time of message Queue;Acquisition module, for obtaining the response status of the message, wherein, the response status confirm in the following way:Institute It is dont answer to state the initial response status of message, if the server receives the response message of the message, is answered according to described The message identifier in message is answered, the second message pointer for being directed toward the message is searched from Hash table, and disappear according to described second The response status of the message are changed to reply by breath pointer;The second message pointer is the server with the message Message identifier be stored in the Hash table for key assignments;The processing module is additionally operable to, and the response status for determining the message are when having replied, to be deleted from the pointer alignment The first message pointer.
- 7. server according to claim 6, it is characterised in that the processing module is additionally operable to:The response status for determining the message are that when having replied, the second message pointer is deleted from the Hash table.
- 8. server according to claim 6, it is characterised in that the processing module is additionally operable to:When the response status for determining the message are dont answer, the sending time of the message is obtained;According to current time and the sending time of the message, determine whether the message is overtime;If having not timed out, periodically obtain Take the message pointer in the pointer alignment;If the message time-out, timeout treatment is carried out to the message.
- 9. server according to claim 8, it is characterised in that the processing module is specifically used for:The first message pointer is deleted from the pointer alignment and the second message pointer is deleted from the Hash table.
- 10. the server according to any one of claim 6 to 9, it is characterised in that the server further includes transmitting-receiving mould Block, is used for:The response status of the message of transmission, the sending time of the message and the message are stored in the server Deposit.
- A kind of 11. server, it is characterised in that including:Memory, instructs for storage program;Processor, for calling the programmed instruction stored in the memory, according to acquisition program perform as claim 1 to Method any one of 5.
- 12. a kind of computer-readable storage medium, it is characterised in that the computer-readable recording medium storage has computer can perform Instruction, the computer executable instructions are used to make the computer perform the side as any one of claim 1 to 5 Method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711077786.7A CN108009022A (en) | 2017-11-06 | 2017-11-06 | A kind of message treatment method and server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201711077786.7A CN108009022A (en) | 2017-11-06 | 2017-11-06 | A kind of message treatment method and server |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108009022A true CN108009022A (en) | 2018-05-08 |
Family
ID=62051215
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201711077786.7A Pending CN108009022A (en) | 2017-11-06 | 2017-11-06 | A kind of message treatment method and server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108009022A (en) |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109558107A (en) * | 2018-12-04 | 2019-04-02 | 中国航空工业集团公司西安航空计算技术研究所 | A kind of FC message sink management method of shared buffer |
CN109697592A (en) * | 2018-12-21 | 2019-04-30 | 江苏满运软件科技有限公司 | Source of goods undercarriage method, system, equipment and storage medium based on annular array |
CN110764930A (en) * | 2019-10-21 | 2020-02-07 | 中国民航信息网络股份有限公司 | Request or response processing method and device based on message mode |
CN112019305A (en) * | 2019-05-28 | 2020-12-01 | 阿里巴巴集团控股有限公司 | Data transmission method, device, equipment and storage medium |
CN112181242A (en) * | 2019-07-02 | 2021-01-05 | 北京百度网讯科技有限公司 | Page display method and device |
CN112596920A (en) * | 2020-12-15 | 2021-04-02 | 中国建设银行股份有限公司 | Message processing method and device, electronic equipment and storage medium |
CN112860719A (en) * | 2021-02-05 | 2021-05-28 | 北京百度网讯科技有限公司 | Data processing method and device and electronic equipment |
CN113569029A (en) * | 2021-07-28 | 2021-10-29 | 北京小米移动软件有限公司 | Dialogue response method, device and storage medium |
CN114138520A (en) * | 2020-05-13 | 2022-03-04 | 浙江创邻科技有限公司 | Distributed message processing method and system |
CN114338390A (en) * | 2022-03-10 | 2022-04-12 | 广东统信软件有限公司 | Server configuration method, computing device and storage medium |
CN114979249A (en) * | 2022-03-30 | 2022-08-30 | 阿里巴巴(中国)有限公司 | Message handle creating method, message pushing method, related device and system |
CN114979169A (en) * | 2022-05-27 | 2022-08-30 | 山东派盟网络科技有限公司 | Network resource pushing method and device, storage medium and electronic equipment |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101163139A (en) * | 2006-10-11 | 2008-04-16 | 国际商业机器公司 | Method and equipment for refusing SIP message of redundancy retransmission |
CN101178667A (en) * | 2007-12-03 | 2008-05-14 | 中兴通讯股份有限公司 | Method of invalid time over message under system process scheduling |
US20080162663A1 (en) * | 2006-10-27 | 2008-07-03 | Hewlett-Packard Development Company, L.P. | Computer system with network interface retransmit |
CN101561767A (en) * | 2008-04-16 | 2009-10-21 | 上海聚力传媒技术有限公司 | Method and device for executing tasks based on operating system |
CN101739296A (en) * | 2009-12-28 | 2010-06-16 | 广州菲音信息科技有限公司 | Data processing system and method |
US20120320909A1 (en) * | 2011-06-16 | 2012-12-20 | Ziegler Michael L | Sending request messages over designated communications channels |
CN106201432A (en) * | 2016-07-19 | 2016-12-07 | 网易(杭州)网络有限公司 | The treating method and apparatus of the information of destination object |
-
2017
- 2017-11-06 CN CN201711077786.7A patent/CN108009022A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101163139A (en) * | 2006-10-11 | 2008-04-16 | 国际商业机器公司 | Method and equipment for refusing SIP message of redundancy retransmission |
US20080162663A1 (en) * | 2006-10-27 | 2008-07-03 | Hewlett-Packard Development Company, L.P. | Computer system with network interface retransmit |
CN101178667A (en) * | 2007-12-03 | 2008-05-14 | 中兴通讯股份有限公司 | Method of invalid time over message under system process scheduling |
CN101561767A (en) * | 2008-04-16 | 2009-10-21 | 上海聚力传媒技术有限公司 | Method and device for executing tasks based on operating system |
CN101739296A (en) * | 2009-12-28 | 2010-06-16 | 广州菲音信息科技有限公司 | Data processing system and method |
US20120320909A1 (en) * | 2011-06-16 | 2012-12-20 | Ziegler Michael L | Sending request messages over designated communications channels |
CN106201432A (en) * | 2016-07-19 | 2016-12-07 | 网易(杭州)网络有限公司 | The treating method and apparatus of the information of destination object |
Cited By (16)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109558107A (en) * | 2018-12-04 | 2019-04-02 | 中国航空工业集团公司西安航空计算技术研究所 | A kind of FC message sink management method of shared buffer |
CN109697592A (en) * | 2018-12-21 | 2019-04-30 | 江苏满运软件科技有限公司 | Source of goods undercarriage method, system, equipment and storage medium based on annular array |
CN112019305B (en) * | 2019-05-28 | 2023-04-18 | 阿里巴巴集团控股有限公司 | Data transmission method, device, equipment and storage medium |
CN112019305A (en) * | 2019-05-28 | 2020-12-01 | 阿里巴巴集团控股有限公司 | Data transmission method, device, equipment and storage medium |
CN112181242B (en) * | 2019-07-02 | 2021-11-02 | 北京百度网讯科技有限公司 | Page display method and device |
CN112181242A (en) * | 2019-07-02 | 2021-01-05 | 北京百度网讯科技有限公司 | Page display method and device |
CN110764930A (en) * | 2019-10-21 | 2020-02-07 | 中国民航信息网络股份有限公司 | Request or response processing method and device based on message mode |
CN114138520A (en) * | 2020-05-13 | 2022-03-04 | 浙江创邻科技有限公司 | Distributed message processing method and system |
CN112596920A (en) * | 2020-12-15 | 2021-04-02 | 中国建设银行股份有限公司 | Message processing method and device, electronic equipment and storage medium |
CN112860719A (en) * | 2021-02-05 | 2021-05-28 | 北京百度网讯科技有限公司 | Data processing method and device and electronic equipment |
CN112860719B (en) * | 2021-02-05 | 2023-09-29 | 北京百度网讯科技有限公司 | Data processing method and device and electronic equipment |
CN113569029A (en) * | 2021-07-28 | 2021-10-29 | 北京小米移动软件有限公司 | Dialogue response method, device and storage medium |
CN114338390A (en) * | 2022-03-10 | 2022-04-12 | 广东统信软件有限公司 | Server configuration method, computing device and storage medium |
CN114979249A (en) * | 2022-03-30 | 2022-08-30 | 阿里巴巴(中国)有限公司 | Message handle creating method, message pushing method, related device and system |
CN114979169A (en) * | 2022-05-27 | 2022-08-30 | 山东派盟网络科技有限公司 | Network resource pushing method and device, storage medium and electronic equipment |
CN114979169B (en) * | 2022-05-27 | 2024-03-29 | 山东派盟网络科技有限公司 | Network resource pushing method and device, storage medium and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108009022A (en) | A kind of message treatment method and server | |
CN104618226B (en) | A kind of information processing method, client and server | |
CN103108320A (en) | Method and system for monitoring application program of mobile device | |
CN106709705A (en) | Virtual goods packet sending method, receiving method, devices and system | |
CN111340587B (en) | Virtual commodity management method and related device | |
CN103491170B (en) | Email reaches the method and system of prompting message | |
CN111918225A (en) | Method for sending short message based on multiple operators | |
CN105516258A (en) | Information interaction system, method and device | |
CN106330683A (en) | Multimedia seating system | |
CN111010527A (en) | Method and related device for establishing video call through short message link | |
CN109040970A (en) | Method and terminal device are handled in plan of operation based on cloud computing | |
CN109409961A (en) | Self-service method, terminal, system and the storage medium for obtaining parking discount coupon | |
CN104967648A (en) | Internet protocol address scheduling method, apparatus and system | |
CN108346019A (en) | Information transmitting system and device based on intelligent express delivery cabinet | |
CN104320766A (en) | Spam short message identification method, device and equipment | |
CN106658670A (en) | Wireless fidelity Wi-Fi scanning method and mobile terminal | |
CN109522202A (en) | A kind of method and apparatus of software test | |
CN106817392A (en) | A kind of data processing method and system | |
CN110650448A (en) | Call management system and method for mobile communication terminal | |
CN108540949B (en) | Method for receiving multimedia message product without flow | |
CN107770203A (en) | A kind of service request retransmission method, apparatus and system | |
CN106020983A (en) | Method, device and system for processing virtual resources | |
CN108536854A (en) | The method, apparatus and computer readable storage medium of data interaction | |
CN104112220A (en) | Method and device for collecting electronic information | |
CN111131633B (en) | Application method of virtual number, communication method and related device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180508 |
|
RJ01 | Rejection of invention patent application after publication |