CN107133108A - Implementation method, terminal, server and the computer-readable recording medium of distributed complex lock - Google Patents
Implementation method, terminal, server and the computer-readable recording medium of distributed complex lock Download PDFInfo
- Publication number
- CN107133108A CN107133108A CN201710287547.8A CN201710287547A CN107133108A CN 107133108 A CN107133108 A CN 107133108A CN 201710287547 A CN201710287547 A CN 201710287547A CN 107133108 A CN107133108 A CN 107133108A
- Authority
- CN
- China
- Prior art keywords
- lock
- competitive resource
- containing single
- terminal
- locks
- 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/52—Program synchronisation; Mutual exclusion, e.g. by means of semaphores
- G06F9/526—Mutual exclusion algorithms
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
Abstract
The invention discloses implementation method, terminal, server and the computer-readable recording medium of a kind of distributed complex lock, the method comprising the steps of:Terminal to server sends the complicated lock containing multiple competitive resources and obtains request;Complicated lock containing multiple competitive resources is obtained request by server, is split into multiple locks containing single competitive resource and is obtained request, and sending all locks containing single competitive resource to terminal obtains successful response;All locks containing single competitive resource that terminal the reception server is sent obtain successful response, obtain all locks containing single competitive resource.The present invention is multiple monolocks by splitting complicated lock, meets the simultaneously operating to multiple competitive resources;The unique lock of each competitive resource correspondence one, reaching can support to operate while different types of competitive resource;By the way of lock is monitored, improve the efficiency for again attempting to obtain lock and save system resource.
Description
Technical field
The present invention relates to communication technical field, more particularly to the implementation method of distributed complex lock a kind of, terminal, server
And computer-readable recording medium.
Background technology
With the fast development of mobile communication and mobile Internet, substantial amounts of user is interconnected using mobile Internet
The access process of network service, so, the load pressure of the concurrent processing of magnanimity is just generated to the service end of mobile Internet business
Power.In order to meet the performance requirement of high concurrent, the framework of the service end of Internet service uses distributed type assemblies, meanwhile,
Service end has ability extending transversely.And in distributed server architecture, how to ensure between multiple servers
The locking of resource contention is processed into for primary problems faced.
During the present invention is realized, inventor has found that prior art has problems with:Prior art both for
The scheme that single competitive resource is locked, when an operation needs to operate multiple competitive resources simultaneously, existing scheme can not be met
Business demand.
The content of the invention
It is a primary object of the present invention to propose a kind of implementation method, terminal, server and the calculating of distributed complex lock
Machine readable storage medium storing program for executing, it is intended to solve the problem of prior art is present.
To achieve the above object, first aspect of the embodiment of the present invention provides a kind of implementation method of distributed complex lock, institute
Stating method includes step:
Terminal to server sends the complicated lock containing multiple competitive resources and obtains request;
The server receives the complicated lock acquisition request that the terminal is sent, and the complexity containing multiple competitive resources is locked
Request is obtained, multiple locks containing single competitive resource is split into and obtains request;
The server sends all locks containing single competitive resource to the terminal and obtains successful response;
The terminal receives all successful responses of locks acquisition containing single competitive resource that the server is sent, and obtains
Take all locks containing single competitive resource.
Further, server described in the step sends all locks containing single competitive resource to the terminal and obtained
Successfully response includes:
Attempt to obtain a lock in multiple locks containing single competitive resource, and judge whether to get the multiple contain
There is a lock in the lock of single competitive resource;
If getting a lock in the multiple lock containing single competitive resource, judge all containing single competition
Whether the lock of resource obtains success;If all locks containing single competitive resource are obtained successfully, send all to the terminal
Lock containing single competitive resource obtains successful response;If all locks containing single competitive resource do not obtain success,
Continue executing with step and attempt to obtain a lock in multiple locks containing single competitive resource, and judge whether to get described many
A lock in the individual lock containing single competitive resource;
If not getting a lock in the multiple lock containing single competitive resource, all got is discharged
Lock;A lock in the multiple lock containing single competitive resource is monitored, if listening to the multiple containing list
A lock in the lock of individual competitive resource has been released, then continues executing with step and attempt to obtain multiple containing single competitive resource
A lock in lock, and judge whether to get one in the multiple lock containing single competitive resource lock.
Further, methods described also includes step:
The terminal-pair competitive resource is operated, and operated it is rear to the server send release it is all containing
The lock request of single competitive resource.
Further, the complicated lock, which obtains request, includes complicated lock effective time;Methods described also includes step:
The server judges whether the complicated lock effective time has reached, if the complicated lock effective time has been arrived
Reach, then delete the complicated lock.
In addition, to achieve the above object, second aspect of the embodiment of the present invention provides a kind of terminal, the terminal includes storage
Distributed complex lock that device, processor and being stored in can be run on the memory and on the processor realizes program,
What the distributed complex was locked realizes following steps when realizing program by the computing device:
The complicated lock containing multiple competitive resources, which is sent, to server obtains request;
All successful responses of locks acquisition containing single competitive resource that the server is sent are received, all contains is obtained
There is the lock of single competitive resource;
Wherein, the server receives the complicated lock acquisition request that the terminal is sent, and will contain multiple competitive resources
Complexity lock obtains request and splits into multiple locks acquisition requests containing single competitive resource;Transmission is all to contain single competitive resource
Lock obtain successful response.
Further, what the distributed complex was locked is additionally operable to realize following step when realizing program by the computing device
Suddenly:
Competitive resource is operated, and discharges all containing single competition in rear sent to the server operated
The lock request of resource.
Further, the complicated lock, which obtains request, includes complicated lock effective time.
Further, what the distributed complex was locked is additionally operable to realize following step when realizing program by the computing device
Suddenly:
When successfully getting all locks containing single competitive resource, all by acquisition contain single competitive resource
Lock share competitive resource.
In addition, to achieve the above object, the third aspect of the embodiment of the present invention provides a kind of server, the server includes
Distributed complex lock that memory, processor and being stored in can be run on the memory and on the processor realizes journey
Sequence, what the distributed complex was locked realizes following steps when realizing program by the computing device:
The complicated lock containing multiple competitive resources that receiving terminal is sent obtains request;
Complicated lock of the reception containing multiple competitive resources obtained into request, is split into multiple containing single competitive resource
Lock obtains request;
All locks containing single competitive resource, which are sent, to the terminal obtains successful response.
Furthermore, to achieve the above object, fourth aspect of the embodiment of the present invention provides a kind of computer-readable recording medium, institute
The program of realizing for the distributed complex lock that is stored with computer-readable recording medium is stated, what the distributed complex was locked realizes program
The step of implementation method of upper described distributed complex lock is realized when being executed by processor.
Implementation method, terminal, server and the computer-readable storage of distributed complex lock provided in an embodiment of the present invention
Medium, is multiple monolocks by splitting complicated lock, meets the simultaneously operating to multiple competitive resources;Each competitive resource correspondence
One unique lock, reaching can support to operate while different types of competitive resource;By the way of lock is monitored, improve again
The secondary efficiency for attempting to obtain lock and saving system resource.
Brief description of the drawings
Fig. 1 is the hardware architecture diagram for the mobile terminal for realizing each embodiment of the invention;
Fig. 2 is a kind of communications network system Organization Chart provided in an embodiment of the present invention;
The implementation method schematic flow sheet that Fig. 3 locks for the distributed complex of first embodiment of the invention;
Responding process schematic diagram in the implementation method that Fig. 4 locks for the distributed complex of first embodiment of the invention;
Another schematic flow sheet of implementation method that Fig. 5 locks for the distributed complex of first embodiment of the invention;
Fig. 6 is the terminal structure schematic diagram of second embodiment of the invention;
Fig. 7 is the server architecture schematic diagram of third embodiment of the invention.
The realization, functional characteristics and advantage of the object of the invention will be described further referring to the drawings in conjunction with the embodiments.
Embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
In follow-up description, the suffix using such as " module ", " part " or " unit " for representing element is only
Be conducive to the explanation of the present invention, itself there is no a specific meaning.Therefore, " module ", " part " or " unit " can be mixed
Ground is used.
Terminal can be implemented in a variety of manners.For example, the terminal described in the present invention can include such as mobile phone, flat board
Computer, notebook computer, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portable
Media player (Portable Media Player, PMP), guider, wearable device, Intelligent bracelet, pedometer etc. are moved
Move the fixed terminals such as terminal, and numeral TV, desktop computer.
It will be illustrated in subsequent descriptions by taking mobile terminal as an example, it will be appreciated by those skilled in the art that except special
Outside element for moving purpose, construction according to the embodiment of the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, its hardware architecture diagram for a kind of mobile terminal of realization each embodiment of the invention, the shifting
Dynamic terminal 100 can include:RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit
103rd, A/V (audio/video) input block 104, sensor 105, display unit 106, user input unit 107, interface unit
108th, the part such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 1
Mobile terminal structure does not constitute the restriction to mobile terminal, and mobile terminal can be included than illustrating more or less parts,
Either combine some parts or different parts arrangement.
The all parts of mobile terminal are specifically introduced with reference to Fig. 1:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, the reception and transmission of signal, specifically, by base station
Downlink information receive after, handled to processor 110;In addition, up data are sent into base station.Generally, radio frequency unit 101
Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetrating
Frequency unit 101 can also be communicated by radio communication with network and other equipment.Above-mentioned radio communication can use any communication
Standard or agreement, including but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunications
System), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (Code
Division Multiple Access 2000, CDMA 2000), WCDMA (Wideband Code Division
Multiple Access, WCDMA), TD-SCDMA (Time Division-Synchronous Code
Division Multiple Access, TD SDMA), FDD-LTE (Frequency Division
Duplexing-Long Term Evolution, FDD Long Term Evolution) and TDD-LTE (Time Division
Duplexing-Long Term Evolution, time division duplex Long Term Evolution) etc..
WiFi belongs to short range wireless transmission technology, and mobile terminal can help user's transmitting-receiving electricity by WiFi module 102
Sub- mail, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 1 shows
Go out WiFi module 102, but it is understood that, it is simultaneously not belonging to must be configured into for mobile terminal, completely can be according to need
To be omitted in the essential scope for do not change invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 1 00
When under the isotypes such as formula, speech recognition mode, broadcast reception mode, it is that radio frequency unit 101 or WiFi module 102 are received or
The voice data stored in memory 109 is converted into audio signal and is output as sound.Moreover, audio output unit 103
The audio output related to the specific function that mobile terminal 1 00 is performed can also be provided (for example, call signal receives sound, disappeared
Breath receives sound etc.).Audio output unit 103 can include loudspeaker, buzzer etc..
A/V input blocks 104 are used to receive audio or video signal.A/V input blocks 104 can include graphics processor
(Graphics Processing Unit, GPU) 1041 and microphone 1042,1041 pairs of graphics processor is in video acquisition mode
Or the view data progress of the static images or video obtained in image capture mode by image capture apparatus (such as camera)
Reason.Picture frame after processing may be displayed on display unit 106.Picture frame after being handled through graphics processor 1041 can be deposited
Storage is transmitted in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.Mike
Wind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042
Quiet down sound (voice data), and can be voice data by such acoustic processing.Audio (voice) data after processing can
To be converted to the form output that mobile communication base station can be sent to via radio frequency unit 101 in the case of telephone calling model.
Microphone 1042 can implement various types of noises and eliminate (or suppression) algorithm to eliminate (or suppression) in reception and send sound
The noise produced during frequency signal or interference.
Mobile terminal 1 00 also includes at least one sensor 105, such as optical sensor, motion sensor and other biographies
Sensor.Specifically, optical sensor includes ambient light sensor and proximity transducer, wherein, ambient light sensor can be according to environment
The light and shade of light adjusts the brightness of display panel 1061, and proximity transducer can close when mobile terminal 1 00 is moved in one's ear
Display panel 1061 and/or backlight.As one kind of motion sensor, accelerometer sensor can detect in all directions (general
For three axles) size of acceleration, size and the direction of gravity are can detect that when static, the application available for identification mobile phone posture
(such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, percussion) etc.;
The fingerprint sensor that can also configure as mobile phone, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer,
The other sensors such as hygrometer, thermometer, infrared ray sensor, will not be repeated here.
Display unit 106 is used for the information for showing the information inputted by user or being supplied to user.Display unit 106 can be wrapped
Display panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be used
Forms such as (Organic Light-Emitting Diode, OLED) configures display panel 1061.
User input unit 107 can be used for the numeral or character information for receiving input, and produce the use with mobile terminal
The key signals input that family is set and function control is relevant.Specifically, user input unit 107 may include contact panel 1071 with
And other input equipments 1072.Contact panel 1071, also referred to as touch-screen, collect touch operation of the user on or near it
(such as user is using any suitable objects such as finger, stylus or annex on contact panel 1071 or in contact panel 1071
Neighbouring operation), and corresponding attachment means are driven according to formula set in advance.Contact panel 1071 may include touch detection
Two parts of device and touch controller.Wherein, touch detecting apparatus detects the touch orientation of user, and detects touch operation band
The signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by it
It is converted into contact coordinate, then gives processor 110, and the order sent of reception processing device 110 and can be performed.In addition, can
To realize contact panel 1071 using polytypes such as resistance-type, condenser type, infrared ray and surface acoustic waves.Except contact panel
1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can be wrapped
Include but be not limited to physical keyboard, in function key (such as volume control button, switch key etc.), trace ball, mouse, action bars etc.
One or more, do not limit herein specifically.
Further, contact panel 1071 can cover display panel 1061, detect thereon when contact panel 1071 or
After neighbouring touch operation, processor 110 is sent to determine the type of touch event, with preprocessor 110 according to touch thing
The type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, contact panel 1071 and display panel
1061 be input and the output function that mobile terminal is realized as two independent parts, but in certain embodiments, can
By contact panel 1071 and the input that is integrated and realizing mobile terminal of display panel 1061 and output function, not do specifically herein
Limit.
Interface unit 108 is connected the interface that can pass through as at least one external device (ED) with mobile terminal 1 00.For example,
External device (ED) can include wired or wireless head-band earphone port, external power source (or battery charger) port, wired or nothing
Line FPDP, memory card port, the port for connecting the device with identification module, audio input/output (I/O) end
Mouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, number
It is believed that breath, electric power etc.) and the input received is transferred to one or more elements in mobile terminal 1 00 or can be with
For transmitting data between mobile terminal 1 00 and external device (ED).
Memory 109 can be used for storage software program and various data.Memory 109 can mainly include storing program area
And storage data field, wherein, application program (the such as sound that storing program area can be needed for storage program area, at least one function
Sound playing function, image player function etc.) etc.;Storage data field can be stored uses created data (such as according to mobile phone
Voice data, phone directory etc.) etc..In addition, memory 109 can include high-speed random access memory, it can also include non-easy
The property lost memory, for example, at least one disk memory, flush memory device or other volatile solid-state parts.
Processor 110 is the control centre of mobile terminal, utilizes each of various interfaces and the whole mobile terminal of connection
Individual part, by operation or performs and is stored in software program and/or module in memory 109, and calls and be stored in storage
Data in device 109, perform the various functions and processing data of mobile terminal, so as to carry out integral monitoring to mobile terminal.Place
Reason device 110 may include one or more processing units;It is preferred that, processor 110 can integrated application processor and modulatedemodulate mediate
Device is managed, wherein, application processor mainly handles operating system, user interface and application program etc., and modem processor is main
Handle radio communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110.
Mobile terminal 1 00 can also include the power supply 111 (such as battery) powered to all parts, it is preferred that power supply 111
Can be logically contiguous by power-supply management system and processor 110, so as to realize management charging by power-supply management system, put
The function such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 1 00 can also will not be repeated here including bluetooth module etc..
For the ease of understanding the embodiment of the present invention, the communications network system that the mobile terminal of the present invention is based on is entered below
Row description.
Referring to Fig. 2, Fig. 2 is a kind of communications network system Organization Chart provided in an embodiment of the present invention, the communication network system
Unite as the LTE system of universal mobile communications technology, UE (User Equipment, use of the LTE system including communicating connection successively
Family equipment) 201, E-UTRAN (Evolved UMTS Terrestrial Radio Access Network, evolved UMTS lands
Ground wireless access network) 202, EPC (Evolved Packet Core, evolved packet-based core networks) 203 and operator IP operation
204。
Specifically, UE201 can be above-mentioned terminal 100, and here is omitted.
E-UTRAN202 includes eNodeB2021 and other eNodeB2022 etc..Wherein, eNodeB2021 can be by returning
Journey (backhaul) (such as X2 interface) is connected with other eNodeB2022, and eNodeB2021 is connected to EPC203,
ENodeB2021 can provide UE201 to EPC203 access.
EPC203 can include MME (Mobility Management Entity, mobility management entity) 2031, HSS
(Home Subscriber Server, home subscriber server) 2032, other MME2033, SGW (Serving Gate Way,
Gateway) 2034, PGW (PDN Gate Way, grouped data network gateway) 2035 and PCRF (Policy and
Charging Rules Function, policy and rate functional entity) 2036 etc..Wherein, MME2031 be processing UE201 and
There is provided carrying and connection management for the control node of signaling between EPC203.HSS2032 is all to manage for providing some registers
Such as function of attaching position register (not shown) etc, and some are preserved about the use such as service features, data rate
The special information in family.All customer data can be transmitted by SGW2034, and PGW2035 can provide UE 201 IP
Address is distributed and other functions, and PCRF2036 is strategy and the charging control strategic decision-making of business data flow and IP bearing resources
Point, it selects and provided available strategy and charging control decision-making with charge execution function unit (not shown) for strategy.
IP operation 204 can include internet, Intranet, IMS (IP Multimedia Subsystem, IP multimedia
System) or other IP operations etc..
Although above-mentioned be described by taking LTE system as an example, those skilled in the art it is to be understood that the present invention not only
Suitable for LTE system, be readily applicable to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA with
And following new network system etc., do not limit herein.
Based on above-mentioned mobile terminal hardware configuration and communications network system, each embodiment of the inventive method is proposed.
First embodiment
As shown in figure 3, a kind of implementation method for distributed complex lock that first embodiment of the invention is provided, this method includes
Step:
30th, terminal to server sends the complicated lock containing multiple competitive resources and obtains request.
31st, the complicated lock that server receiving terminal is sent obtains request, and the complicated lock containing multiple competitive resources is obtained
Request, splits into multiple locks containing single competitive resource and obtains request.
In the present embodiment, it is multiple monolocks by splitting complicated lock, the simultaneously operating to multiple competitive resources can be met.
32nd, server sends all locks containing single competitive resource to terminal and obtains successful response.
It refer to shown in Fig. 4, in the present embodiment, step 32 specifically includes:
320th, attempt to obtain a lock in multiple locks containing single competitive resource, and judge whether to get multiple contain
There is a lock in the lock of single competitive resource;
If the 321, getting a lock in multiple locks containing single competitive resource, judge all containing single competition
Whether the lock of resource obtains success;
If the 322, all locks containing single competitive resource are obtained successfully, send all containing single competition money to terminal
The lock in source obtains successful response;
If all locks containing single competitive resource do not obtain success, continue executing with step attempt obtain it is multiple containing
A lock in the lock of single competitive resource, and judge whether to get one in the multiple lock containing single competitive resource
Individual lock;
If the 323, not getting a lock in the multiple lock containing single competitive resource, all obtained is discharged
The lock got;
324th, a lock in multiple locks containing single competitive resource is monitored;
If the 325, listening to one in the multiple lock containing single competitive resource lock to be released, continue executing with
Step attempts to obtain a lock in multiple locks containing single competitive resource, and judges whether to get multiple containing single competing
The lock striven in the lock of resource.
Further, if the lock not listened in multiple locks containing single competitive resource has been released, after
It is continuous that a lock in multiple locks containing single competitive resource is monitored.
In the present embodiment, by the way of lock is monitored, the efficiency for again attempting to obtain lock and saving system money can be improved
Source.
33rd, all locks containing single competitive resource that terminal the reception server is sent obtain successful response, obtain institute
There is the lock containing single competitive resource.
In the present embodiment, the unique lock of each competitive resource correspondence one, reaching can support different types of competing
Operated while striving resource.
It please check shown in Fig. 5, in another embodiment, this method also includes step:
34th, terminal-pair competitive resource is operated, and discharges all containing single in rear sent to server operated
The lock request of competitive resource.
Please check again shown in Fig. 5, in another embodiment, complexity lock, which obtains request, includes complicated lock effective time;
This method also includes step:
35th, server judges whether complicated lock effective time has reached, if complicated lock effective time has been reached, deletes multiple
Miscellaneous lock.
When the complicated lock that usual server receives terminal obtains request, unblock can be normally carried out.And when the program of terminal
When operation goes wrong and sends request without normal direction server, server can also be according to the effective time, in lock effective time
During arrival, then complexity lock is deleted to discharge the resource of terminal occupancy, other-end is distributed to and uses.
The implementation method of distributed complex lock provided in an embodiment of the present invention, is multiple monolocks by splitting complicated lock, full
Simultaneously operating of the foot to multiple competitive resources;The unique lock of each competitive resource correspondence one, inhomogeneity can be supported by reaching
Operated while the competitive resource of type;By the way of lock is monitored, the efficiency and saving system that raising again attempts to obtain lock are provided
Source.
Second embodiment
A kind of reference picture 6, terminal that Fig. 6 provides for second embodiment of the invention, terminal 40 includes memory 41, processor
42 and be stored in the distributed complex lock that can run on the memory 41 and on the processor 42 realize program, it is described
What distributed complex was locked realizes following steps when realizing program by the computing device:
The complicated lock containing multiple competitive resources, which is sent, to server obtains request;
All successful responses of locks acquisition containing single competitive resource that the server is sent are received, all contains is obtained
There is the lock of single competitive resource;
Wherein, the server receives the complicated lock acquisition request that the terminal is sent, and will contain multiple competitive resources
Complexity lock obtains request and splits into multiple locks acquisition requests containing single competitive resource;Transmission is all to contain single competitive resource
Lock obtain successful response.
In the present embodiment, server is multiple monolocks by splitting complicated lock, can be met to the same of multiple competitive resources
Step operation.
As illustratively, server sends all locks containing single competitive resource to terminal and obtains successful response, can
Comprise the following steps:
Attempt to obtain a lock in multiple locks containing single competitive resource, and judge whether to get multiple containing list
A lock in the lock of individual competitive resource;
If getting a lock in multiple locks containing single competitive resource, judge all containing single competitive resource
Lock whether obtain success;
If all locks containing single competitive resource are obtained successfully, send all containing single competitive resource to terminal
Lock obtains successfully response;
If all locks containing single competitive resource do not obtain success, continue executing with step attempt obtain it is multiple containing
A lock in the lock of single competitive resource, and judge whether to get one in the multiple lock containing single competitive resource
Individual lock;
If not getting a lock in the multiple lock containing single competitive resource, all got is discharged
Lock;
A lock in multiple locks containing single competitive resource is monitored;
If listening to one in the multiple lock containing single competitive resource lock to be released, step is continued executing with
Attempt to obtain a lock in multiple locks containing single competitive resource, and judge whether to get multiple containing single competition money
A lock in the lock in source.
Further, if the lock not listened in multiple locks containing single competitive resource has been released, after
It is continuous that a lock in multiple locks containing single competitive resource is monitored.By the way of lock is monitored, it can improve and taste again
Examination obtains the efficiency of lock and saves system resource.
In one embodiment, the realizing for distributed complex lock is additionally operable to when program is performed by the processor 42
Realize following steps:
Competitive resource is operated, and discharges all containing single competition in rear sent to the server operated
The lock request of resource.
In another embodiment, the complicated lock, which obtains request, includes complicated lock effective time.
When the complicated lock that usual server receives terminal obtains request, unblock can be normally carried out.And when the program of terminal
When operation goes wrong and sends request without normal direction server, server can also be according to the effective time, in lock effective time
During arrival, then complexity lock is deleted to discharge the resource of terminal occupancy, other-end is distributed to and uses.
In another embodiment, the realizing for distributed complex lock is also used when program is performed by the processor 42
In realizing following steps:
When successfully getting all locks containing single competitive resource, all by acquisition contain single competitive resource
Lock share competitive resource.
Terminal provided in an embodiment of the present invention, is multiple monolocks by splitting complicated lock, meets to multiple competitive resources
Simultaneously operating;The unique lock of each competitive resource correspondence one, reaches while can support different types of competitive resource
Operation;By the way of lock is monitored, improve the efficiency for again attempting to obtain lock and save system resource.
3rd embodiment
As shown in fig. 7, a kind of server that Fig. 7 provides for third embodiment of the invention, the server 50 includes storage
Device 51, processor 52 and the reality for being stored in the distributed complex lock that can be run on the memory 51 and on the processor 52
Existing program, the realizing for distributed complex lock realizes following steps when program is performed by the processor 52:
The complicated lock containing multiple competitive resources that receiving terminal is sent obtains request;
Complicated lock of the reception containing multiple competitive resources obtained into request, is split into multiple containing single competitive resource
Lock obtains request;
In the present embodiment, it is multiple monolocks by splitting complicated lock, the simultaneously operating to multiple competitive resources can be met.
All locks containing single competitive resource, which are sent, to the terminal obtains successful response.
In one embodiment, the realizing for distributed complex lock is additionally operable to when program is performed by the processor 52
Realize following steps:
Attempt to obtain a lock in multiple locks containing single competitive resource, and judge whether to get the multiple contain
There is a lock in the lock of single competitive resource;
If getting a lock in the multiple lock containing single competitive resource, judge all containing single competition
Whether the lock of resource obtains success;If all locks containing single competitive resource are obtained successfully, send all to the terminal
Lock containing single competitive resource obtains successful response;If all locks containing single competitive resource do not obtain success,
Continue executing with step and attempt to obtain a lock in multiple locks containing single competitive resource, and judge whether to get described many
A lock in the individual lock containing single competitive resource;
If not getting a lock in the multiple lock containing single competitive resource, all got is discharged
Lock;A lock in the multiple lock containing single competitive resource is monitored, if listening to the multiple containing list
A lock in the lock of individual competitive resource has been released, then continues executing with step and attempt to obtain multiple containing single competitive resource
A lock in lock, and judge whether to get one in the multiple lock containing single competitive resource lock.
Further, if the lock not listened in multiple locks containing single competitive resource has been released, after
It is continuous that a lock in multiple locks containing single competitive resource is monitored.
In the present embodiment, by the way of lock is monitored, the efficiency for again attempting to obtain lock and saving system money can be improved
Source.
In another embodiment, the realizing for distributed complex lock is also used when program is performed by the processor 52
In realizing following steps:
Complexity lock, which obtains request, includes complicated lock effective time;Judge whether complicated lock effective time has reached, if complicated
Lock effective time has been reached, then deletes complicated lock.
When the complicated lock that usual server receives terminal obtains request, unblock can be normally carried out.And when the program of terminal
When operation goes wrong and sends request without normal direction server, server can also be according to the effective time, in lock effective time
During arrival, then complexity lock is deleted to discharge the resource of terminal occupancy, other-end is distributed to and uses.
Server provided in an embodiment of the present invention, is multiple monolocks by splitting complicated lock, meets to multiple competitive resources
Simultaneously operating;The unique lock of each competitive resource correspondence one, the same of different types of competitive resource can be supported by reaching
When operate;By the way of lock is monitored, improve the efficiency for again attempting to obtain lock and save system resource.
Fourth embodiment
Fourth embodiment of the embodiment of the present invention provides a kind of computer-readable recording medium, the computer-readable storage medium
What the distributed complex that is stored with matter was locked realizes program, and the realizing for distributed complex lock is realized when program is executed by processor
The step of implementation method of distributed complex lock described in first embodiment.
Computer-readable recording medium provided in an embodiment of the present invention, is multiple monolocks, satisfaction pair by splitting complicated lock
The simultaneously operating of multiple competitive resources;The unique lock of each competitive resource correspondence one, reaching can support different types of
Operated while competitive resource;By the way of lock is monitored, improve the efficiency for again attempting to obtain lock and save system resource.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-row
His property is included, so that process, method, article or device including a series of key elements not only include those key elements, and
And also including other key elements being not expressly set out, or also include for this process, method, article or device institute inherently
Key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including this
Also there is other identical element in process, method, article or the device of key element.
The embodiments of the present invention are for illustration only, and the quality of embodiment is not represented.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Understood based on such, technical scheme is substantially done to prior art in other words
Going out the part of contribution can be embodied in the form of software product, and the computer software product is stored in a storage medium
In (such as ROM/RAM, magnetic disc, CD), including some instructions are to cause a station terminal (can be mobile phone, computer, service
Device, air conditioner, or network equipment etc.) perform method described in each of the invention embodiment.
Embodiments of the invention are described above in conjunction with accompanying drawing, but the invention is not limited in above-mentioned specific
Embodiment, above-mentioned embodiment is only schematical, rather than restricted, one of ordinary skill in the art
Under the enlightenment of the present invention, in the case of present inventive concept and scope of the claimed protection is not departed from, it can also make a lot
Form, these are belonged within the protection of the present invention.
Claims (10)
1. a kind of implementation method of distributed complex lock, methods described includes step:
Terminal to server sends the complicated lock containing multiple competitive resources and obtains request;
The server receives the complicated lock acquisition request that the terminal is sent, and the complicated lock containing multiple competitive resources is obtained
Request, splits into multiple locks containing single competitive resource and obtains request;
The server sends all locks containing single competitive resource to the terminal and obtains successful response;
The terminal receives all successful responses of locks acquisition containing single competitive resource that the server is sent, and obtains institute
There is the lock containing single competitive resource.
2. the implementation method of a kind of distributed complex lock according to claim 1, it is characterised in that taken described in the step
Business device sends all locks containing single competitive resource and obtain successfully to respond to the terminal to be included:
Attempt to obtain a lock in multiple locks containing single competitive resource, and judge whether to get the multiple containing list
A lock in the lock of individual competitive resource;
If getting a lock in the multiple lock containing single competitive resource, judge all containing single competitive resource
Lock whether obtain success;If all locks containing single competitive resource obtain successfully, to the terminal send it is all containing
The lock of single competitive resource obtains successful response;If all locks containing single competitive resource do not obtain success, continue
A lock in the multiple locks containing single competitive resource of step trial acquisition is performed, and judges whether to get the multiple contain
There is a lock in the lock of single competitive resource;
If do not get one in the multiple lock containing single competitive resource lock, all got is discharged
Lock;A lock in the multiple lock containing single competitive resource is monitored, if listening to the multiple containing single
A lock in the lock of competitive resource has been released, then continues executing with step and attempt to obtain multiple locks containing single competitive resource
In a lock, and judge whether to get one in the multiple lock containing single competitive resource lock.
3. the implementation method of a kind of distributed complex lock according to claim 1, it is characterised in that methods described also includes
Step:
The terminal-pair competitive resource is operated, and discharges all containing single in rear sent to the server operated
The lock request of competitive resource.
4. the implementation method of a kind of distributed complex lock according to claim 1, it is characterised in that the complicated lock is obtained
Request includes complicated lock effective time;Methods described also includes step:
The server judges whether the complicated lock effective time has reached, if the complicated lock effective time has been reached,
Delete the complicated lock.
5. a kind of terminal, the terminal includes memory, processor and is stored on the memory and can be in the processor
What the distributed complex of upper operation was locked realizes program, and what the distributed complex was locked realizes program by real during the computing device
Existing following steps:
The complicated lock containing multiple competitive resources, which is sent, to server obtains request;
All successful responses of locks acquisition containing single competitive resource that the server is sent are received, acquisition is all to contain list
The lock of individual competitive resource;
Wherein, the server receives the complicated lock acquisition request that the terminal is sent, by the complexity containing multiple competitive resources
Lock obtains request and splits into multiple locks acquisition requests containing single competitive resource;Send all locks containing single competitive resource
Obtain successfully response.
6. a kind of terminal according to claim 5, it is characterised in that what the distributed complex was locked realizes that program is described
It is additionally operable to realize following steps during computing device:
Competitive resource is operated, and discharges all containing single competitive resource in rear sent to the server operated
Lock request.
7. a kind of terminal according to claim 5, it is characterised in that it is effective that the complicated lock acquisition request includes complicated lock
Duration.
8. a kind of terminal according to claim 5, it is characterised in that what the distributed complex was locked realizes that program is described
It is additionally operable to realize following steps during computing device:
When successfully getting all locks containing single competitive resource, pass through all locks containing single competitive resource of acquisition
Shared competitive resource.
9. a kind of server, the server includes memory, processor and is stored on the memory and can be at the place
What the distributed complex run on reason device was locked realizes program, and what the distributed complex was locked realizes program by the computing device
Shi Shixian following steps:
The complicated lock containing multiple competitive resources that receiving terminal is sent obtains request;
The complicated lock containing multiple competitive resources of reception is obtained into request, multiple locks containing single competitive resource is split into and obtains
Take request;
All locks containing single competitive resource, which are sent, to the terminal obtains successful response.
10. a kind of computer-readable recording medium, it is characterised in that be stored with distribution on the computer-readable recording medium
What complexity was locked realizes program, and realizing for the distributed complex lock is realized when program is executed by processor as in Claims 1-4
The step of implementation method of distributed complex lock described in any one.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710287547.8A CN107133108A (en) | 2017-04-27 | 2017-04-27 | Implementation method, terminal, server and the computer-readable recording medium of distributed complex lock |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710287547.8A CN107133108A (en) | 2017-04-27 | 2017-04-27 | Implementation method, terminal, server and the computer-readable recording medium of distributed complex lock |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107133108A true CN107133108A (en) | 2017-09-05 |
Family
ID=59716392
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710287547.8A Pending CN107133108A (en) | 2017-04-27 | 2017-04-27 | Implementation method, terminal, server and the computer-readable recording medium of distributed complex lock |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107133108A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108089926A (en) * | 2018-01-08 | 2018-05-29 | 马上消费金融股份有限公司 | A kind of method, apparatus, equipment and readable storage medium storing program for executing for obtaining distributed lock |
CN111124697A (en) * | 2020-01-02 | 2020-05-08 | 中国航空工业集团公司西安航空计算技术研究所 | Task synchronization and execution method facing distributed platform |
CN111163140A (en) * | 2019-12-20 | 2020-05-15 | 深圳市中农易讯信息技术有限公司 | Method, apparatus and computer readable storage medium for resource acquisition and allocation |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009002686A1 (en) * | 2007-06-27 | 2008-12-31 | Microsoft Corporation | Hybrid resource manager |
CN105573823A (en) * | 2014-10-09 | 2016-05-11 | 阿里巴巴集团控股有限公司 | Resource locking method and device |
CN106354565A (en) * | 2016-09-21 | 2017-01-25 | 努比亚技术有限公司 | Distributed lock client and control method |
-
2017
- 2017-04-27 CN CN201710287547.8A patent/CN107133108A/en active Pending
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2009002686A1 (en) * | 2007-06-27 | 2008-12-31 | Microsoft Corporation | Hybrid resource manager |
CN105573823A (en) * | 2014-10-09 | 2016-05-11 | 阿里巴巴集团控股有限公司 | Resource locking method and device |
CN106354565A (en) * | 2016-09-21 | 2017-01-25 | 努比亚技术有限公司 | Distributed lock client and control method |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108089926A (en) * | 2018-01-08 | 2018-05-29 | 马上消费金融股份有限公司 | A kind of method, apparatus, equipment and readable storage medium storing program for executing for obtaining distributed lock |
CN111163140A (en) * | 2019-12-20 | 2020-05-15 | 深圳市中农易讯信息技术有限公司 | Method, apparatus and computer readable storage medium for resource acquisition and allocation |
CN111124697A (en) * | 2020-01-02 | 2020-05-08 | 中国航空工业集团公司西安航空计算技术研究所 | Task synchronization and execution method facing distributed platform |
CN111124697B (en) * | 2020-01-02 | 2023-09-08 | 中国航空工业集团公司西安航空计算技术研究所 | Task synchronization and execution method for distributed platform |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107133092A (en) | Multi-thread synchronization processing method, terminal and computer-readable recording medium | |
CN106961706A (en) | Method, mobile terminal and the computer-readable recording medium of communication pattern switching | |
CN107688607A (en) | The method and mobile terminal of a kind of database access, computer-readable recording medium | |
CN108052302A (en) | Association display methods, terminal and the computer readable storage medium of double-sided screen | |
CN107436779A (en) | A kind of application management method, equipment and computer-readable recording medium | |
CN107343083A (en) | One kind lifting game experiencing method, apparatus and computer-readable recording medium | |
CN107145385A (en) | A kind of multitask interface display methods, mobile terminal and computer-readable storage medium | |
CN107181700A (en) | Control method, mobile terminal and the storage medium of application program for mobile terminal | |
CN107133302A (en) | Realize method, system, terminal and the computer-readable recording medium of data consistency | |
CN106953684A (en) | A kind of method for searching star, mobile terminal and computer-readable recording medium | |
CN106953989A (en) | Incoming call reminding method and device, terminal, computer-readable recording medium | |
CN107181865A (en) | Processing method, terminal and the computer-readable recording medium of unread short messages | |
CN107580350A (en) | A kind of signal intensity switching method, equipment and computer-readable recording medium | |
CN107172605A (en) | A kind of Emmergency call method, mobile terminal and computer-readable recording medium | |
CN107896287A (en) | Phone number risk monitoring method and mobile terminal | |
CN107124466A (en) | One kind prevents caching penetrating method and device, computer-readable recording medium | |
CN107390856A (en) | A kind of method, mobile terminal and storage medium for reducing mobile terminal power consumption | |
CN107124428A (en) | A kind of method, equipment and the storage medium of raising VoLTE call successful rates | |
CN107360558A (en) | Emergency call control method, communication terminal and computer-readable recording medium | |
CN107147781A (en) | A kind of dialing process method, mobile terminal and computer-readable recording medium | |
CN107368241A (en) | A kind of information processing method, equipment and computer-readable recording medium | |
CN107480003A (en) | A kind of method, equipment and the computer-readable recording medium of backup radio frequency parameter | |
CN107133108A (en) | Implementation method, terminal, server and the computer-readable recording medium of distributed complex lock | |
CN109445945A (en) | Memory allocation method, mobile terminal, server and the storage medium of application program | |
CN108040116A (en) | Information push method, router and computer-readable recording medium |
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 | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20170905 |