CN107818018A - The control method and device of distributed lock - Google Patents
The control method and device of distributed lock Download PDFInfo
- Publication number
- CN107818018A CN107818018A CN201610825829.4A CN201610825829A CN107818018A CN 107818018 A CN107818018 A CN 107818018A CN 201610825829 A CN201610825829 A CN 201610825829A CN 107818018 A CN107818018 A CN 107818018A
- Authority
- CN
- China
- Prior art keywords
- distributed lock
- mentioned
- time
- lock
- response
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/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/12—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
- H04L67/125—Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks involving control of end-device applications over a network
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Signal Processing (AREA)
- Medical Informatics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computing Systems (AREA)
- Lock And Its Accessories (AREA)
Abstract
This application discloses the control method of distributed lock and device.One embodiment of methods described includes:The locking request for the distributed lock that client is sent is received, wherein, the locking request includes the mark of the distributed lock;Perform following determination step:Determine whether the distributed lock of the locking request instruction is occupied;It is occupied in response to the distributed lock, determine whether the distributed lock has been set expired time, if expired time has been set, obtain the remaining effective time of the distributed lock, wherein, the remaining effective time is the difference of the expired time and current time;Expired time is not set in response to the distributed lock or the remaining effective time is equal to zero, releases the distributed lock, and re-execute the determination step.The embodiment realizes efficient, the accurate control to distributed lock.
Description
Technical field
The application is related to field of computer technology, and in particular to Internet technical field, more particularly to the control of distributed lock
Method and apparatus processed.
Background technology
In a distributed system, if having shared one or one group between different systems or the different main frames of same system
Resource, then when accessing these resources, for ensure the operation of system can synchronization or mutual exclusion perform, it is necessary to use distributed lock pair
The operation being associated between system is coordinated.
The control method of existing distributed lock is typically to be utilized as the software that Distributed Application provides Consistency service
Zookeeper creates transient node, and the numbering size based on transient node realizes the control of distributed lock.However, this distribution
The Zookeeper maintenances that the control method of formula lock relies on are complicated and are only applicable to small-scale cluster, thus, for such as ecommerce
The high concurrent scenes such as the large-scale promotion scene of system, commodity second execution ground scape, the control method of existing distributed lock can not efficiently,
Distributed lock is controlled exactly.
The content of the invention
The purpose of the application is to propose a kind of control method and device of improved distributed lock, to solve background above
The technical problem that technology segment is mentioned.
In a first aspect, this application provides a kind of control method of distributed lock, methods described includes:Receive client hair
The locking request of the distributed lock sent, wherein, the locking request includes the mark of the distributed lock;Perform following judgement step
Suddenly:Determine whether the distributed lock of the locking request instruction is occupied;It is occupied in response to the distributed lock, it is determined that
Whether the distributed lock has been set expired time, if expired time has been set, the residue for obtaining the distributed lock has
Duration is imitated, wherein, the remaining effective time is the difference of the expired time and current time;In response to the distributed lock not
Expired time is set or the remaining effective time is equal to zero, releases the distributed lock, and re-executes the judgement step
Suddenly.
In certain embodiments, methods described also includes:It is more than zero in response to the remaining effective time, determines the visitor
The waiting time at family end or the execution number of the determination step, wherein, the waiting time is current time and the client
End sends the difference of the time of the locking request;It is not less than default waiting time threshold value in response to the waiting time or described holds
Places number is equal to default execution frequency threshold value, judges to lock failure, and sends locking failed message to the client, wherein,
The failed message that locks includes the mark of the distributed lock.
In certain embodiments, methods described also includes:It is less than the default waiting time in response to the waiting time
Threshold value or it is described execution number be less than the default execution frequency threshold value, then wait preset dormancy duration, re-execute described in sentence
Determine step.
In certain embodiments, the default waiting time threshold value, the default execution frequency threshold value prestore
Or the client transmission.
In certain embodiments, the locking request also includes the effective time information of the distributed lock;It is and described
Determination step, in addition to:It is unoccupied in response to the distributed lock, take the distributed lock;According to the effective time
Information carries out expired time setting to the distributed lock, and generates instruction and set whether successfully set result;In response to institute
State and set result to indicate to set successfully, sent to the client and lock success message, so that the client executing is by described
The business operation of distributed lock protection, wherein, the success message that locks includes the mark of the distributed lock.
In certain embodiments, methods described also includes:Setup failed is indicated in response to the setting result, described in releasing
Distributed lock, and re-execute the determination step.
In certain embodiments, after locking success message is sent to the client, methods described also includes:When described
When the remaining effective time of distributed lock is zero, the distributed lock is released.
In certain embodiments, methods described also includes:Solution in response to receiving the distributed lock from the client
Lock request, the distributed lock of the unlocking request instruction is released, wherein, the unlocking request includes the distributed lock
Mark.
Second aspect, this application provides the control device of distributed lock, described device includes:Receiving unit, configuration are used
In the locking request for receiving the distributed lock that client is sent, wherein, the locking request includes the mark of the distributed lock;
Identifying unit, it is configured to carry out following determination step:Determine whether the distributed lock of the locking request instruction is occupied
With;It is occupied in response to the distributed lock, determine whether the distributed lock has been set expired time, if being set
Time phase, the remaining effective time of the distributed lock is obtained, wherein, the remaining effective time is the expired time with working as
The difference of preceding time;First lifting unit, it is configured to that expired time or the residue are not set in response to the distributed lock
Effective time is equal to zero, releases the distributed lock, the identifying unit is re-executed the determination step.
In certain embodiments, described device also includes:Determining unit, it is configured in response to the remaining effective time
More than zero, the waiting time of the client or the execution number of the determination step are determined, wherein, the waiting time is to work as
The preceding time sends the difference of the time of the locking request with the client;Transmitting element, it is configured in response to the wait
Duration is not less than default waiting time threshold value or the number that performs performs frequency threshold value equal to default, judges that locking fails, and
Sent to the client and lock failed message, wherein, the failed message that locks includes the mark of the distributed lock.
In certain embodiments, described device also includes:Unit is waited, is configured to be less than in response to the waiting time
The default waiting time threshold value or the execution number are less than the default execution frequency threshold value, then when waiting preset dormancy
It is long, the identifying unit is re-executed the determination step.
In certain embodiments, the default waiting time threshold value, the default execution frequency threshold value prestore
Or the client transmission.
In certain embodiments, the locking request also includes the effective time information of the distributed lock;It is and described
Identifying unit is further configured to:It is unoccupied in response to the distributed lock, take the distributed lock;Had according to described
Imitate duration information and expired time setting is carried out to the distributed lock, and generate instruction and set whether result is successfully set;Ring
Set result to indicate to set successfully described in Ying Yu, sent to the client and lock success message, for the client executing
The business operation protected by the distributed lock, wherein, the success message that locks includes the mark of the distributed lock.
In certain embodiments, described device also includes:Second lifting unit, it is configured in response to the setting result
Setup failed is indicated, the distributed lock is released, the identifying unit is re-executed the determination step.
In certain embodiments, described device also includes:3rd lifting unit, it is configured to remaining when the distributed lock
When remaining effective time is zero, the distributed lock is released.
In certain embodiments, described device also includes:4th lifting unit, it is configured in response to from the client
The unlocking request of the distributed lock is received, releases the distributed lock of the unlocking request instruction, wherein, the unblock please
Asking includes the mark of the distributed lock.
The control method and device for the distributed lock that the application provides, by judging from the distributed lock of client reception
Locking request instruction distributed lock it is whether occupied, whether expired time has been set, to obtain the distributed lock
Remaining effective time;Then it is equal to zero in response to being not provided with expired time or remaining effective time, releases the distributed lock, and
Re-execute determination step.It is achieved thereby that efficient, the accurate control to distributed lock.
Brief description of the drawings
By reading the detailed description made to non-limiting example made with reference to the following drawings, the application's is other
Feature, objects and advantages will become more apparent upon:
Fig. 1 is that the application can apply to exemplary system architecture figure therein;
Fig. 2 is the flow chart according to one embodiment of the control method of the distributed lock of the application;
Fig. 3 is the decomposition process figure of the determination step in the flow chart to Fig. 2;
Fig. 4 is the flow chart according to another embodiment of the control method of the distributed lock of the application;
Fig. 5 is the structural representation according to one embodiment of the control device of the distributed lock of the application;
Fig. 6 is adapted for the structural representation for realizing the terminal device of the embodiment of the present application or the computer system of server
Figure.
Embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched
The specific embodiment stated is used only for explaining related invention, rather than the restriction to the invention.It also should be noted that in order to
Be easy to describe, illustrate only in accompanying drawing to about the related part of invention.
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.
Fig. 1 shows the example of the control device of the control method that can apply the distributed lock of the application or distributed lock
Sexual system framework 100.
As shown in figure 1, system architecture 100 can include terminal device 101,102,103, network 104 and server 105.
Network 104 between terminal device 101,102,103 and server 105 provide communication link medium.Network 104 can be with
Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be interacted with using terminal equipment 101,102,103 by network 104 with server 105, to receive or send out
Send message etc..Various client applications can be installed, such as distributed resource request class should on terminal device 101,102,103
With, web browser applications, the application of shopping class, searching class application, JICQ, mailbox client, social platform software
Deng.
Terminal device 101,102,103 can be the various electronic equipments for having processor, including but not limited to intelligent hand
Machine, tablet personal computer, E-book reader, pocket computer on knee and desktop computer etc..
Server 105 can be to provide the server of various services, such as to being installed on terminal device 101,102,103
Distributed resource request class application provides the distributed lock control server supported.Distributed lock control server can be to receiving
To the locking request that sends of terminal device, the data such as unlocking request analyze etc. processing, and result (such as are locked
Success message, unblock success message) feed back to terminal device.
It should be noted that the control method for the distributed lock that the embodiment of the present application is provided typically is held by server 105
OK, correspondingly, the control device of distributed lock is generally positioned in server 105.
It should be understood that the number of the terminal device, network and server in Fig. 1 is only schematical.According to realizing need
Will, can have any number of terminal device, network and server.
With continued reference to Fig. 2, the flow of one embodiment of the control method of distributed lock according to the application is shown
200.The control method of described distributed lock, comprises the following steps:
Step 201, the locking request for the distributed lock that client is sent is received.
In the present embodiment, the control of distributed lock divides electronic equipment (such as the clothes shown in Fig. 1 of method operation thereon
Be engaged in device 105) can be received by wired connection mode or radio connection client (such as terminal 101 shown in Fig. 1,
102nd, the locking request of the distributed lock 103) sent, wherein, above-mentioned locking request includes the mark of above-mentioned distributed lock.Practice
In, the mark of above-mentioned distributed lock can be the data for the above-mentioned distributed lock of unique identification, for example, numeral, numeral and/or
Character string of letter composition etc..
It is pointed out that above-mentioned radio connection can include but is not limited to 3G/4G connections, WiFi connections, bluetooth
Connection, WiMAX connections, Zigbee connections, UWB (ultra wideband) connections and other currently known or exploitations in the future
Radio connection.
Step 202, following determination step is performed:Determine whether the above-mentioned distributed lock of above-mentioned locking request instruction is occupied
With;It is occupied in response to above-mentioned distributed lock, determine whether above-mentioned distributed lock has been set expired time;If it had been set
Time phase, the remaining effective time of above-mentioned distributed lock is obtained, wherein, above-mentioned remaining effective time is above-mentioned expired time with working as
The difference of preceding time.
In the present embodiment, with further reference to Fig. 3, Fig. 3 is the decomposition process figure to above-mentioned determination step.In figure 3, will
Step 202 specifically resolves into 2 sub-steps, i.e.,:Step 2021 and step 2022.
Step 2021, determine whether the distributed lock of above-mentioned locking request instruction is occupied.
In the present embodiment, above-mentioned electronic equipment can judge above-mentioned point according to the mark included in above-mentioned locking request
Whether cloth lock is occupied, then carries out subsequent operation.Specifically, above-mentioned electronic equipment can read preset identity column first
Table, wherein, above-mentioned identification list is used for the mark for storing occupied distributed lock;Afterwards, above-mentioned electronic equipment can will be upper
The mark of the distributed lock of locking request instruction is stated as target identification, inquires about and whether there is above-mentioned target in above-mentioned identification list
Mark;If above-mentioned target identification in above-mentioned identification list be present, it is determined that above-mentioned distributed lock is occupied;If above-mentioned identification list
In be not present above-mentioned target identification, it is determined that above-mentioned distributed lock is unoccupied, and by the distributed lock of locking request instruction
Mark is write in above-mentioned identification list.
It should be noted that above-mentioned distributed lock is occupied it may is that above-mentioned distributed lock is by other threads
Situation or above-mentioned distributed lock in taking and being carrying out by the business operation of above-mentioned distributed lock protection is by it
After his thread takes, due to failures such as network flash, abnormal program terminations, expired time is not set to above-mentioned distributed lock successfully
And it is not carried out the situation of the business operation by the protection of above-mentioned distributed lock.
In practice, above-mentioned identification list can be stored in Redis databases.Above-mentioned electronic equipment passes through when locking
Redis SETNX (Set if Not Exist, if there is no then setting) order sets key (mark of distributed lock), such as
Fruit sets key successes, then it represents that distributed lock corresponding to the key is unoccupied, if setting the key to fail, then it represents that should
Distributed lock is occupied corresponding to key.
It should be noted that above-mentioned identification list can also be stored in other kinds of database, will not be repeated here.
Step 2022, it is occupied in response to above-mentioned distributed lock, when determining whether above-mentioned distributed lock has been set expired
Between, if expired time has been set, obtain the remaining effective time of above-mentioned distributed lock.
In the present embodiment, determine that above-mentioned distributed lock is occupied in response to step 2021, above-mentioned electronic equipment can be first
First determine whether above-mentioned distributed lock has been set expired time;If expired time has been set, read set it is expired
Time, and calculate the remaining effective time of above-mentioned distributed lock, wherein, above-mentioned remaining effective time be above-mentioned expired time with
The difference of current time.It is pointed out that the above-mentioned expired time set is that above-mentioned electronic equipment is currently to take above-mentioned point
What the client application of cloth lock was set when being locked to above-mentioned distributed lock.
In practice, when the identification list in step 201 is stored in Redis databases, above-mentioned electronic equipment can root
Determine whether above-mentioned distributed lock is set according to the return value of redis TTL (Time To Live, can life span) orders
Put expired time;It is -1 in response to the return value, then judges that expired time is not set for above-mentioned distributed lock;In response to the return
It is worth for the numerical value more than 0, then judges that expired time, and the business protected by above-mentioned distributed lock has been set in above-mentioned distributed lock
During operation is carrying out.If it is pointed out that the return value is the value more than 0, the return value is in units of millisecond
The remaining effective time of above-mentioned distributed lock.
Step 203, expired time is not set in response to above-mentioned distributed lock or above-mentioned remaining effective time is equal to zero, solution
Except above-mentioned distributed lock, and re-execute above-mentioned determination step.
In the present embodiment, determine that expired time, above-mentioned electronics are not set for above-mentioned distributed lock in response to step 2022
Equipment can release above-mentioned distributed lock, and re-execute determination step 202;In addition, above-mentioned electronic equipment can also determine to walk
Whether the remaining effective time of the rapid 2022 above-mentioned distributed locks obtained is equal to zero, if above-mentioned remaining effective time is equal to zero, i.e.,
Current time is the expired time of above-mentioned distributed lock, and above-mentioned electronic equipment then releases above-mentioned distributed lock, and re-executes step
Rapid 202.It is above-mentioned that the key that order releases above-mentioned distributed lock (Delete, can be deleted) by redis DEL in practice, i.e.,
Above-mentioned distributed lock can be released.
The method that above-described embodiment of the application provides passes through the locking request for the distributed lock for judging to receive from client
Whether the distributed lock of instruction is occupied, whether expired time has been set, to obtain the residue of above-mentioned distributed lock effectively
Duration;Then it is equal to zero in response to being not provided with expired time or remaining effective time, releases above-mentioned distributed lock, and re-execute
Determination step.It is achieved thereby that efficient, the accurate control to distributed lock.
With further reference to Fig. 4, it illustrates the flow 400 of another embodiment of the control method of distributed lock.This point
The flow 400 of the control method of cloth lock, comprises the following steps:
Step 401, the locking request for the distributed lock that client is sent is received.
In the present embodiment, the control of distributed lock divides electronic equipment (such as the clothes shown in Fig. 1 of method operation thereon
Be engaged in device 105) can be received by wired connection mode or radio connection client (such as terminal 101 shown in Fig. 1,
102nd, the locking request of the distributed lock 103) sent, wherein, above-mentioned locking request includes the mark of above-mentioned distributed lock.Practice
In, the mark of above-mentioned distributed lock can be the data for the above-mentioned distributed lock of unique identification, for example, numeral, numeral and/or
Character string of letter composition etc..
In the present embodiment, after above-mentioned electronic equipment receives the locking request of the distributed lock of client transmission, perform
Determination step, above-mentioned determination step include step 402-408.
Step 402, determine whether the distributed lock of above-mentioned locking request instruction is occupied.
In the present embodiment, above-mentioned electronic equipment can judge above-mentioned point according to the mark included in above-mentioned locking request
Whether cloth lock is occupied, then carries out subsequent operation.If it is determined that when above-mentioned distributed lock is occupied, step 403 is performed;If really
When above-mentioned distributed lock is vacant calmly, step 406 is performed.
In the present embodiment, above-mentioned electronic equipment can read preset identification list first, wherein, above-mentioned identification list
For storing the mark of occupied distributed lock;Afterwards, the distributed lock that above-mentioned electronic equipment indicates above-mentioned locking request
Mark as target identification, inquire about and whether there is above-mentioned target identification in above-mentioned identification list;If deposited in above-mentioned identification list
In above-mentioned target identification, it is determined that above-mentioned distributed lock is occupied;If above-mentioned target identification is not present in above-mentioned identification list,
Determine that above-mentioned distributed lock is unoccupied, and the mark of the distributed lock of locking request instruction is write in above-mentioned identification list.
Step 403, it is occupied in response to above-mentioned distributed lock, when determining whether above-mentioned distributed lock has been set expired
Between.
In the present embodiment, determine that above-mentioned distributed lock is occupied in response to step 402, above-mentioned electronic equipment determines above-mentioned
Whether distributed lock has been set expired time, wherein, the above-mentioned expired time set is that above-mentioned electronic equipment is currently to account for
Set when being locked with the client application of above-mentioned distributed lock to above-mentioned distributed lock.If it is determined that above-mentioned distributed lock is
Expired time is set, performs step 404-405;If it is determined that expired time is not set for above-mentioned distributed lock, step is performed
409。
Step 404, in response to expired time has been set, the remaining effective time of above-mentioned distributed lock is obtained.
In the present embodiment, determine that expired time has been set in above-mentioned distributed lock in response to step 403, above-mentioned electronics is set
It is standby to read the expired time set first;The remaining effective time of above-mentioned distributed lock is calculated afterwards, wherein, above-mentioned residue
Effective time is the difference of above-mentioned expired time and current time.
Step 405, determine whether above-mentioned remaining effective time is more than zero.
In the present embodiment, above-mentioned electronic equipment can determine the residue for the above-mentioned distributed lock that step 404 obtains effectively
Whether duration is more than zero;In response to above-mentioned remaining effective time be equal to zero, i.e., current time for above-mentioned distributed lock it is expired when
Between, above-mentioned electronic equipment performs step 409;It is more than zero in response to above-mentioned remaining effective time, above-mentioned electronic equipment performs step
410。
Above-mentioned steps 401-405 concrete operations and step 201-203 concrete operations are essentially identical, no longer superfluous herein
State.
Step 406, it is unoccupied in response to above-mentioned distributed lock, above-mentioned distributed lock is taken, and to above-mentioned distributed lock
Expired time setting is carried out, whether generation instruction is set successfully sets result.
In the present embodiment, determine that above-mentioned distribution is unoccupied in response to step 402, above-mentioned electronic equipment can more than
The mark of distributed lock is stated as target identification, first, above-mentioned target identification is write in preset identification list, realized above-mentioned
The occupancy of distributed lock, wherein, above-mentioned identification list is used for the mark for storing occupied distributed lock;Afterwards, above-mentioned electronics
Equipment can carry out expired time setting to above-mentioned distributed lock, and whether generation instruction is set successfully sets result.In practice,
The expired time of distributed lock can be that client sets according to business operation and is sent to above-mentioned electronic equipment, can also
It is the default value pre-set in above-mentioned electronic equipment.
In some optional implementations of the present embodiment, the locking request for the distributed lock that above-mentioned client is sent is also
The effective time information of above-mentioned distributed lock can be included, wherein, above-mentioned effective time information can be indicated for above-mentioned visitor
Family supports the maximum duration of above-mentioned distributed lock.Therefore, above-mentioned electronic equipment can set above-mentioned distribution as follows
The expired time of formula lock:First, above-mentioned electronic equipment can obtain current time;Afterwards, by above-mentioned current time plus above-mentioned
Maximum duration, obtain the expired time of above-mentioned distributed lock.
In some optional implementations of the present embodiment, above-mentioned electronic equipment can also obtain current time first;
Afterwards, by above-mentioned current time add above-mentioned electronic equipment in default acquiescence duration, obtain above-mentioned distributed lock it is expired when
Between.It should be noted that above-mentioned acquiescence duration can be any duration, such as 1s, 10s, 20s etc..
In practice, above-mentioned electronic equipment can set key by redis SETNX orders first when locking, if
Key successes are set, then it represents that distributed lock corresponding to the key is unoccupied before current time, and when current
Quarter takes successfully;Afterwards, above-mentioned electronic equipment can set above-mentioned point by redis expire (expired time setting) orders
The expired time of cloth lock.
Step 407, determine whether above-mentioned setting result indicates to set successfully.
In the present embodiment, above-mentioned electronic equipment determines whether the setting result that step 406 generates indicates above-mentioned distribution
Whether the expired time of lock sets success, is set successfully in response to the instruction of above-mentioned setting result, performs step 408;In response to upper
State and set result to indicate setup failed, perform step 409.
In practice, after above-mentioned electronic equipment sets the expired time of above-mentioned distributed lock by redis expire orders,
It can determine whether the expired time of above-mentioned distributed lock sets success according to the return value of above-mentioned expire orders;In response to this
Return value is 1, then judges that above-mentioned distributed lock expired time is set successfully;It is 0 in response to the return value, then judges above-mentioned distribution
Formula locks expired time setup failed.
Step 408, set successfully in response to the instruction of above-mentioned setting result, sent to above-mentioned client and lock success message,
The business operation protected for above-mentioned client executing by above-mentioned distributed lock.
In the present embodiment, determine that above-mentioned setting result instruction is set successfully in response to step 407, above-mentioned electronic equipment can
Success message is locked to be sent to above-mentioned client, so that the business that above-mentioned client executing is protected by above-mentioned distributed lock is grasped
Make, wherein, above-mentioned locking success message includes the mark of above-mentioned distributed lock.
In some optional implementations of the present embodiment, after sending to above-mentioned client plus sending success message, on
The remaining effective time of above-mentioned distributed lock can be monitored in real time by stating electronic equipment, when above-mentioned remaining effective time is zero, then
Release above-mentioned distributed lock.
In some optional implementations of the present embodiment, after sending to above-mentioned client plus sending success message, ring
The above-mentioned clients of Ying Yucong receive the unlocking request of above-mentioned distributed lock, and above-mentioned electronic equipment then releases above-mentioned distributed lock, its
In, above-mentioned unlocking request includes the mark of above-mentioned distributed lock.
Step 409, above-mentioned distributed lock is released, and re-executes above-mentioned determination step.
In the present embodiment, determine that expired time is not set for above-mentioned distributed lock in response to step 403, or, response
Above-mentioned remaining effective time is determined equal to zero in step 405, or, determine that above-mentioned setting result instruction is set in response to step 407
Work(is set to, above-mentioned electronic equipment can be using the mark of above-mentioned distributed lock as target identification, by above-mentioned preset identification list
In above-mentioned target identification delete, realize the releasing of above-mentioned distributed lock, and re-execute above-mentioned determination step.
Step 410, it is more than zero in response to above-mentioned remaining effective time, determines the waiting time of above-mentioned client or above-mentioned sentence
Determine the execution number of step.
In the present embodiment, determine that above-mentioned remaining effective time is more than zero in response to step 405, above-mentioned electronic equipment can be with
Obtain time and current time that above-mentioned client sends above-mentioned locking request first, afterwards, according to above-mentioned current time and
The time that above-mentioned client sends above-mentioned locking request determines waiting time of above-mentioned client, wherein, above-mentioned waiting time is
Current time sends the difference of the time of above-mentioned locking request with client;Or above-mentioned electronic equipment can record above-mentioned judgement
The execution number of step, determine that above-mentioned remaining effective time is more than zero in response to step 405, above-mentioned electronic equipment can obtain
State the execution number of determination step.
Step 411, determine above-mentioned waiting time whether not less than default waiting time threshold value or above-mentioned execution number whether
Equal to default execution frequency threshold value.
In the present embodiment, the waiting time for the above-mentioned client that above-mentioned electronic equipment can determine step 410 with it is pre-
If waiting time threshold value carries out numeric ratio compared with determining whether above-mentioned waiting time is not less than above-mentioned default waiting time threshold value;Or
Person, the execution number for the above-mentioned determination step that above-mentioned electronic equipment can determine step 410 enter with the default frequency threshold value that performs
Line number value compares, and determines whether above-mentioned execution number is equal to above-mentioned default execution frequency threshold value.
In some optional implementations of the present embodiment, above-mentioned electronic equipment can prestore above-mentioned distributed lock
Default waiting time or default perform frequency threshold value.
In some optional implementations of the present embodiment, the locking request for the distributed lock that above-mentioned client is sent is also
The default waiting time threshold value of above-mentioned distributed lock or default execution frequency threshold value can be included.
Step 412, it is not less than default waiting time threshold value in response to above-mentioned waiting time or above-mentioned execution number is equal in advance
If performing frequency threshold value, judge to lock failure, and send to above-mentioned client and lock failed message.
In the present embodiment, if whether step 411 execution is to determine above-mentioned waiting time not less than default waiting time
The operation of threshold value, then it is not less than default waiting time threshold value in response to above-mentioned waiting time, above-mentioned electronic equipment, which judges to lock, to be lost
Lose, and sent to above-mentioned client and lock failed message;It is pre- that what if step 411 performed is to determine whether above-mentioned execution number is equal to
If performing the operation of frequency threshold value, then it is equal to default execution frequency threshold value in response to above-mentioned execution number, above-mentioned electronic equipment is sentenced
It is fixed to lock failure, and sent to above-mentioned client and lock failed message.It should be noted that above-mentioned locking failed message can wrap
Include the mark of above-mentioned distributed lock.
Step 413, it is less than above-mentioned default waiting time threshold value in response to above-mentioned waiting time or above-mentioned execution number is less than
Above-mentioned default execution frequency threshold value, then preset dormancy duration is waited, re-executes above-mentioned determination step.
In the present embodiment, it is to determine above-mentioned waiting time whether not less than default wait in response to what step 411 performed
The operation of duration threshold value, then be less than above-mentioned default waiting time threshold value in response to above-mentioned waiting time, and above-mentioned electronic equipment waits
Preset dormancy duration, re-execute above-mentioned determination step;It is pre- that what if step 411 performed is to determine whether above-mentioned execution number is equal to
If performing the operation of frequency threshold value, then it is less than above-mentioned default execution frequency threshold value in response to above-mentioned execution number, then waits default
Sleep time, re-execute above-mentioned determination step.It should be noted that above-mentioned preset dormancy duration can be above-mentioned electronic equipment
In any duration for pre-setting, such as 50ms, 100ms etc..
Figure 4, it is seen that compared with embodiment corresponding to Fig. 2, the control method of the distributed lock in the present embodiment
Flow 400 highlight occupied to execution step of the distributed lock in the case of unoccupied and distributed lock and remaining have
Execution step in the case of duration is imitated more than zero.Thus, the present embodiment description scheme cover distributed lock it is a variety of not
Same state, distributed lock more comprehensively, is accurately controlled so as to realize.
With further reference to Fig. 5, as the realization to method shown in above-mentioned each figure, this application provides a kind of distributed lock
One embodiment of control device, the device embodiment is corresponding with the embodiment of the method shown in Fig. 2, and the device can specifically answer
For in various electronic equipments.
As shown in figure 5, the control device 500 of the distributed lock described in the present embodiment includes:Receiving unit 501, judge list
The lifting unit 503 of member 502 and first.Wherein, receiving unit 501 is configured to receive the locking for the distributed lock that client is sent
Request, wherein, above-mentioned locking request includes the mark of above-mentioned distributed lock;Identifying unit 502 is configured to carry out judging as follows
Step:Determine whether the above-mentioned distributed lock of above-mentioned locking request instruction is occupied;It is occupied in response to above-mentioned distributed lock, really
Whether fixed above-mentioned distributed lock has been set expired time, if expired time has been set, obtains the residue of above-mentioned distributed lock
Effective time, wherein, above-mentioned remaining effective time is the difference of above-mentioned expired time and current time;First lifting unit 503 is matched somebody with somebody
Put for expired time or above-mentioned remaining effective time not to be set equal to zero in response to above-mentioned distributed lock, release above-mentioned distribution
Formula is locked, and above-mentioned identifying unit 502 is re-executed above-mentioned determination step.
In the present embodiment, the receiving unit 501 of the control device 500 of distributed lock can by wired connection mode or
Person's radio connection receives the locking request for the distributed lock that client is sent, wherein, above-mentioned locking request includes above-mentioned point
The mark of cloth lock.In practice, the mark of above-mentioned distributed lock can be the data for the above-mentioned distributed lock of unique identification, example
Such as, character string of numeral, numeral and/or letter composition etc..
In the present embodiment, above-mentioned identifying unit 502 can perform following determination step:Wrapped according in above-mentioned locking request
The mark contained judges whether above-mentioned distributed lock is occupied.Specifically, above-mentioned identifying unit 502 can read first it is preset
Identification list, wherein, above-mentioned identification list is used for the mark for storing occupied distributed lock;Afterwards, by above-mentioned locking request
The mark of the distributed lock of instruction is inquired about as target identification and whether there is above-mentioned target identification in above-mentioned identification list;On if
State in identification list and above-mentioned target identification be present, it is determined that above-mentioned distributed lock is occupied;If it is not present in above-mentioned identification list
Above-mentioned target identification, it is determined that above-mentioned distributed lock is unoccupied, and the mark of the distributed lock of locking request instruction is write
In above-mentioned identification list.Occupied in response to above-mentioned distributed lock, above-mentioned identifying unit 502 can determine above-mentioned distribution first
Whether lock has been set expired time;If expired time has been set, the expired time set is read, and is calculated above-mentioned
The remaining effective time of distributed lock, wherein, above-mentioned remaining effective time is the difference of above-mentioned expired time and current time.
In the present embodiment, in response to above-mentioned identifying unit 502 determine above-mentioned distributed lock be not set expired time or
Above-mentioned remaining effective time is equal to zero, and the first lifting unit 503 of the control device 500 of distributed lock can release above-mentioned distribution
Formula is locked, and above-mentioned identifying unit 502 is re-executed above-mentioned determination step.
In some optional implementations of the present embodiment, the control device 500 of above-mentioned distributed lock can also include
Determining unit 504, it is configured to above-mentioned identifying unit 502 and determines that above-mentioned remaining effective time is more than zero, determine above-mentioned client
Waiting time or above-mentioned determination step execution number, wherein, above-mentioned waiting time is on current time and client are sent
State the difference of the time of locking request.
In some optional implementations of the present embodiment, the control device 500 of above-mentioned distributed lock can also include
Transmitting element 505, it is configured to determine that above-mentioned waiting time is not less than default waiting time threshold in response to above-mentioned determining unit 504
Value or above-mentioned execution number are equal to default execution frequency threshold value, judge to lock failure, and send locking failure to above-mentioned client
Message, wherein, above-mentioned locking failed message includes the mark of above-mentioned distributed lock.It should be noted that during above-mentioned default wait
Long threshold value, above-mentioned default execution frequency threshold value can be that client prestore or above-mentioned is sent.
In some optional implementations of the present embodiment, the control device 500 of above-mentioned distributed lock can also include
Unit 506 is waited, is configured to determine that above-mentioned waiting time is less than above-mentioned default waiting time in response to above-mentioned determining unit 504
Threshold value or above-mentioned execution number are less than above-mentioned default execution frequency threshold value, then wait preset dormancy duration, make above-mentioned identifying unit
502 re-execute above-mentioned determination step.
In some optional implementations of the present embodiment, locking request that above-mentioned receiving unit 501 receives can be with
Effective time information including above-mentioned distributed lock;And above-mentioned identifying unit 502 is further configured in response to above-mentioned point
Cloth lock is unoccupied, takes above-mentioned distributed lock;When carrying out expired to above-mentioned distributed lock according to above-mentioned effective time information
Between set, and generate instruction set whether successfully setting result;Set successfully in response to the instruction of above-mentioned setting result, to above-mentioned
Client, which is sent, locks success message, for the business operation that above-mentioned client executing is protected by above-mentioned distributed lock, wherein, on
Stating locking success message includes the mark of above-mentioned distributed lock.
In some optional implementations of the present embodiment, the control device 500 of above-mentioned distributed lock can also include
Second lifting unit 507, it is configured to determine above-mentioned setting result instruction setup failed, solution in response to above-mentioned identifying unit 502
Except above-mentioned distributed lock, above-mentioned identifying unit 502 is set to re-execute above-mentioned determination step.
In some optional implementations of the present embodiment, send and add to above-mentioned client in above-mentioned identifying unit 502
After locking success message, the control device 500 of above-mentioned distributed lock can also include the 3rd lifting unit 508, be configured to when upper
When the remaining effective time for stating distributed lock is zero, above-mentioned distributed lock is released.
In some optional implementations of the present embodiment, the control device 500 of above-mentioned distributed lock can also include
4th lifting unit 509, the unlocking request in response to receiving above-mentioned distributed lock from above-mentioned client is configured to, released above-mentioned
The above-mentioned distributed lock of unlocking request instruction, wherein, above-mentioned unlocking request includes the mark of above-mentioned distributed lock.
The device that above-described embodiment of the application provides judges that receiving unit 501 terminates from client by identifying unit 502
The distributed lock of receipts locking request instruction distributed lock it is whether occupied, whether expired time has been set, to obtain
The remaining effective time of above-mentioned distributed lock;Then the first lifting unit 503 is in response to being not provided with expired time or remaining effective
Duration is equal to zero, releases above-mentioned distributed lock, above-mentioned identifying unit 502 is re-executed above-mentioned determination step, it is achieved thereby that
Efficient, accurate control to distributed lock.
Below with reference to Fig. 6, it illustrates suitable for for realizing the computer system of the terminal device of the application or server
600 structural representation.
As shown in fig. 6, computer system 600 includes CPU (CPU) 601, it can be read-only according to being stored in
In memory (ROM) 602
Program performs various suitable from the program that storage part 608 is loaded into random access storage device (RAM) 603
When action and processing.In RAM 603, also it is stored with system 600 and operates required various programs and data.CPU 601、
ROM 602 and RAM 603 are connected with each other by bus 604.Input/output (I/O) interface 605 is also connected to bus 604.
I/O interfaces 605 are connected to lower component:Importation 606 including keyboard, mouse etc.;Penetrated including such as negative electrode
The output par, c 607 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage part 608 including hard disk etc.;
And the communications portion 609 of the NIC including LAN card, modem etc..Communications portion 609 via such as because
The network of spy's net performs communication process.Driver 610 is also according to needing to be connected to I/O interfaces 605.Detachable media 611, such as
Disk, CD, magneto-optic disk, semiconductor memory etc., it is arranged on as needed on driver 610, in order to read from it
Computer program be mounted into as needed storage part 608.
Especially, in accordance with an embodiment of the present disclosure, it may be implemented as computer above with reference to the process of flow chart description
Software program.For example, embodiment of the disclosure includes a kind of computer program product, it includes being tangibly embodied in machine readable
Computer program on medium, the computer program include the program code for being used for the method shown in execution flow chart.At this
In the embodiment of sample, the computer program can be downloaded and installed by communications portion 609 from network, and/or from removable
Medium 611 is unloaded to be mounted.When the computer program is performed by CPU (CPU) 601, perform in the present processes
The above-mentioned function of limiting.
Flow chart and block diagram in accompanying drawing, it is illustrated that according to the system of the various embodiments of the application, method and computer journey
Architectural framework in the cards, function and the operation of sequence product.At this point, each square frame in flow chart or block diagram can generation
The part of one module of table, program segment or code, a part for the module, program segment or code include one or more
For realizing the executable instruction of defined logic function.It should also be noted that some as replace realization in, institute in square frame
The function of mark can also be with different from the order marked in accompanying drawing generation.For example, two square frames succeedingly represented are actual
On can perform substantially in parallel, they can also be performed in the opposite order sometimes, and this is depending on involved function.Also
It is noted that the combination of each square frame and block diagram in block diagram and/or flow chart and/or the square frame in flow chart, Ke Yiyong
Function as defined in execution or the special hardware based system of operation are realized, or can be referred to specialized hardware and computer
The combination of order is realized.
Being described in unit involved in the embodiment of the present application can be realized by way of software, can also be by hard
The mode of part is realized.Described unit can also be set within a processor, for example, can be described as:A kind of processor bag
Include receiving unit, identifying unit and the first lifting unit.Wherein, the title of these units is not formed to this under certain conditions
The restriction of unit in itself, for example, receiving unit is also described as " receiving the locking request for the distributed lock that client is sent
Unit ".
As on the other hand, present invention also provides a kind of nonvolatile computer storage media, the non-volatile calculating
Machine storage medium can be the nonvolatile computer storage media included in device described in above-described embodiment;Can also be
Individualism, without the nonvolatile computer storage media in supplying terminal.Above-mentioned nonvolatile computer storage media is deposited
One or more program is contained, when one or more of programs are performed by an equipment so that the equipment:Receive
The locking request for the distributed lock that client is sent, wherein, the locking request includes the mark of the distributed lock;Perform such as
Lower determination step:Determine whether the distributed lock of the locking request instruction is occupied;In response to the distributed lock quilt
Take, determine whether the distributed lock has been set expired time, if expired time has been set, obtain the distributed lock
Remaining effective time, wherein, the remaining effective time is the difference of the expired time and current time;In response to described point
Expired time is not set for cloth lock or the remaining effective time is equal to zero, releases the distributed lock, and re-execute institute
State determination step.
Above description is only the preferred embodiment of the application and the explanation to institute's application technology principle.People in the art
Member should be appreciated that invention scope involved in the application, however it is not limited to the technology that the particular combination of above-mentioned technical characteristic forms
Scheme, while should also cover in the case where not departing from the inventive concept, carried out by above-mentioned technical characteristic or its equivalent feature
The other technical schemes for being combined and being formed.Such as features described above has similar work(with (but not limited to) disclosed herein
The technical scheme that the technical characteristic of energy is replaced mutually and formed.
Claims (16)
1. a kind of control method of distributed lock, it is characterised in that methods described includes:
The locking request for the distributed lock that client is sent is received, wherein, the locking request includes the mark of the distributed lock
Know;
Perform following determination step:Determine whether the distributed lock of the locking request instruction is occupied;In response to described
Distributed lock is occupied, determines whether the distributed lock has been set expired time, if expired time has been set, obtains institute
The remaining effective time of distributed lock is stated, wherein, the remaining effective time is the difference of the expired time and current time;
Expired time is not set in response to the distributed lock or the remaining effective time is equal to zero, releases the distribution
Lock, and re-execute the determination step.
2. the control method of distributed lock according to claim 1, it is characterised in that methods described also includes:
It is more than zero in response to the remaining effective time, determines the waiting time of the client or the execution of the determination step
Number, wherein, the waiting time is the difference for the time that current time sends the locking request with the client;
It is not less than default waiting time threshold value in response to the waiting time or the execution number performs number threshold equal to default
Value, judge to lock failure, and sent to the client and lock failed message, wherein, the locking failed message includes described
The mark of distributed lock.
3. the control method of distributed lock according to claim 2, it is characterised in that methods described also includes:
It is less than the default waiting time threshold value in response to the waiting time or the execution number is less than the default execution
Frequency threshold value, then preset dormancy duration is waited, re-executes the determination step.
4. the control method of distributed lock according to claim 2, it is characterised in that the default waiting time threshold value,
The default execution frequency threshold value is that client prestore or described is sent.
5. the control method of distributed lock according to claim 1, it is characterised in that the locking request also includes described
The effective time information of distributed lock;And
The determination step also includes:
It is unoccupied in response to the distributed lock, take the distributed lock;According to the effective time information to described point
Cloth lock carries out expired time setting, and generates instruction and set whether successfully set result;Refer in response to the setting result
Show and set successfully, sent to the client and lock success message, so that the client executing is protected by the distributed lock
Business operation, wherein, the success message that locks includes the mark of the distributed lock.
6. the control method of distributed lock according to claim 5, it is characterised in that methods described also includes:
Setup failed is indicated in response to the setting result, releases the distributed lock, and re-execute the determination step.
7. the control method of distributed lock according to claim 5, it is characterised in that locked being sent to the client
After success message, methods described also includes:
When the remaining effective time of the distributed lock is zero, the distributed lock is released.
8. the control method of distributed lock according to claim 1, it is characterised in that methods described also includes:
Unlocking request in response to receiving the distributed lock from the client, release described point that the unlocking request indicates
Cloth is locked, wherein, the unlocking request includes the mark of the distributed lock.
9. a kind of control device of distributed lock, it is characterised in that described device includes:
Receiving unit, it is configured to receive the locking request for the distributed lock that client is sent, wherein, the locking request includes
The mark of the distributed lock;
Identifying unit, it is configured to carry out following determination step:Determine locking request instruction the distributed lock whether
It is occupied;It is occupied in response to the distributed lock, determine whether the distributed lock has been set expired time, if being set
Expired time is put, obtains the remaining effective time of the distributed lock, wherein, the remaining effective time is the expired time
With the difference of current time;
First lifting unit, it is configured to that expired time or the remaining effective time are not set in response to the distributed lock
Equal to zero, the distributed lock is released, the identifying unit is re-executed the determination step.
10. the control device of distributed lock according to claim 9, it is characterised in that described device also includes:
Determining unit, be configured in response to the remaining effective time be more than zero, determine the client waiting time or
The execution number of the determination step, wherein, the waiting time is that current time please with the client transmission locking
The difference for the time asked;
Transmitting element, it is configured to be not less than default waiting time threshold value or the execution number etc. in response to the waiting time
Frequency threshold value is performed in default, judges to lock failure, and is sent to the client and locks failed message, wherein, the locking
Failed message includes the mark of the distributed lock.
11. the control device of distributed lock according to claim 10, it is characterised in that described device also includes:
Unit is waited, is configured to be less than the default waiting time threshold value or the execution number in response to the waiting time
Less than the default execution frequency threshold value, then preset dormancy duration is waited, the identifying unit is re-executed the judgement step
Suddenly.
12. the control device of distributed lock according to claim 10, it is characterised in that the default waiting time threshold
Value, the default execution frequency threshold value are that client prestore or described is sent.
13. the control device of distributed lock according to claim 9, it is characterised in that the locking request also includes institute
State the effective time information of distributed lock;And
The identifying unit is further configured to:
It is unoccupied in response to the distributed lock, take the distributed lock;According to the effective time information to described point
Cloth lock carries out expired time setting, and generates instruction and set whether successfully set result;Refer in response to the setting result
Show and set successfully, sent to the client and lock success message, so that the client executing is protected by the distributed lock
Business operation, wherein, the success message that locks includes the mark of the distributed lock.
14. the control device of distributed lock according to claim 13, it is characterised in that described device also includes:
Second lifting unit, it is configured to indicate setup failed in response to the setting result, releases the distributed lock, make institute
State identifying unit and re-execute the determination step.
15. the control device of distributed lock according to claim 13, it is characterised in that described device also includes:
3rd lifting unit, it is configured to, when the remaining effective time of the distributed lock is zero, release the distributed lock.
16. the control device of distributed lock according to claim 1, it is characterised in that described device also includes:
4th lifting unit, the unlocking request in response to receiving the distributed lock from the client is configured to, releases institute
The distributed lock of unlocking request instruction is stated, wherein, the unlocking request includes the mark of the distributed lock.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610825829.4A CN107818018A (en) | 2016-09-14 | 2016-09-14 | The control method and device of distributed lock |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610825829.4A CN107818018A (en) | 2016-09-14 | 2016-09-14 | The control method and device of distributed lock |
Publications (1)
Publication Number | Publication Date |
---|---|
CN107818018A true CN107818018A (en) | 2018-03-20 |
Family
ID=61601004
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610825829.4A Pending CN107818018A (en) | 2016-09-14 | 2016-09-14 | The control method and device of distributed lock |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107818018A (en) |
Cited By (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109101528A (en) * | 2018-06-21 | 2018-12-28 | 深圳市买买提信息科技有限公司 | Data processing method, data processing equipment and electronic equipment |
CN109241128A (en) * | 2018-07-16 | 2019-01-18 | 北京百度网讯科技有限公司 | A kind of expired events automatic trigger method and system |
CN109324877A (en) * | 2018-08-15 | 2019-02-12 | 北京天元创新科技有限公司 | The method and server of data access |
CN109857527A (en) * | 2019-01-04 | 2019-06-07 | 四川虹美智能科技有限公司 | A kind of distributed task dispatching method, system, distributed devices and Redis database |
CN110188110A (en) * | 2019-05-30 | 2019-08-30 | 深圳前海微众银行股份有限公司 | A kind of method and device constructing distributed lock |
CN110262898A (en) * | 2019-06-19 | 2019-09-20 | 广州华多网络科技有限公司 | A kind of processing method and client of service request |
CN110377405A (en) * | 2019-06-17 | 2019-10-25 | 平安科技(深圳)有限公司 | The concurrent processing method and relevant device of lightweight request |
CN110597838A (en) * | 2019-09-20 | 2019-12-20 | 中国银行股份有限公司 | Information system concurrency control method, equipment and system based on time |
CN110866021A (en) * | 2019-10-16 | 2020-03-06 | 微梦创科网络科技(中国)有限公司 | Go language based locking and releasing method and system for distributed lock |
CN110941496A (en) * | 2019-12-16 | 2020-03-31 | 上海米哈游天命科技有限公司 | Distributed lock implementation method and device, computer equipment and storage medium |
CN111026807A (en) * | 2019-11-25 | 2020-04-17 | 深圳壹账通智能科技有限公司 | Distributed lock synchronization method and device, computer equipment and readable storage medium |
WO2020103275A1 (en) * | 2018-11-20 | 2020-05-28 | 平安科技(深圳)有限公司 | Money deduction control method, apparatus, and device, and readable storage medium |
CN111400324A (en) * | 2019-11-08 | 2020-07-10 | 杭州海康威视系统技术有限公司 | Method and device for locking object in cloud storage and server |
CN111913810A (en) * | 2020-07-28 | 2020-11-10 | 北京百度网讯科技有限公司 | Task execution method, device, equipment and storage medium under multi-thread scene |
CN112069025A (en) * | 2020-08-25 | 2020-12-11 | 北京五八信息技术有限公司 | Lock expiration event processing method and device |
CN112749176A (en) * | 2019-10-31 | 2021-05-04 | 上海际链网络科技有限公司 | Synchronous processing method and device of inventory data, storage medium and server |
CN113535416A (en) * | 2021-06-30 | 2021-10-22 | 北京百度网讯科技有限公司 | Method and device for realizing reentrant distributed lock, electronic equipment and storage medium |
CN113568760A (en) * | 2020-04-28 | 2021-10-29 | 北京国双科技有限公司 | Distributed lock processing method and device based on database |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7328263B1 (en) * | 2001-01-30 | 2008-02-05 | Cisco Technology, Inc. | Controlling access of concurrent users of computer resources in a distributed system using an improved semaphore counting approach |
CN103634347A (en) * | 2012-08-24 | 2014-03-12 | 腾讯科技(深圳)有限公司 | Parallel service processing method, device and system |
CN103678122A (en) * | 2013-11-29 | 2014-03-26 | 华为技术有限公司 | Deadlock detecting method, equipment and system |
CN104486328A (en) * | 2014-12-10 | 2015-04-01 | 小米科技有限责任公司 | Access control method and device |
CN105550052A (en) * | 2015-12-28 | 2016-05-04 | 东软集团股份有限公司 | Distributed lock realization method and apparatus |
-
2016
- 2016-09-14 CN CN201610825829.4A patent/CN107818018A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7328263B1 (en) * | 2001-01-30 | 2008-02-05 | Cisco Technology, Inc. | Controlling access of concurrent users of computer resources in a distributed system using an improved semaphore counting approach |
CN103634347A (en) * | 2012-08-24 | 2014-03-12 | 腾讯科技(深圳)有限公司 | Parallel service processing method, device and system |
CN103678122A (en) * | 2013-11-29 | 2014-03-26 | 华为技术有限公司 | Deadlock detecting method, equipment and system |
CN104486328A (en) * | 2014-12-10 | 2015-04-01 | 小米科技有限责任公司 | Access control method and device |
CN105550052A (en) * | 2015-12-28 | 2016-05-04 | 东软集团股份有限公司 | Distributed lock realization method and apparatus |
Non-Patent Citations (1)
Title |
---|
李静瑶: "基于Redis实现分布式锁,Redisson使用及源码分析", 《数据分析与开发》 * |
Cited By (24)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109101528A (en) * | 2018-06-21 | 2018-12-28 | 深圳市买买提信息科技有限公司 | Data processing method, data processing equipment and electronic equipment |
CN109241128A (en) * | 2018-07-16 | 2019-01-18 | 北京百度网讯科技有限公司 | A kind of expired events automatic trigger method and system |
CN109324877A (en) * | 2018-08-15 | 2019-02-12 | 北京天元创新科技有限公司 | The method and server of data access |
WO2020103275A1 (en) * | 2018-11-20 | 2020-05-28 | 平安科技(深圳)有限公司 | Money deduction control method, apparatus, and device, and readable storage medium |
CN109857527A (en) * | 2019-01-04 | 2019-06-07 | 四川虹美智能科技有限公司 | A kind of distributed task dispatching method, system, distributed devices and Redis database |
CN110188110B (en) * | 2019-05-30 | 2024-05-07 | 深圳前海微众银行股份有限公司 | Method and device for constructing distributed lock |
CN110188110A (en) * | 2019-05-30 | 2019-08-30 | 深圳前海微众银行股份有限公司 | A kind of method and device constructing distributed lock |
CN110377405A (en) * | 2019-06-17 | 2019-10-25 | 平安科技(深圳)有限公司 | The concurrent processing method and relevant device of lightweight request |
CN110262898A (en) * | 2019-06-19 | 2019-09-20 | 广州华多网络科技有限公司 | A kind of processing method and client of service request |
CN110597838A (en) * | 2019-09-20 | 2019-12-20 | 中国银行股份有限公司 | Information system concurrency control method, equipment and system based on time |
CN110866021A (en) * | 2019-10-16 | 2020-03-06 | 微梦创科网络科技(中国)有限公司 | Go language based locking and releasing method and system for distributed lock |
CN110866021B (en) * | 2019-10-16 | 2023-06-30 | 微梦创科网络科技(中国)有限公司 | Method and system for locking and unlocking distributed lock based on Go language |
CN112749176A (en) * | 2019-10-31 | 2021-05-04 | 上海际链网络科技有限公司 | Synchronous processing method and device of inventory data, storage medium and server |
CN111400324A (en) * | 2019-11-08 | 2020-07-10 | 杭州海康威视系统技术有限公司 | Method and device for locking object in cloud storage and server |
CN111400324B (en) * | 2019-11-08 | 2023-05-02 | 杭州海康威视系统技术有限公司 | Method, device and server for locking object in cloud storage |
CN111026807A (en) * | 2019-11-25 | 2020-04-17 | 深圳壹账通智能科技有限公司 | Distributed lock synchronization method and device, computer equipment and readable storage medium |
CN110941496A (en) * | 2019-12-16 | 2020-03-31 | 上海米哈游天命科技有限公司 | Distributed lock implementation method and device, computer equipment and storage medium |
CN113568760A (en) * | 2020-04-28 | 2021-10-29 | 北京国双科技有限公司 | Distributed lock processing method and device based on database |
CN111913810A (en) * | 2020-07-28 | 2020-11-10 | 北京百度网讯科技有限公司 | Task execution method, device, equipment and storage medium under multi-thread scene |
CN111913810B (en) * | 2020-07-28 | 2024-03-19 | 阿波罗智能技术(北京)有限公司 | Task execution method, device, equipment and storage medium in multithreading scene |
CN112069025A (en) * | 2020-08-25 | 2020-12-11 | 北京五八信息技术有限公司 | Lock expiration event processing method and device |
CN112069025B (en) * | 2020-08-25 | 2024-02-23 | 北京五八信息技术有限公司 | Lock expiration event processing method and device |
CN113535416A (en) * | 2021-06-30 | 2021-10-22 | 北京百度网讯科技有限公司 | Method and device for realizing reentrant distributed lock, electronic equipment and storage medium |
CN113535416B (en) * | 2021-06-30 | 2024-02-27 | 北京百度网讯科技有限公司 | Implementation method and device of reentrant distributed lock, electronic equipment and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107818018A (en) | The control method and device of distributed lock | |
CN104412272B (en) | User is set to sign in the method, system and equipment of browser | |
CN105447204B (en) | Network address recognition methods and device | |
DE102018121306A1 (en) | Identity verification while respecting privacy | |
CN107656815A (en) | Method and apparatus for controlling distributed lock | |
CN111191221A (en) | Method and device for configuring authority resources and computer readable storage medium | |
CN107544850A (en) | Method and apparatus for controlling distributed lock | |
CN111182065A (en) | Message processing method and device based on MQTT protocol and computer equipment | |
CN106716371A (en) | Method of opening APPs, electronic devices, and management server | |
CN107391277A (en) | Information processing method and device | |
CN107291769A (en) | The method and apparatus for handling concurrent order | |
CN107436831A (en) | Monitoring method and device for client server system | |
CN105141632A (en) | Method and device used for checking pages | |
DE112015003955T5 (en) | Location-specific Wi-Fi connectivity notifications | |
CN107656910A (en) | Method and apparatus for generating list | |
CN108880923A (en) | The method and apparatus that policer operation applied to application server is requested | |
EP2808820A1 (en) | Method of changing password in an industrial automation and control system | |
CN110502573A (en) | A kind of gate method of data synchronization and server | |
CN117273657A (en) | Approval method, device, equipment and storage medium | |
CN107465725A (en) | Isomery remote business disposal system and method based on CICS | |
CN107688978A (en) | The method and device of sequence information is repeated for detecting | |
CN107666499B (en) | Information storage method and device for server | |
CN107657155A (en) | Method and apparatus for identifying user's operating right | |
CN107977380B (en) | Method and device for generating page | |
US20200314190A1 (en) | De termining that multiple requests are received from a particular user device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20180320 |