CN106936688A - Notice sending method and device - Google Patents
Notice sending method and device Download PDFInfo
- Publication number
- CN106936688A CN106936688A CN201511021406.9A CN201511021406A CN106936688A CN 106936688 A CN106936688 A CN 106936688A CN 201511021406 A CN201511021406 A CN 201511021406A CN 106936688 A CN106936688 A CN 106936688A
- Authority
- CN
- China
- Prior art keywords
- sent
- notice
- thread
- message queue
- judging
- 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.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L51/00—User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
- H04L51/21—Monitoring or handling of messages
- H04L51/224—Monitoring or handling of messages providing notification on incoming messages, e.g. pushed notifications of received messages
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/10—Flow control; Congestion control
- H04L47/12—Avoiding congestion; Recovering from congestion
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Telephonic Communication Services (AREA)
- Computer And Data Communications (AREA)
- Information Transfer Between Computers (AREA)
Abstract
This application discloses a kind of notice sending method and device.Wherein, the method includes:Notice to be sent is obtained from message queue, wherein, all notices to be sent are added in message queue in advance;Whether the quantity for sending thread is judged less than maximum concurrency, wherein, it is for performing the thread for notifying to send operation to send thread;And when judging that the quantity for sending thread is less than maximum concurrency, new transmission thread is created, and notice to be sent is sent by new transmission thread.Notice quantity present application addresses transmitted in parallel in correlation technique excessively causes the technical problem for notifying to send blocking.
Description
Technical field
The application is related to data processing field, in particular to a kind of notice sending method and device.
Background technology
Existing many systems (for example, website data analysis system) all have the function of sending mail, for example, all
Phase form is exactly to be configured in systems by user, and system runs these forms in daily fixed time, inquires about number
According to data in storehouse, then output data in report form template, generate form, finally form is sent to by mail
Specify user.Usual each system can configure multiple schedule reports, and these schedule reports are all executed in parallel.
In the case where form quantity is very more, for example, up to thousands of forms, when these forms are concurrently performed, can
Can there are hundreds of forms needs to send mail simultaneously.And mail server sends the concurrency of mail to each mailbox
It is conditional, usual concurrency is all very low, for example, 10 envelope mails can only be sent out simultaneously, can so causes to send and report
Table mail is largely blocked, can also be overtime after a period of time, can be retried after time-out, if a large amount of forms send mail all weighed
If examination, mail server burden can be further exacerbated by, be absorbed in vicious circle, further drag down mail server performance.
Additionally, short message, wechat message etc. equally there is also above mentioned problem in the case where high concurrent is needed.
Notice quantity for transmitted in parallel in correlation technique excessively causes the problem for notifying to send blocking, not yet carries at present
Go out effective solution.
The content of the invention
The main purpose of the application is to provide a kind of notice sending method and device, to solve to be sent out parallel in correlation technique
The notice quantity sent excessively causes to notify to send the problem for blocking.
To achieve these goals, according to the one side of the application, there is provided a kind of notice sending method.The method
Including:Notice to be sent is obtained from message queue, wherein, all notices to be sent are added to message queue in advance
In;Whether the quantity for sending thread is judged less than maximum concurrency, wherein, it is to notify to send for execution to send thread
The thread of operation;And when judging that the quantity for sending thread is less than maximum concurrency, new transmission thread is created,
And notice to be sent is sent by new transmission thread.
Further, when judging that the quantity for sending thread is not less than maximum concurrency, the method also includes:Wait
Whether first Preset Time, rejudge the quantity for sending thread less than maximum concurrency.
Further, when judging that the quantity for sending thread is less than maximum concurrency, new transmission thread is created, and
After by new transmission thread transmission notice to be sent, method also includes:Detection sends notice to be sent and whether there is
It is abnormal;And when detecting that sending notice to be sent has abnormal, notice to be sent is added to message queue again
In.
Further, when judging that the quantity for sending thread is less than maximum concurrency, new transmission thread is created, and
After by new transmission thread transmission notice to be sent, the method also includes:Detection sends whether notice to be sent deposits
In exception;When transmission notice to be sent is detected in the presence of exception, judge whether the transmission times of notice to be sent reaches
Preset value;When the transmission times not up to preset value of notice to be sent is judged, by the transmission times of notice to be sent
Plus 1, and notice to be sent is added in message queue again;And judging the transmission times of notice to be sent
When reaching preset value, notice to be sent, and output abnormality information are recorded.
Further, before notice to be sent is obtained from message queue, the method also includes:Detection run switch
State, wherein, the state of run switch includes opening and closed mode, and opening is used to indicating performing logical
Know transmission operation, closed mode is used to indicate to stop performing to notify to send operation;And detecting that run switch is in
During opening, judge whether message queue is empty, wherein, it not is space-time message queue is judged, from message team
Notice to be sent is obtained in row, message queue is being judged for space-time, the second Preset Time of wait rejudges message
Whether queue is empty.
Further, it is added to after message queue by all notices to be sent, the method also includes:Judgement disappears
Whether breath queue is empty;And judging that message queue is space-time, the state of run switch is set to off closed state.
To achieve these goals, according to the another aspect of the application, there is provided one kind notifies dispensing device.The device
Including:Acquiring unit, for obtaining notice to be sent from message queue, wherein, all notices to be sent are advance
Added in message queue;First judging unit, for judging whether the quantity for sending thread is less than maximum concurrency,
Wherein, it is for performing the thread for notifying to send operation to send thread;And transmitting element, for judging to send
When the quantity of thread is less than maximum concurrency, new transmission thread is created, and send to be sent by new transmission thread
Notify.
Further, the device also includes:Second judging unit, for being not less than in the quantity for judging to send thread
During maximum concurrency, the first Preset Time is waited, whether rejudge the quantity for sending thread less than maximum concurrency.
Further, the device also includes:First detection unit, to be sent notice with the presence or absence of different is sent for detecting
Often;3rd judging unit, for when transmission notice to be sent is detected in the presence of exception, judging the hair of notice to be sent
Send whether number of times reaches preset value;Adding device, it is default for being not up in the transmission times for judging notice to be sent
During value, the transmission times of notice to be sent is added 1, and notice to be sent is added in message queue again;And
Output unit, during for reaching preset value in the transmission times for judging notice to be sent, records notice to be sent, and
Output abnormality information.
Further, the device also includes:Second detection unit, the state for detecting run switch, wherein, fortune
The state of row switch includes opening and closed mode, and opening is used to indicate to perform to notify to send operation, closes
State is used to indicate to stop performing to notify to send operation;And the 4th judging unit, for detecting at run switch
When opening, judge whether message queue is empty, wherein, it not is space-time message queue is judged, from message
Notice to be sent is obtained in queue, message queue is being judged for space-time, the second Preset Time of wait is rejudged and disappeared
Whether breath queue is empty.
The application by obtaining notice to be sent from message queue, wherein, it is all it is to be sent notice be added in advance
In message queue;Whether the quantity for sending thread is judged less than maximum concurrency, wherein, it is for performing to send thread
Notify to send the thread for operating;And when judging that the quantity for sending thread is less than maximum concurrency, create new hair
Line sending journey, and notice to be sent is sent by new transmission thread, the application is added in advance by by notice to be sent
Ranked in message queue, and determine whether to create by the way that the quantity of currently transmitted thread is compared with maximum concurrency
New transmission thread, causes to notify to send to block, solution such that it is able to avoid notifying server while being transmitted across many notices
The notice quantity of transmitted in parallel excessively causes to notify to send the problem for blocking in correlation technique of having determined, and then has reached and avoid
Notify to send the effect for blocking.
Brief description of the drawings
The accompanying drawing for constituting the part of the application is used for providing further understanding of the present application, the schematic reality of the application
Apply example and its illustrate for explaining the application, do not constitute the improper restriction to the application.In the accompanying drawings:
Fig. 1 is the flow chart of the notice sending method according to the embodiment of the present application;
Fig. 2 is the flow chart of the notice sending method according to the another embodiment of the application;And
Fig. 3 is the schematic diagram of the notice dispensing device according to the embodiment of the present application.
Specific embodiment
It should be noted that in the case where not conflicting, the feature in embodiment and embodiment in the application can phase
Mutually combination.Describe the application in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
In order that those skilled in the art more fully understand application scheme, below in conjunction with the embodiment of the present application
Accompanying drawing, is clearly and completely described to the technical scheme in the embodiment of the present application, it is clear that described embodiment
The only embodiment of the application part, rather than whole embodiments.Based on the embodiment in the application, ability
The every other embodiment that domain those of ordinary skill is obtained under the premise of creative work is not made, should all belong to
The scope of the application protection.
It should be noted that term " first ", " in the description and claims of this application and above-mentioned accompanying drawing
Two " it is etc. for distinguishing similar object, without for describing specific order or precedence.It should be appreciated that this
The data that sample is used can be exchanged in the appropriate case, so as to embodiments herein described herein.Additionally, term
" comprising " and " having " and their any deformation, it is intended that covering is non-exclusive to be included, for example, comprising
The process of series of steps or unit, method, system, product or equipment are not necessarily limited to those steps clearly listed
Rapid or unit, but may include not listing clearly or intrinsic for these processes, method, product or equipment
Other steps or unit.
According to the embodiment of the present application, there is provided a kind of notice sending method.Fig. 1 is the notice according to the embodiment of the present application
The flow chart of sending method, as shown in figure 1, the method includes steps S102 to step S106:
Step S102, obtains notice to be sent from message queue, wherein, all notices to be sent are added in advance
In message queue.
The notice to be sent of the embodiment of the present application can be mail, short message, qq information, wechat information etc., below this
Application embodiment is illustrated as a example by having mail to be sent.
The embodiment of the present application notifies to be ranked added in message queue by be sent in advance when needing to send notice.
Specifically, so that the timing of website data analysis system sends schedule report to user as an example, website data analysis system is being needed
When sending schedule report to user, then data in inquiry database are output data in report form template, are generated
Form, and be added in message queue according to report generation mail to be sent;Need to be sent to multiple users at the same time and report
During table, the corresponding form of each user is generated respectively, and respectively according to the multiple mails to be sent of each report generation, and
Multiple mails to be sent are added in message queue and are ranked.
The embodiment of the present application by notice to be sent in advance added to after in message queue, from message queue successively
Each notice to be sent is obtained to be transmitted.
Whether step S104, judge to send the quantity of thread less than maximum concurrency, wherein, it is for holding to send thread
Row notifies to send the thread of operation.
The maximum concurrency of the embodiment of the present application refers to the maximum quantity that can be notified with transmitted in parallel, and alternatively, maximum is simultaneously
The numerical value of hair degree can be configured according to the concurrency for notifying server to send notice, for example, when mail is sent,
The concurrency that mail server sends mail is 10, then the numerical value of maximum concurrency can be set into 10, such that it is able to most
The big utilization email sender for limiting, to improve mail transmitting efficiency.
Specifically, the quantity for sending thread can be counted, or be pre-created by setting a counter
One transmission sets of threads of sky, and it is maximum concurrency to limit the quantity of element in the transmission sets of threads, each
Create after sending thread, the transmission thread is added in transmission sets of threads, in transmission thread completion notice hair
The transmission thread is deleted from sets of threads is sent after sending, so as to send the number of transmission thread in sets of threads by counting
Amount can quickly obtain the quantity of currently transmitted thread.
The embodiment of the present application is by judging it is new to determine whether establishment whether the quantity for sending thread reaches maximum concurrency
Thread is sent to send notice, the notice such that it is able to avoid transmitted in parallel excessive causes to notify to send to block.
Step S106, when judging that the quantity for sending thread is less than maximum concurrency, creates new transmission thread, and
Notice to be sent is sent by new transmission thread.
Specifically, illustrated as a example by sending mail, when judging that the quantity for sending thread is less than maximum concurrency,
Illustrate that current mail server is not in peak load state, can now create new transmission thread, and it is new by this
Transmission thread by currently from message queue obtain mail to be sent send, judging send thread number
When amount is not less than maximum concurrency, that is, illustrate that current mail server is in peak load state, in order to avoid mail takes
Business device operation collapse, should not now create new transmission thread to send mail.Alternatively, judging to send line
When the quantity of journey is not less than maximum concurrency, the method also includes:The first Preset Time is waited, transmission line is rejudged
Whether the quantity of journey is less than maximum concurrency.
Due to sending thread when completion notice sends, resource can be automatically releasable, therefore, the quantity for sending thread is real
Shi Gengxin's, when currently judging that the quantity for sending thread is not less than maximum concurrency, when first can be waited to preset
Between (for example, wait 5 seconds), whether rejudge the quantity for sending thread less than maximum concurrency, repeat said process
Until the quantity for sending thread is less than maximum concurrency.
The embodiment of the present application by obtaining notice to be sent from message queue, wherein, it is all it is to be sent notify it is advance
Added in message queue;Whether the quantity for sending thread is judged less than maximum concurrency, wherein, it is use to send thread
In the thread for performing notice transmission operation;And when judging that the quantity for sending thread is less than maximum concurrency, create
New transmission thread, and notice to be sent is sent by new transmission thread, the application notifies advance by by be sent
Ranked added in message queue, and be by the way that the quantity of currently transmitted thread is compared into determination with maximum concurrency
It is no to create new transmission thread, cause to notify to send stifled while being transmitted across many notices such that it is able to avoid notifying server
Plug, solves the problems, such as that the notice quantity of transmitted in parallel in correlation technique excessively causes to notify to send to block, and then reach
Avoid notifying to send the effect for blocking.
Preferably, in order to avoid notifying to leak the problem of hair caused by notifying that transmission is abnormal, the number of transmission thread is being judged
When amount is less than maximum concurrency, new transmission thread is created, and after sending notice to be sent by new transmission thread,
The method also includes:Detection sends to be sent notice with the presence or absence of abnormal;And detecting that sending notice to be sent deposits
When abnormal, notice to be sent is added in message queue again.
Might not succeed due to sending notice every time, in order to avoid notifying leakage hair caused by notifying that transmission is abnormal
Problem, the embodiment of the present application detects that notice transmission to be sent whether there is different after by sending thread transmission notice
Often, for example, whether notice to be sent is successfully transmitted to posting address, detecting that it is abnormal that notice transmission to be sent is present
When, the notice to be sent is added in message queue again and requeues to send again, delete and send abnormal treating
Transmission notifies corresponding transmission thread.It should be noted that when detecting that notice to be sent sends successfully, Ke Yizhi
This to be sent notifies corresponding transmission thread to connect release.
The notice to be sent can be again added to transmission by the embodiment of the present application when each notice to be sent sends abnormal
Sent again in queue, such that it is able to avoid being notified caused by notifying to send exception the problem of leakage hair.
Preferably, in order to avoid notifying to leak the problem of hair caused by notifying that transmission is abnormal, the number of transmission thread is being judged
When amount is less than maximum concurrency, new transmission thread is created, and after sending notice to be sent by new transmission thread,
The method also includes:Detection sends to be sent notice with the presence or absence of abnormal;Detect send it is to be sent notice exist it is different
Chang Shi, judges whether the transmission times of notice to be sent reaches preset value;Judging the transmission times of notice to be sent
Not up to preset value when, the transmission times of notice to be sent is added 1, and by it is to be sent notice again be added to message team
In row;And when the transmission times for judging notice to be sent reaches preset value, notice to be sent is recorded, and export
Abnormal information.
Due to there are some notices, even if sending repeatedly or sending failure, for example, address error is sent, now,
It is undying repeat transmission can not solve problem, can take notice server resource on the contrary, influence notifies server hair
Send the efficiency of notice.In the embodiment of the present application, to notifying that transmission times is limited, send pending detecting
When sending notice to have abnormal, first determine whether whether the transmission times of the notice to be sent reaches preset value, for example, setting
Preset value is 3, if the transmission times of the notice to be sent is not reaching to preset value, by the notice to be sent again
Added in message queue, and it is sent to number of times and plus 1;If the transmission times of the notice to be sent has reached default
Value, then record the notice to be sent, and output abnormality information, so that operating personnel i.e. can be according to the abnormal information point
Analyse this it is to be sent notify the reason for sending failure, on the one hand the transmission notice to be sent that can be artificial can avoid this
Send abnormal notice to be sent and take notice server resource for a long time, on the other hand can also avoid notifying leakage hair completely
Problem.
It should be noted that the embodiment of the present application can be when notice to be sent every time sends and has abnormal, recording exceptional
Information, for example, record is in daily record, and to be sent notifies corresponding abnormal collection by each abnormal information added to this
In conjunction, when the transmission times of the notice to be sent reaches preset value, whole exceptions in anomaly association set are simultaneously exported.
Preferably, before notice to be sent is obtained from message queue, the method also includes:Detection run switch
State, wherein, the state of run switch includes opening and closed mode, and opening is used to indicate to perform notice
Operation is sent, closed mode is used to indicate to stop performing to notify to send operation;And opened detecting that run switch is in
When opening state, judge whether message queue is empty, wherein, it not is space-time message queue is judged, from message queue
It is middle to obtain notice to be sent, message queue is being judged for space-time, the second Preset Time of wait rejudges message team
Whether row are empty.
For the ease of the transmission that control is notified, the embodiment of the present application is provided with a run switch, is only opened in the operation
Close during in opening, the transmission operation that just execution is notified, therefore, when needing to send notice, it is necessary to first open
The run switch.
In the embodiment of the present application, obtained from message queue it is to be sent notice be transmitted before, first detect operation open
The state of pass, when detecting that run switch is in opening, illustrates now send notice, then continue to judge
Whether message queue is empty, wherein, it not is space-time message queue is judged, obtain to be sent logical from message queue
Know, judging message queue for space-time, the second Preset Time of wait, for example, 10 seconds, rejudge message queue
Whether it is empty;When detecting that run switch is closed, the run switch can be opened to send notice,
Can directly terminate.It should be noted that system can constantly add notice to be sent in preset time period
In adding to message queue, therefore, when run switch is in open mode, system not yet notifies to add by be sent
Into message queue, i.e., message queue is sky, at this point it is possible to wait the second Preset Time to rejudge message queue be
No is sky.
Preferably, it is added to after message queue by all notices to be sent, the method also includes:Judge message
Whether queue is empty;And judging that message queue is space-time, the state of run switch is set to off closed state.
Specifically, be added to after message queue all notices to be sent in completion by the embodiment of the present application, by sentencing
Disconnected message queue whether be sky end notification transmission, specifically, judging message queue for space-time, then from disappearing
Notice to be sent is taken in breath queue successively to be transmitted, not is space-time message queue is judged, i.e., current slot is needed
The notice all to be sent to be sent has sent, and now the state of run switch can be set to off into closed state, ties
Shu Tongzhi sends, such that it is able to avoid program dry running, occupying system resources.
Fig. 2 is the flow chart of the notice sending method according to the another embodiment of the application, as shown in Fig. 2 the method bag
Include following steps:
Step S201, opens run switch.
Step S202, creates and sends sets of threads.
The quantity for sending element in sets of threads is the quantity that maximum concurrency is specified.
The embodiment of the present application is started the cycle over by background thread and swept after transmission sets of threads is created by step S202
Retouch, each scanning step following steps S203 to step S219:
Step S203, judges whether run switch is opened.
Whether switch is allowed in opening.When judging to allow switch to open, step S204 is performed, otherwise
Terminate.
Step S204, judges whether message queue is empty.
Specifically, the embodiment of the present application can pre-define notification entity, comprising announcement information, transmission in notification entity
Number of times and abnormal set, wherein, announcement information includes sending address, notifies information such as (contents of i.e. specific transmission),
Transmission times refers to the transmission times of the notice to be sent, and the exception for recording notice to be sent is gathered extremely.Each
When needing to send notice, all first notification entity is added in message queue and is ranked.
The embodiment of the present application is judging message queue for space-time, illustrates do not have notification entity to need in current message queue
Send, perform step S205;It not is space-time message queue is judged, illustrates there is notice in fact in current message queue
Body needs to send, and performs step S206.
Step S205, waits 10 seconds.
Step S206, takes out a notification entity.
Step S207, whether transmission number of threads is less than maximum concurrency in judging to send sets of threads.
Specifically, when number of threads is sent in judging to send sets of threads not less than maximum concurrency, step is performed
S208, that is, wait 5 seconds, and whether transmission number of threads is less than maximum concurrency in rejudging transmission sets of threads;
Judging to send when send number of threads in sets of threads and being less than maximum concurrency, perform step S209.
Step S208, waits 5 seconds.
Step S209, creates new transmission thread.
Step S210, by new transmission thread added to transmission sets of threads.
Step S211, sends and notifies.
Start to send according to announcement information and notify.
Step S212, determines whether exception.
Judge to send and notify with the presence or absence of abnormal, for example, sending unsuccessfully etc..When judging to exist transmission exception,
Step S213 is performed, step S219 is otherwise performed.
Step S213, judges whether transmission times reaches maximum number of times of transmission.
When judging that transmission times reaches maximum number of times of transmission, step S214 is performed, judging that transmission times do not reach
During to maximum number of times of transmission, step S216 is performed.
Step S214, by unusual combination is into a new exception and dishes out in the abnormal set of notification entity.
Step S215, recording exceptional in daily record.
Step S216, transmission times adds 1.
Step S217, by the abnormal abnormal set added to notification entity.
Step S218, notification entity is re-added in message queue.
Step S219, will send thread and is deleted from sets of threads is sent.
After being sent completely, thread will be sent and deleted from sets of threads.
It should be noted that the embodiment of the present application is when by background thread scan round, while cycle criterion message team
Whether row are empty, are judging that message queue is space-time, and run switch is closed, and follow-up background scanning thread has been performed
After one cycle, check the run switch and be turned off, scanning thread will exit circulation.
Preferably, routine call for convenience, the embodiment of the present application can pre-define notification manager, in the notice
Following member defined in manager:Notify that context, context notify the common configuration of needs comprising sending;It is maximum
Concurrency;Notification entity queue;Send sets of threads;Whether run switch;Notification Method is sent, parameter is notice
Entity, be added to notification entity in notification entity queue by the method ranks.
As can be seen from the above description, postagram server mail send concurrency be it is very low, much
Demand can not be met, the high concurrent of mail is required in many places, the cause that can be solved using the embodiment of the present application
For system high concurrent and mail send it is low it is concurrent between contradiction, it is final to reduce the situation for sending mail contention for resources, and
So that actual mail transmission is in hgher efficiency.
It should be noted that can be in such as one group computer executable instructions the step of the flow of accompanying drawing is illustrated
Performed in computer system, and, although logical order is shown in flow charts, but in some cases, can
Shown or described step is performed with different from order herein.
According to the another aspect of the embodiment of the present application, there is provided one kind notifies dispensing device, the notice dispensing device can be with
Notice sending method for performing the embodiment of the present application, the notice sending method of the embodiment of the present application can also be by this
Apply for the notice dispensing device of embodiment to perform.
Fig. 3 is the schematic diagram of the notice dispensing device according to the embodiment of the present application, as shown in figure 3, the device includes:
Acquiring unit 10, the first judging unit 20 and transmitting element 30.
Acquiring unit 10, for obtaining notice to be sent from message queue, wherein, all notices to be sent are advance
Added in message queue.
First judging unit 20, for judging whether the quantity for sending thread is less than maximum concurrency, wherein, send line
Journey is for performing the thread for notifying to send operation.
Transmitting element 30, for when judging that the quantity for sending thread is less than maximum concurrency, creating new transmission line
Journey, and notice to be sent is sent by new transmission thread.
The application obtains notice to be sent by acquiring unit 10 from message queue, wherein, all notices to be sent are equal
It is added in message queue in advance;Whether first judging unit 20 judges to send the quantity of thread less than maximum concurrency,
Wherein, it is for performing the thread for notifying to send operation to send thread;And transmitting element 30 is being judged to send thread
Quantity when being less than maximum concurrency, create new transmission thread, and notice to be sent is sent by new transmission thread,
The application notified in advance added to ranking in message queue by by be sent, and by by currently transmitted thread
Quantity compares the transmission thread for determining whether that establishment is new with maximum concurrency, such that it is able to avoid notifying that server is sent out simultaneously
Pass through many notices to cause to notify to send to block, the notice quantity for solving transmitted in parallel in correlation technique excessively causes to lead to
Know the problem for sending and blocking, and then reach the effect for avoiding notifying to send blocking.
Alternatively, the device also includes:Second judging unit, for judging the quantity of transmission thread not less than most
During big concurrency, the first Preset Time is waited, whether rejudge the quantity for sending thread less than maximum concurrency.
Preferably, the device also includes:First detection unit, to be sent notice with the presence or absence of abnormal is sent for detecting;
3rd judging unit, for when transmission notice to be sent is detected in the presence of exception, judging the transmission time of notice to be sent
Whether number reaches preset value;Adding device, for when the transmission times not up to preset value of notice to be sent is judged,
The transmission times of notice to be sent is added 1, and notice to be sent is added in message queue again;And output is single
Unit, during for reaching preset value in the transmission times for judging notice to be sent, records notice to be sent, and export different
Normal information.
Preferably, the device also includes:Second detection unit, the state for detecting run switch, wherein, operation
The state of switch includes opening and closed mode, and opening is used to indicate to perform to notify to send operation, closes shape
State is used to indicate to stop performing to notify to send operation;And the 4th judging unit, for detecting that run switch is in
During opening, judge whether message queue is empty, wherein, it not is space-time message queue is judged, from message team
Notice to be sent is obtained in row, message queue is being judged for space-time, the second Preset Time of wait rejudges message
Whether queue is empty.
The notice dispensing device includes processor and memory, and above-mentioned acquiring unit, the first judging unit and transmission are single
Unit etc. stores in memory as program unit, by computing device storage said procedure unit in memory
To realize corresponding function.
Kernel is included in processor, is gone in memory to transfer corresponding program unit by kernel.Kernel can set one
Or more, notice is sent by adjusting kernel parameter.
Memory potentially includes the volatile memory in computer-readable medium, random access memory (RAM) and/
Or the form, such as read-only storage (ROM) or flash memory (flash RAM) such as Nonvolatile memory, memory includes at least one
Individual storage chip.
Present invention also provides a kind of computer program product, when being performed on data processing equipment, it is adapted for carrying out just
The program code of beginningization there are as below methods step:Notice to be sent is obtained from message queue, wherein, it is all to be sent
Notify to be added in message queue in advance;Whether the quantity for sending thread is judged less than maximum concurrency, wherein, hair
Line sending journey is for performing the thread for notifying to send operation;And judging that the quantity for sending thread is concurrent less than maximum
When spending, new transmission thread is created, and notice to be sent is sent by new transmission thread.
Above-mentioned the embodiment of the present application sequence number is for illustration only, and the quality of embodiment is not represented.
In above-described embodiment of the application, the description to each embodiment all emphasizes particularly on different fields, and does not have in certain embodiment
The part of detailed description, may refer to the associated description of other embodiment.
In several embodiments provided herein, it should be understood that disclosed technology contents, can be by other
Mode realize.Wherein, device embodiment described above is only schematical, such as division of described unit,
Can be a kind of division of logic function, there can be other dividing mode when actually realizing, for example multiple units or component
Can combine or be desirably integrated into another system, or some features can be ignored, or do not perform.It is another, institute
Display or the coupling each other for discussing or direct-coupling or communication connection can be by some interfaces, unit or mould
The INDIRECT COUPLING of block or communication connection, can be electrical or other forms.
The unit that is illustrated as separating component can be or may not be it is physically separate, it is aobvious as unit
The part for showing can be or may not be physical location, you can with positioned at a place, or can also be distributed to
On multiple units.Some or all of unit therein can be according to the actual needs selected to realize this embodiment scheme
Purpose.
In addition, during each functional unit in the application each embodiment can be integrated in a processing unit, it is also possible to
It is that unit is individually physically present, it is also possible to which two or more units are integrated in a unit.It is above-mentioned integrated
Unit can both be realized in the form of hardware, it would however also be possible to employ the form of SFU software functional unit is realized.
If the integrated unit is to realize in the form of SFU software functional unit and as independent production marketing or use
When, can store in a computer read/write memory medium.Based on such understanding, the technical scheme of the application
The part for substantially being contributed to prior art in other words or all or part of the technical scheme can be produced with software
The form of product is embodied, and the computer software product is stored in a storage medium, including some instructions are used to make
Obtain a computer equipment (can be personal computer, server or network equipment etc.) and perform each implementation of the application
The all or part of step of example methods described.And foregoing storage medium includes:USB flash disk, read-only storage (ROM,
Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk,
Magnetic disc or CD etc. are various can be with the medium of store program codes.
The above is only the preferred embodiment of the application, it is noted that for the ordinary skill people of the art
For member, on the premise of the application principle is not departed from, some improvements and modifications can also be made, these improve and moisten
Decorations also should be regarded as the protection domain of the application.
Claims (10)
1. a kind of notice sending method, it is characterised in that including:
Notice to be sent is obtained from message queue, wherein, all notices to be sent disappear added to described in advance
In breath queue;
Whether the quantity for sending thread is judged less than maximum concurrency, wherein, the transmission thread is for performing
Notify to send the thread for operating;And
When the quantity for judging the transmission thread is less than the maximum concurrency, new transmission thread is created,
And the notice to be sent is sent by the new transmission thread.
2. method according to claim 1, it is characterised in that be not less than in the quantity for judging the transmission thread
During the maximum concurrency, methods described also includes:The first Preset Time is waited, the transmission line is rejudged
Whether the quantity of journey is less than the maximum concurrency.
3. method according to claim 1, it is characterised in that be less than institute in the quantity for judging the transmission thread
When stating maximum concurrency, new transmission thread is created, and send described to be sent by the new transmission thread
After notice, methods described also includes:
Detection sends the notice to be sent with the presence or absence of abnormal;And
When detecting that sending the notice to be sent has abnormal, the notice to be sent is added to institute again
In stating message queue.
4. method according to claim 1, it is characterised in that be less than institute in the quantity for judging the transmission thread
When stating maximum concurrency, new transmission thread is created, and send described to be sent by the new transmission thread
After notice, methods described also includes:
Detection sends the notice to be sent with the presence or absence of abnormal;
When the transmission notice to be sent is detected in the presence of exception, the transmission times of the notice to be sent is judged
Whether preset value is reached;
When the transmission times for judging the notice to be sent is not up to the preset value, will be described to be sent logical
The transmission times known plus 1, and the notice to be sent is added in the message queue again;And
When the transmission times for judging the notice to be sent reaches the preset value, record described to be sent logical
Know, and output abnormality information.
5. method according to claim 1, it is characterised in that before notice to be sent is obtained from message queue,
Methods described also includes:
The state of run switch is detected, wherein, the state of the run switch includes opening and closed mode,
The opening is used to indicate to perform to notify to send operation, and the closed mode is used to indicate to stop performing notice
Send operation;And
When detecting that the run switch is in the opening, judge whether the message queue is sky,
Wherein, it not is space-time the message queue is judged, the notice to be sent is obtained from the message queue,
The message queue is being judged for space-time, and whether the second Preset Time of wait rejudges the message queue
It is sky.
6. method according to claim 5, it is characterised in that disappear added to described by all notices to be sent
After breath queue, methods described also includes:
Judge whether the message queue is empty;And
Judging that the message queue is space-time, the state of the run switch is being set to the closed mode.
7. it is a kind of to notify dispensing device, it is characterised in that including:
Acquiring unit, for obtaining notice to be sent from message queue, wherein, all notices to be sent are pre-
First it is added in the message queue;
First judging unit, for judging whether the quantity for sending thread is less than maximum concurrency, wherein, it is described
It is for performing the thread for notifying to send operation to send thread;And
Transmitting element, during for being less than the maximum concurrency in the quantity for judging the transmission thread, creates
New transmission thread, and the notice to be sent is sent by the new transmission thread.
8. device according to claim 7, it is characterised in that described device also includes:Second judging unit, uses
In when the quantity for judging the transmission thread is not less than the maximum concurrency, the first Preset Time is waited,
Whether the quantity of the transmission thread is rejudged less than the maximum concurrency.
9. device according to claim 7, it is characterised in that described device also includes:
First detection unit, the notice to be sent is sent with the presence or absence of abnormal for detecting;
3rd judging unit, for when the transmission notice to be sent is detected in the presence of exception, being treated described in judgement
Send whether the transmission times for notifying reaches preset value;
Adding device, during for being not up to the preset value in the transmission times for judging the notice to be sent,
The transmission times of the notice to be sent is added 1, and the notice to be sent is added to the message team again
In row;And
Output unit, during for reaching the preset value in the transmission times for judging the notice to be sent, note
Record the notice to be sent, and output abnormality information.
10. device according to claim 7, it is characterised in that described device also includes:
Second detection unit, the state for detecting run switch, wherein, the state of the run switch includes
Opening and closed mode, the opening are used to indicate to perform to notify to send operation, the closed mode
Notify to send operation for indicating to stop performing;And
4th judging unit, for when detecting that the run switch is in the opening, judging described
Whether message queue is empty, wherein, it not is space-time the message queue is judged, from the message queue
The notice to be sent is obtained, the message queue is being judged for space-time, the second Preset Time of wait, again
Judge whether the message queue is empty.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511021406.9A CN106936688B (en) | 2015-12-30 | 2015-12-30 | Notification sending method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201511021406.9A CN106936688B (en) | 2015-12-30 | 2015-12-30 | Notification sending method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106936688A true CN106936688A (en) | 2017-07-07 |
CN106936688B CN106936688B (en) | 2020-11-24 |
Family
ID=59442392
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201511021406.9A Active CN106936688B (en) | 2015-12-30 | 2015-12-30 | Notification sending method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106936688B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108494668A (en) * | 2018-04-03 | 2018-09-04 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus executing email processing jobs |
CN109039732A (en) * | 2018-07-26 | 2018-12-18 | 中国建设银行股份有限公司 | Message handling system and message treatment method |
CN110460534A (en) * | 2019-07-26 | 2019-11-15 | 腾讯云计算(北京)有限责任公司 | A kind of request message report method, device, equipment and storage medium |
CN110730168A (en) * | 2019-09-29 | 2020-01-24 | 佛山市兴颂机器人科技有限公司 | Communication control method and device and server equipment |
CN111245707A (en) * | 2020-01-08 | 2020-06-05 | 北京小米移动软件有限公司 | Mail transmission method, device, electronic equipment and storage medium |
CN114884906A (en) * | 2022-03-23 | 2022-08-09 | 晨贝(天津)技术有限公司 | Failure retry notification method and device based on quick recovery |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100347675C (en) * | 2004-06-29 | 2007-11-07 | 北京大学 | Property optimizing method for applying server |
CN104281489A (en) * | 2013-07-12 | 2015-01-14 | 携程计算机技术(上海)有限公司 | Multithreading request method and system under SOA (service oriented architecture) |
CN104407847A (en) * | 2014-10-29 | 2015-03-11 | 中国建设银行股份有限公司 | Batch processing method and device |
CN104462194A (en) * | 2014-10-28 | 2015-03-25 | 北京国双科技有限公司 | Service data processing method, device and server |
CN104572277A (en) * | 2014-12-17 | 2015-04-29 | 大唐移动通信设备有限公司 | Thread flow control method and thread flow control device |
-
2015
- 2015-12-30 CN CN201511021406.9A patent/CN106936688B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN100347675C (en) * | 2004-06-29 | 2007-11-07 | 北京大学 | Property optimizing method for applying server |
CN104281489A (en) * | 2013-07-12 | 2015-01-14 | 携程计算机技术(上海)有限公司 | Multithreading request method and system under SOA (service oriented architecture) |
CN104462194A (en) * | 2014-10-28 | 2015-03-25 | 北京国双科技有限公司 | Service data processing method, device and server |
CN104407847A (en) * | 2014-10-29 | 2015-03-11 | 中国建设银行股份有限公司 | Batch processing method and device |
CN104572277A (en) * | 2014-12-17 | 2015-04-29 | 大唐移动通信设备有限公司 | Thread flow control method and thread flow control device |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108494668A (en) * | 2018-04-03 | 2018-09-04 | 北京京东尚科信息技术有限公司 | A kind of method and apparatus executing email processing jobs |
CN109039732A (en) * | 2018-07-26 | 2018-12-18 | 中国建设银行股份有限公司 | Message handling system and message treatment method |
CN109039732B (en) * | 2018-07-26 | 2021-07-23 | 中国建设银行股份有限公司 | Message processing system and message processing method |
CN110460534A (en) * | 2019-07-26 | 2019-11-15 | 腾讯云计算(北京)有限责任公司 | A kind of request message report method, device, equipment and storage medium |
CN110460534B (en) * | 2019-07-26 | 2024-05-14 | 腾讯云计算(北京)有限责任公司 | Method, device, equipment and storage medium for reporting request message |
CN110730168A (en) * | 2019-09-29 | 2020-01-24 | 佛山市兴颂机器人科技有限公司 | Communication control method and device and server equipment |
CN111245707A (en) * | 2020-01-08 | 2020-06-05 | 北京小米移动软件有限公司 | Mail transmission method, device, electronic equipment and storage medium |
CN114884906A (en) * | 2022-03-23 | 2022-08-09 | 晨贝(天津)技术有限公司 | Failure retry notification method and device based on quick recovery |
CN114884906B (en) * | 2022-03-23 | 2024-05-17 | 贝壳找房(北京)科技有限公司 | Failure retry notification method and device based on quick recovery |
Also Published As
Publication number | Publication date |
---|---|
CN106936688B (en) | 2020-11-24 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106936688A (en) | Notice sending method and device | |
US11677704B1 (en) | Techniques for scam detection and prevention | |
CN107832126A (en) | The method of adjustment and its terminal of a kind of thread | |
CN108446362A (en) | Data cleansing processing method, device, computer equipment and storage medium | |
CN107819797B (en) | Access request processing method and device | |
Kostakos et al. | Modelling smartphone usage: a markov state transition model | |
MXPA06001211A (en) | End user data activation. | |
CN106101080A (en) | Page access control method and device | |
CN104123496B (en) | The hold-up interception method and device of a kind of rogue software, terminal | |
US20210286560A1 (en) | Dynamic queue management | |
US20180285432A1 (en) | Extracting and labeling custom information from log messages | |
CN109800131A (en) | Monitor processing method, device, computer equipment and the storage medium of Linux server | |
CN107644161A (en) | Safety detecting method, device and the equipment of sample | |
CN111651595A (en) | Abnormal log processing method and device | |
CN108647727A (en) | Unbalanced data classification lack sampling method, apparatus, equipment and medium | |
CN108366098B (en) | Data interaction method and device for network nodes | |
CN109902028A (en) | Automated testing method, device, equipment and the storage medium of ACL characteristic | |
CN112882797A (en) | Container safety detection method based on machine learning | |
CN106845215A (en) | Based on safety protecting method and device under virtualized environment | |
CN107623627A (en) | A kind of information replying method and device, terminal and readable storage medium storing program for executing | |
WO2023154149A1 (en) | Efficient usage of sandbox environments for malicious and benign documents with macros | |
CN107193721B (en) | Method and device for generating log | |
CN110033242A (en) | Working time determination method, device, equipment and medium | |
CN109062638A (en) | A kind of system component display methods, computer readable storage medium and terminal device | |
WO2021242687A1 (en) | Computer-implemented methods and systems for pre-analysis of emails for threat detection |
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 | ||
CB02 | Change of applicant information |
Address after: 100083 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing Applicant after: Beijing Guoshuang Technology Co.,Ltd. Address before: 100086 Cuigong Hotel, 76 Zhichun Road, Shuangyushu District, Haidian District, Beijing Applicant before: Beijing Guoshuang Technology Co.,Ltd. |
|
CB02 | Change of applicant information | ||
GR01 | Patent grant | ||
GR01 | Patent grant |