CN108874552A - Distributed lock executes method, apparatus and system, application server and storage medium - Google Patents

Distributed lock executes method, apparatus and system, application server and storage medium Download PDF

Info

Publication number
CN108874552A
CN108874552A CN201810688442.8A CN201810688442A CN108874552A CN 108874552 A CN108874552 A CN 108874552A CN 201810688442 A CN201810688442 A CN 201810688442A CN 108874552 A CN108874552 A CN 108874552A
Authority
CN
China
Prior art keywords
thread
distributed lock
time
lock
cache server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810688442.8A
Other languages
Chinese (zh)
Other versions
CN108874552B (en
Inventor
张铭明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Yunyi Network Technology Co.,Ltd.
Original Assignee
Hangzhou Cloud Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Cloud Network Technology Co Ltd filed Critical Hangzhou Cloud Network Technology Co Ltd
Priority to CN201810688442.8A priority Critical patent/CN108874552B/en
Publication of CN108874552A publication Critical patent/CN108874552A/en
Application granted granted Critical
Publication of CN108874552B publication Critical patent/CN108874552B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance

Abstract

This application provides distributed locks to execute method, apparatus and system, application server and storage medium, and wherein method includes:Thread utilizes the current time obtained from cache server to generate unique time identifier, sends the locking including distributed lock information to cache server and instructs;Being distributed lock information includes current identification;Receive that cache server sends with lock that instruction is corresponding returns the result;If returning the result indicates that the thread obtains distributed lock, which simultaneously executes task operating corresponding with shared resource;The thread is after execution task operating corresponding with shared resource, in the distributed lock information that only local stores in timestamp and the distributed lock information of cache server storage under time identifier unanimous circumstances, ability release profile formula lock;If returning the result indicates that the thread does not obtain distributed lock, lock operation is robbed in thread execution.The application, which can solve multiple threads while obtain shared resource caused by distributed lock, there is the skimble-scamble problem of data.

Description

Distributed lock executes method, apparatus and system, application server and storage medium
Technical field
This application involves fields of communication technology more particularly to distributed lock to execute method, apparatus and system, application server And storage medium.
Background technique
Access shared resource with there are different process exclusives under distributed environment.Process includes one or more Thread, if the thread in multiple processes is both needed to operate shared resource, the shared money of thread accesses in different processes Exclusive reference is generally required when source, it is interfering with each other to prevent.It usually requires to use distributed lock in the case of this.
Typical Representative is Redis in distributed lock, can be distributed in Redis for the thread in a process distributed Lock, also, set distributed lock uses the time uses the accessible shared resource of the thread in the time at this.
But in Redis there are the thread of the shared resources to be visited such as some, in the distributed lock time-out of a thread In the case of, it is possible that two or more thread obtains the abnormal conditions of distributed lock.
For example, the distributed lock information of thread C1 is provided in redis with expire instruction under the mono- lab environment of Redis Out-of-service time, if the distributed lock in time is up redis is just removed, thread C2 may get distributed lock, but C1, which also has not been executed, at this time also possesses distributed lock.Thread C1 and C2 will occur and possess distributed lock.
For another example, under Redis principal and subordinate environment, thread C1 takes distributed lock in the master node A of Redis.If Master node A is delay machine before the distributed lock synchronizing information to slave node B of thread C1, then slave node B at this time At master node, and the inside does not have the distributed lock information of thread C1.At this point, thread C2 can also obtain distribution to rob lock Lock.Thread C1 and thread C2 possess distributed lock at this time.
Summary of the invention
In consideration of it, the application provides, a kind of distributed lock executes method, apparatus and system, application server and storage are situated between Matter, can solve multiple threads while obtaining shared resource caused by distributed lock and the skimble-scamble problem of data occur.
To achieve the goals above, this application provides following technical characteristics:
A kind of distributed lock executes method, applied to needing to access the multiple of same shared resource in the process of application server Thread, the distributed lock execute method and include:
Thread utilizes the current time obtained from cache server to generate unique time identifier, to the cache server The locking including distributed lock information is sent to instruct;Wherein, the distribution lock information includes the current identification;
Receive the returning the result corresponding with the locking instruction of the cache server transmission;
If it is described return the result indicate the thread obtain distributed lock, the thread accesses shared resource and execute with it is described The corresponding task operating of shared resource;
The thread is after execution task operating corresponding with the shared resource, the distributed lock that only local stores In the distributed lock information that timestamp and the cache server store in information under time identifier unanimous circumstances, institute is just discharged State distributed lock;
If described return the result indicates that the thread does not obtain distributed lock, lock operation is robbed in thread execution.
Optionally, the thread utilizes the current time obtained from cache server to generate unique time identifier, including:
The thread sending time stabs acquisition instruction to the cache server;
The thread obtains the return value of the cache server feedback;Wherein, the return value includes the buffer service The current time of device, and, the microsecond numerical value that this current second has passed;
The current time and the microsecond numerical value are formed current time stamp by the thread, which is described Time identifier.
Optionally, before sending the locking instruction including distributed lock information to the cache server, further include:
Lock mark is used as key in a distributed manner for building, using the time identifier as the key-value pair of value;
It generates and stores the distributed lock information including the key-value pair.
Optionally, before sending the locking instruction including distributed lock information to the cache server, further include:
Setting is corresponding with distributed lock to use the time;
Lock mark is used as key in a distributed manner for building, using the time identifier and the timestamp for using the time and value as The key-value pair of value;Alternatively, building in a distributed manner lock mark be used as key, with the character string of the time identifier and it is described use the time Character string merging character string as value key-value pair;
It generates and stores the distributed lock information including the key-value pair.
Optionally, timestamp is deposited with the cache server in the distributed lock information that the described thread only local stores In the distributed lock information of storage under time identifier unanimous circumstances, the distributed lock is just discharged, including:
The thread sends distributed lock acquisition of information and refers to after executing task operating corresponding with the shared resource It enables to the cache server, and receives the current distributed lock information that the cache server is sent;
When judging that time identifier is with the current distributed lock information in the distributed lock information of thread-local storage Between identify whether it is consistent;
If time identifier and time in the current distributed lock information in the distributed lock information of thread-local storage Mark is consistent, then sends the instruction of release profile formula lock to the cache server, for working as described in cache server deletion Preceding distributed lock information.
Optionally, further include:
If time identifier and time in the current distributed lock information in the distributed lock information of thread-local storage Inconsistent, the then thread throw exception prompting message is identified, executing rolling back action to the thread to trigger rollback mechanism makes the line Journey rolls back to the nearest state before obtaining distributed lock.
Optionally, lock operation is robbed in the thread execution, including:
Whether the current thread for occupying distributed lock of judgement is overtime;
If currently occupying the thread time-out of distributed lock, sends release profile formula lock and instructs to the cache server, So that cache server deletes the corresponding distributed lock information of overtime thread;The thread enters the thread and utilizes from buffer service The current time that device obtains generates unique time identifier, sends the locking including distributed lock information to the cache server The step of instruction;
If the thread for currently occupying distributed lock has not timed out, reentering the current thread for occupying distributed lock of judgement is No time-out step.
Optionally, the distributed lock information includes time identifier;The then current thread for occupying distributed lock of the judgement It is whether overtime, including:
It sends distributed lock acquisition of information to instruct to the cache server, and receives point that the cache server is sent The use time of cloth lock information, current time and distributed lock;
Calculate the difference of time identifier in the current time and the distributed lock information;
If whether the difference is greater than described using the time, then it represents that the current thread time-out for occupying distributed lock;
If the difference uses the time no more than described, then it represents that the current thread for occupying distributed lock has not timed out.
Optionally, distributed lock information includes that lock mark is as key in a distributed manner, with the time identifier and the use Key-value pair of the timestamp and value of time as value, then whether time-out includes the current thread for occupying distributed lock of the judgement:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distribution that the cache server is sent Lock information and current time;
Timestamp and value are extracted from the distributed lock information;
Judge whether the current time is greater than the timestamp and value;
If so, indicating the current thread time-out for occupying distributed lock;
If otherwise indicating, the current thread for occupying distributed lock is had not timed out.
Optionally, the distributed lock information includes that lock mark is as key in a distributed manner, with the character of the time identifier The merging character string of string and the character string using the time, then whether the current thread for occupying distributed lock of the judgement is overtime Including:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distribution that the cache server is sent Lock information and current time;
Calculate the difference of time identifier in the current time and distributed lock information;
If the difference uses the time greater than described, it is determined that the current thread time-out for occupying distributed lock;
If the difference uses the time no more than described, it is determined that the current thread for occupying distributed lock has not timed out.
A kind of distributed lock executive device, being integrated in the process of application server needs to access the multiple of same shared resource Thread, the distributed lock executive device include:
Unit is locked, utilizes the current time obtained from cache server to generate unique time identifier for thread, to The cache server sends the locking including distributed lock information and instructs;Wherein, the distribution lock information includes described current Mark;
Receiving unit, for receiving the returning the result corresponding with the locking instruction of the cache server transmission;
Access unit, if indicating that the thread obtains distributed lock, the shared money of the thread accesses for described return the result Source simultaneously executes task operating corresponding with the shared resource;
Releasing unit, for the thread after execution task operating corresponding with the shared resource, only local Time identifier is consistent in the distributed lock information that timestamp is stored with the cache server in the distributed lock information of storage In the case of, just discharge the distributed lock;
Lock unit is robbed, if indicating that the thread does not obtain distributed lock for described return the result, lock is robbed in thread execution Operation.
Optionally, thread described in the locking unit utilizes the current time obtained from cache server to generate unique Time identifier specifically includes:
Timestamp acquisition instruction transmission unit stabs acquisition instruction to the cache server for the thread sending time;
Feedback unit obtains the return value of the cache server feedback for the thread;Wherein, the return value includes The current time of the cache server, and, the microsecond numerical value that this current second has passed;
The current time and the microsecond numerical value are formed current time stamp for the thread by component units, this is current Timestamp is the time identifier.
It optionally, further include life before sending the locking instruction including distributed lock information to the cache server At distributed lock information unit.
Optionally, distributed lock information unit, including:First building key-value pair unit, for constructing lock mark in a distributed manner Know and be used as key, using the time identifier as the key-value pair of value;First generates simultaneously storage unit, for generating and storing including institute State the distributed lock information of key-value pair.
Optionally, distributed lock information unit, including:
Second building key-value pair unit, for be arranged it is corresponding with distributed lock use the time;Lock is marked in a distributed manner for building Know and be used as key, using the time identifier and the timestamp for using the time and value as the key-value pair of value;Alternatively, building is to divide Cloth lock mark be used as key, using the merging character string of the character string of the time identifier and the character string for using the time as The key-value pair of value;Second generates simultaneously storage unit, for generating and storing the distributed lock information including the key-value pair.
Optionally, the releasing unit, specifically includes:
Distributed lock information acquisition unit terminates for the thread in execution task operating corresponding with the shared resource Afterwards, it sends distributed lock acquisition of information to instruct to the cache server, and receives current point that the cache server is sent Cloth lock information;
Judging unit, time identifier and the current distribution in the distributed lock information for judging thread-local storage Whether time identifier is consistent in formula lock information;
Release profile formula locks instruction sending unit, if for time identifier in the distributed lock information of thread-local storage It is consistent with time identifier in the current distributed lock information, then it sends release profile formula lock and instructs to the cache server, So that the cache server deletes the current distributed lock information.
Optionally, further include:
Rollback unit, if for time identifier and the current distribution in the distributed lock information of thread-local storage Time identifier is inconsistent in lock information, then the thread throw exception prompting message, is executed back with triggering rollback mechanism to the thread Rolling operation makes the thread roll back to the nearest state before obtaining distributed lock.
Optionally, it is described rob lock unit and rob lock for the thread execution operate, specifically include:
Overtime unit is judged, for judging whether the thread for currently occupying distributed lock is overtime;
Release profile formula lock unit, if the thread time-out for currently occupying distributed lock, sends release profile formula lock Instruction is to the cache server, so that cache server deletes the corresponding distributed lock information of overtime thread;The thread enters The thread utilizes the current time obtained from cache server to generate unique time identifier, sends to the cache server Include the steps that the locking instruction of distributed lock information;If the thread for currently occupying distributed lock has not timed out, reenters and sentence Disconnected time-out unit.
Optionally, the distributed lock information includes time identifier;Then judge that overtime unit is currently accounted for for the judgement It is whether overtime with the thread of distributed lock, it specifically includes:
Distributed lock information unit is obtained, is instructed for obtaining transmission distributed lock acquisition of information to the buffer service Device, and receive the use time of distributed lock information, current time and distributed lock that the cache server is sent;
Calculating difference unit, for calculating the difference of time identifier in the current time and the distributed lock information;
Determination unit, if whether being greater than for the difference described using the time, then it represents that the current distributed lock that occupies Thread time-out;If the difference uses the time no more than described, then it represents that the current thread for occupying distributed lock has not timed out.
Optionally, distributed lock information includes that lock mark is as key in a distributed manner, with the time identifier and the use Key-value pair of the timestamp and value of time as value then judges overtime unit for the current line for occupying distributed lock of the judgement Whether journey is overtime, specifically includes:
Distributed lock information acquisition unit is instructed to cache server for sending distributed lock acquisition of information, and is received The distributed lock information and current time that the cache server is sent;
Extraction unit, for extracting timestamp and value from the distributed lock information;
Judging unit, for judging whether the current time is greater than the timestamp and value;
Determination unit, for if so, indicating the current thread time-out for occupying distributed lock;If otherwise indicating, current occupy is divided The thread of cloth lock has not timed out.
Optionally, the distributed lock information includes that lock mark is as key in a distributed manner, with the character of the time identifier It is distributed then to judge that overtime unit is currently occupied for the judgement for the merging character string of string and the character string using the time Whether the thread of lock is overtime, specifically includes:
Distributed lock information acquisition unit is instructed to cache server for sending distributed lock acquisition of information, and is received The distributed lock information and current time that the cache server is sent;
Calculating difference unit, for calculating the difference of time identifier in the current time and distributed lock information;
Determination unit, if using the time greater than described for the difference, it is determined that the current thread for occupying distributed lock Time-out;If the difference uses the time no more than described, it is determined that the current thread for occupying distributed lock has not timed out.
A kind of distributed lock execution system, including cache server, and, one or more to be connected with the cache server A application server;The process of application server includes the multiple threads that need to access same shared resource;
Thread in the application server process utilizes the current time obtained from cache server to generate for thread Unique time identifier sends the locking including distributed lock information to the cache server and instructs;Wherein, the distribution lock Information includes the current identification;Receive the returning the result corresponding with the locking instruction of the cache server transmission;If Described return the result indicates that the thread obtains distributed lock, then the thread accesses shared resource and execution and the shared resource pair The task operating answered;After execution task operating corresponding with the shared resource, what is only local stored divides the thread In the distributed lock information that timestamp and the cache server store in cloth lock information under time identifier unanimous circumstances, Discharge the distributed lock;If described return the result indicates that the thread does not obtain distributed lock, lock operation is robbed in thread execution.
A kind of application server, including:
Processor utilizes the current time obtained from cache server to generate unique time identifier, to institute for thread It states cache server and sends the locking instruction including distributed lock information;Wherein, the distribution lock information includes the current mark Know;Receive the returning the result corresponding with the locking instruction of the cache server transmission;If described return the result indicates to be somebody's turn to do Thread obtains distributed lock, then the thread accesses shared resource and execution task operating corresponding with the shared resource;The line After the corresponding execution task operating of shared resource described in Cheng Yu, timestamp in the distributed lock information that only local stores Under time identifier unanimous circumstances in the distributed lock information of cache server storage, the distributed lock is just discharged; If described return the result indicates that the thread does not obtain distributed lock, lock operation is robbed in thread execution;
Memory, for storing the distributed lock information.
A kind of storage medium is stored thereon with computer program, and the computer program is executed by processor, and realizes distribution Each step of formula lock execution method.
By the above technological means, following beneficial effect may be implemented:
Thread is when sending locking instruction to cache server and obtaining distributed lock in the application, cache server meeting Store the corresponding distributed lock information of the thread.
In the thread accesses shared resource and after execute task operating, can't direct release profile formula lock, but It can judge whether distributed lock is still this thread based on distributed lock information;If the distribution of the thread is locked institute's information and is worked as Preceding distributed lock information is consistent, then it represents that distributed lock is still this thread;Otherwise indicate the distributed lock of the thread by it Its thread is seized.
In order to guarantee the uniformity of shared resource, which can dish out different after finding that other threads occupy distributed lock Often to trigger rollback mechanism, to guarantee the consistency of shared data.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of application for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is a kind of structural schematic diagram of distributed lock execution system disclosed in the embodiment of the present application;
Fig. 2 is a kind of flow chart of distributed lock execution method disclosed in the embodiment of the present application;
Fig. 3 is a kind of flow chart of distributed lock execution method disclosed in the embodiment of the present application;
Fig. 4 is a kind of structural schematic diagram of distributed lock executive device disclosed in the embodiment of the present application.
Specific embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, technical solutions in the embodiments of the present application carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on Embodiment in the application, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall in the protection scope of this application.
Term is explained:
Redis:One open source write using ANSI C language, support network, it is memory-based also can persistence day Will type, Key-Value database, and the application programming interfaces of multilingual are provided.
Lock:Core is a kind of mechanism coordinating each user and using shared resource.When there are multiple user's mutual exclusions When ground uses some public resource, in order to avoid using caused modification result uncontrollable parallel, need somewhere remembering Record a label.This label can be seen by all users, in the absence of label, label can be set and obtain public affairs The right to use of resource altogether when remaining user has found that label has existed, after owning side to be marked can only be waited to discharge, then goes to attempt Setting flag.This label can be interpreted as locking.
Distributed lock:It is a kind of mode for controlling multiple user's synchronization of access shared resources between distributed system.If Multiple users share one or a set of resource, then exclusive reference shared resource is generally required when accessing these resources, It is interfering with each other to guarantee the consistency of shared resource to prevent, in this case, just need using to distributed lock.
For the ease of skilled in the art realises that, be described below distributed lock execute system.Referring to Fig. 1, distributed lock Execution system includes:Cache server 100, the one or more application server 200 being connected with cache server 100 (diagram In by taking three application servers as an example, application server 201, application server 202,203 table of application server is respectively adopted Show), the database facility 300 being connected with cache server 100.
Distributed lock may be implemented in cache server 100, and database facility 300 can store shared resource.Wherein, it caches Server 100 can realize distributed lock using Redis technology, naturally it is also possible to using the technologies such as memcached, tair come Realize distributed lock, it is not limited here.
It can apply for distributed lock to cache server 100 in multiple threads in one or more application server 200. Obtain the shared resource that the accessible database facility 300 of thread of distributed lock stores.
Distributed lock is described below and executes method, is applied to distributed lock and executes system, distributed lock executes answering for system It include the multiple threads that need to access same shared resource with the process of server.Due in one or more application server 200 The implementation procedure of multiple threads is consistent, and at this by taking a thread in an application server as an example, is executed to distributed lock Method is described.
According to one embodiment provided by the present application, a kind of embodiment of distributed lock execution method is provided.Referring to fig. 2, Including step performed below:
Thread utilizes the current time obtained from cache server to generate unique time identifier, to the cache server The locking including distributed lock information is sent to instruct;Wherein, the distribution lock information includes the current identification.This process can be with It is realized using following step S201~S206.
Wherein, the thread includes using the unique time identifier of current time generation obtained from cache server:It should Thread sending time stabs acquisition instruction to the cache server;The thread obtains the return value of the cache server feedback; Wherein, the return value includes the current time of the cache server, and, the microsecond number that this current second has passed Value;The current time and the microsecond numerical value are formed current time stamp by the thread, which is the time Mark.This process can be realized using step S202~S204.
Step S201:Thread is after determination need to access shared resource in application server 200, and corresponding point of setting shared resource Cloth lock uses the time.
Thread is in the case where determining the shared resource for itself needing access cache server 100 in application server 200, The case where shared resource being accessed according to itself, the corresponding distributed lock of setting shared resource use the time.Use the time Length application scenarios corresponding with specific process it is related, it is not limited here.
Step S202:Thread sending time stabs acquisition instruction to cache server 100 in application server 200.
For the timestamp of unified each application server, thread can be used in application server 200 in this implementation The Lua script of Redis obtains the timestamp of cache server 100, and content for script can be:Local a=redis.call ('TIME')。
Step S203:Cache server 100 extracts current time and sends return value thread into application server 200.
Wherein, return value includes two character strings, and first character string is current time (with UNIX timestamp format table Show), second character string is the microsecond numerical value passed this current second.
For example, return value a [1]=" 1332395997 ", a [2]=" 952581 ";Wherein, " 1332395997 " are caching The current time that server extracts, " 952581 " are the microsecond numerical value passed this current second.
Step S204:Thread is based on return value and calculates current time stamp in application server 200.
It is understood that two character strings in return value are overlapped available current time stamp.
Content for script is as follows:return(a[1]*1000000+a[2]).Under the example above, current time stamp is:A=" 1332395997952581"。
The beneficial effect of step S202~S204 is:
It is used uniformly the timestamp of cache server 100 in the present embodiment, rather than the time of application server 200 itself Stamp, can guarantee the consistency of the timestamp on each application server 200 in this way.
Each application server is using simultaneously operating come (simultaneously operating one for unified time stamp in compared with the existing technology As may be only accurate to a millisecond rank), the present embodiment can to avoid simultaneously operating, have preferably operability and practicability.Also, It can be as accurate as microsecond rank according to the timestamp that the method is got, improve the accuracy and consistency of timestamp.
Step S205:One key-value pair of threading building in application server 200.
It further include one key of building before sending the locking instruction including distributed lock information to the cache server Value pair.The application provides two kinds of implementations of building key-value pair:
The first implementation:Lock mark is used as key in a distributed manner for building, using the time identifier as the key-value pair of value; That is, key (key) is distributed lock mark, value (value) is current time stamp.
Second of implementation:Building in a distributed manner lock mark be used as key, with the time identifier and it is described use the time Timestamp and value as be worth key-value pair;That is, key (key) be distributed lock mark, value (value) be current time stamp and It stabs and is worth using time makeup time.
Alternatively, lock mark is used as key in a distributed manner for building, with the character string of the time identifier and described using the time Key-value pair of the merging character string of character string as value;That is, key (key) is distributed lock mark, when value (value) is current Between stab character string and using time character string series strings.
After the first implementation and second of implementation building key-value pair, generates and store including the key assignments Pair distributed lock information.
Step S206:Thread sends to cache server 100 and locks instruction in application server 200.That is, application service Thread sends the locking comprising distributed lock information to cache server 100 and instructs in device 200.
Thread realizes locking operation using redis set key if not exist instruction in application server 200.Add Lock instruction includes that the locking of distributed lock information instructs, and distributed lock information is key-value pair.Step S207:Cache server 100 Receive lock instruction, and send lock instruction return the result to thread in application server 200.
Cache server 100 judges whether there is distributed lock and identifies corresponding distributed lock after receiving locking instruction, if Have, then feedback representation is unlocked successfully returns the result.Key-value pair is stored if nothing, and feedback representation locks and successfully returns to knot Fruit.
If it is described return the result indicate the thread obtain distributed lock, the thread accesses shared resource and execute with it is described The corresponding task operating of shared resource.The step can be realized using step S208~S209.
Step S208:Whether it is to lock successfully that thread judgement returns the result in application server 200, if then entering step S209;If otherwise entering step S215.
Step S209:Thread determination returns the result to lock successfully in application server 200, then passes through cache server The shared resource of 100 access database facilities 300, and task operating is executed using shared resource is got.
In application server 200 thread determination returns the result to lock successfully, then it represents that the thread can when in use between The interior shared resource that database facility 300 is accessed by cache server 100, and using the shared resource got, to execute Task operating corresponding with the shared resource.
It is related with concrete application scene about the specific implementation of task operating, it is not limited here.
The thread is after execution task operating corresponding with the shared resource, the distributed lock that only local stores In the distributed lock information that timestamp and the cache server store in information under time identifier unanimous circumstances, institute is just discharged State distributed lock.This process specifically includes following detailed process:
The thread sends distributed lock acquisition of information and refers to after executing task operating corresponding with the shared resource It enables to the cache server, and receives the current distributed lock information that the cache server is sent;
When judging that time identifier is with the current distributed lock information in the distributed lock information of thread-local storage Between identify whether it is consistent;
If time identifier and time in the current distributed lock information in the distributed lock information of thread-local storage Mark is consistent, then sends the instruction of release profile formula lock to the cache server, for working as described in cache server deletion Preceding distributed lock information.
In addition, if in the distributed lock information of thread-local storage in time identifier and the current distributed lock information Time identifier is inconsistent, then the thread throw exception prompting message, is made with triggering rollback mechanism to thread execution rolling back action The thread rolls back to the nearest state before obtaining distributed lock.The above process can be realized using step S210~S214.
Step S210:Thread sends and divides after accessing shared resource and executing task operating in application server 200 Cloth lock information acquisition instruction is to cache server 100.
It, can release profile after application server 200 executes task operating using the shared resource got Formula lock first obtains current distributed lock information before release profile formula lock, to judge this line based on current distributed lock information Whether journey still occupies distributed lock.
Step S211:Cache server 100 obtains current distributed lock information, and sends current distributed lock information to answering With thread in server 200.
During thread executes access shared resource and executes task operating in application server 200, it is possible that Abnormal conditions, at this time it is possible that the problem of thread time-out uses distributed lock;After thread time-out, distributed lock can Can be seized by other threads, at this time cache server can store other threads distributed information (distributed lock mark be one It causes, the difference is that timestamp).
By previously mentioned it is found that distributed lock information includes the key-value pair of distributed lock.
Step S212:Thread will be used to lock in the timestamp in instruction and distributed lock information in application server 200 Timestamp compare;If consistent, S213 is entered step;S214 is entered step if inconsistent.
It is understood that being distributed in cache server 100 in the case where distributed lock is not seized by other threads Formula lock information is still the thread, and symbolic characteristic is the timestamp that timestamp should remain as the thread.
In order to untie the bell, the person who tied it is required for requirement in release for distributed lock, that is, in normal release profile formula lock, the thread It is only capable of discharging the distributed lock of this thread addition.Therefore, release profile formula lock before, first judge distributed lock whether be still This thread.That is, the timestamp in timestamp and current distributed lock information that the thread is used to lock in instruction is carried out pair Than.
If timestamp is consistent, then it represents that distributed lock is still this thread, is not seized by other threads.If inconsistent, Then the thread can be found that distributed lock is not this thread, is seized by other threads.
Step S213:If consistent, the lock instruction of release profile formula is sent to cache server 100.
It indicates that distributed lock still belongs to this thread if consistent, release profile formula lock can be sent to cache server 100 Instruction, so as to release profile formula lock, so that other threads seize distributed lock.
After cache server 100 receives distributed lock instruction, it will be deleted distributed lock and identify corresponding distributed lock information. That is, deleting the corresponding distributed lock information of this timestamp.
Step S214:If inconsistent, jettison system is abnormal, to trigger rollback mechanism.
It is the thread that the distributed lock is indicated if inconsistent not, this thread cannot discharge other thread additions at this time Distributed lock.That is, some abnormal conditions occur for the thread before the thread ends task operation, causes the thread to occupy and divide Cloth lock is beyond the time is used, so distributed lock lock is seized by other threads.
Since other threads continue judging whether distributed lock is overtime, so occupying distributed lock time-out feelings in the thread It under condition, will be locked by other thread release profile formulas and (belong to abnormal conditions when release profile formula is locked at this time, so other threads can It is whether consistent without verification time stamp in step S212 directly to discharge the distributed lock of the thread).
Since the thread time-out has used distributed lock, in order to guarantee the consistency operation of shared resource, the thread at this time Jettison system is abnormal, and shared resource is restored to the state before the thread occupies distributed lock.
The beneficial effect that step S210~S214 may be implemented:
If executing time-out after some thread obtains distributed lock:It, can if coming to rob lock without other threads It normally executes and discharges lock, because the distributed lock information in Redis is not deleted;Lock is robbed if there is other threads then can It is enough to pop up abnormal (prior art note abnormalities).At this point, the thread can not normally discharge lock, but throw exception is to trigger Rolling back action, to guarantee the consistency of shared resource.
In addition, step S210~S214 can also cleverly solve the fault-tolerance of distributed lock under Redis principal and subordinate or cluster Problem;In case where the distributed lock information stored in background technique slave node is thread C1, in thread C0 release point When cloth is locked, it is found that not being inconsistent in distributed lock information and slave node that thread C0 holds, so thread C0 is taken as surpassing When situation carry out rollback processing.Therefore, the application supports to realize distributed lock by Redis principal and subordinate or cluster.
If the returning the result corresponding with the locking instruction of server transmission, indicates that the thread does not obtain distributed lock, Then lock operation is robbed in thread execution.
Lock operation is robbed about thread execution to specifically include:Whether the current thread for occupying distributed lock of judgement is overtime;If The current thread time-out for occupying distributed lock then sends the instruction of release profile formula lock to the cache server, for caching clothes Business device deletes the corresponding distributed lock information of overtime thread;The thread is utilized into the thread works as from what cache server obtained The preceding time generates unique time identifier, and the step of the locking instruction including distributed lock information is sent to the cache server Suddenly;If the thread for currently occupying distributed lock has not timed out, reenter whether the current thread for occupying distributed lock of judgement surpasses When step.
The above process can be realized using step S215~S218.
It meets step S208 and enters step S215:Thread determination returns the result unlocked success in application server 200, then sends out Distributed lock acquisition of information is sent to instruct to cache server 100.
Step S216:Cache server 100 obtains current distributed lock information, and sends current distributed lock information to answering With thread in server 200.
The thread for holding distributed lock adds distributed lock information to cache server 100 after locking successfully.
For step S206, distributed lock information also has there are three types of implementation:
The first implementation:Distributed lock institute information includes key-value pair.
Locking instruction includes key-value pair, and key (key) is distributed lock mark, and value (value) is current time stamp.When use Between default using in advance before setting use the time.
Second of implementation:Distributed lock institute information includes key-value pair.
For the first implementation, locks and merged in the key-value pair of instruction using the time.It is understood that It is that different threads use the time can be depending on actual scene, so fitness is relatively high.
Be worth (value) be current time stamp+using the time form timestamp, alternatively, current time stamp and use the time The character string of composition.
Step S217:Thread currently holds distributed lock based on the judgement of current distributed lock information in application server 200 Thread whether exceed the time limit.If then entering step S218, if otherwise entering step S202.
For the first implementation, sends distributed lock acquisition of information and instruct to the cache server, and connect That receives distributed lock information, current time and the distributed lock that the cache server is sent uses the time;It calculates described current The difference of time identifier in time and the distributed lock information;If whether the difference is greater than described using the time, then it represents that The current thread time-out for occupying distributed lock;If the difference uses the time no more than described, then it represents that current to occupy distribution The thread of lock has not timed out.
That is, thread calculates the difference of timestamp in current time stamp and distributed lock information in application server 200, and Judge whether difference is greater than using the time.If so, indicating that the thread for currently holding distributed lock has exceeded the time limit;If otherwise indicating The thread for currently holding distributed lock does not exceed the time limit.
For second of implementation, two classes can also be segmented.
The first kind:Distributed lock information includes that lock mark is as key in a distributed manner, with the time identifier and the use The key-value pair of the timestamp of time and value as value, then the thread of the current occupancy distributed lock of judgement whether Chao Shi step packet It includes:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distribution that the cache server is sent Lock information and current time;Timestamp and value are extracted from the distributed lock information;Judge whether the current time is big In the timestamp and value;If so, indicating the current thread time-out for occupying distributed lock;If otherwise indicating current occupies distribution The thread of lock has not timed out.
Second class:Distributed lock information include in a distributed manner lock mark be used as key, with the character string of the time identifier and The merging character string of the character string using the time, then the current thread for occupying distributed lock of judgement whether Chao Shi step packet It includes:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distribution that the cache server is sent Lock information and current time;Calculate the difference of time identifier in the current time and distributed lock information;If the difference is big The time is used in described, it is determined that the current thread time-out for occupying distributed lock;If the difference uses the time no more than described, Then determine that the current thread for occupying distributed lock has not timed out.
That is, thread directly judges whether current time stamp is greater than the time in distributed lock information in application server 200 Stamp (value of key-value pair is timestamp in distributed lock information, is also exceeding the time limit the time for the thread), if more than, then it represents that when Before hold the thread of distributed lock and exceeded the time limit;If otherwise indicating, the thread for currently holding distributed lock does not exceed the time limit.
Step S218:Thread sends the instruction of release profile formula lock to cache server 100 in application server 200, enters Step S202.
Deadlock generation at this time is indicated if the thread for currently holding distributed lock has exceeded the time limit, so, application server 200 Middle thread, which is sent, deletes instruction to cache server 100.Cache server 100 directly deletes the distributed lock.Application server Thread can redefine current time stamp and execute locking operation in 200.
In the present embodiment, cache server itself no longer removes the thread of time-out, but overtime thread is found by thread, To release order to cache server transmission, having timed out for itself storage is deleted after receiving clearance order so as to cache server The corresponding distributed lock information of thread.
By foregoing description, it can be found that the present embodiment has the advantages that:
First, in the case where the thread time-out for holding distributed lock, jettison system is abnormal, to trigger rollback mechanism, thus Guarantee the consistency of shared resource.
Second, be used uniformly the timestamp of cache server in the present embodiment, rather than each application server use from The timestamp of body, it is ensured that the consistency of the timestamp on each application server.Also, it can also be taken to avoid each application The timestamp simultaneously operating of business device has preferably operability and practicability.Also, it can according to the timestamp that the method is got To be accurate to microsecond rank, the accuracy and consistency of timestamp are improved, the execution for subsequent distribution formula lock provides unified time Stamp.
Third, the application can cleverly solve the fault-tolerance of distributed lock under Redis principal and subordinate or cluster;For background skill Thread C0 and thread C1 get distributed lock in art, but the distributed lock information finally stored in slave node is line The case where journey C1, in thread C0 release profile formula lock, it is found that in distributed lock information and slave node that thread C0 holds Be not inconsistent, so thread C0 can be taken as timeout case carry out rollback processing.Therefore, the application support through Redis principal and subordinate or Person cluster realizes distributed lock.
4th, whether multiple threads may obtain in the distributed environment of principal and subordinate or in the distributed environment of cluster In the case of obtaining distributed lock, after the present embodiment adds distributed information in cache server, it just can be always ensured that buffer service There is only a distributed lock information for synchronization in device, and, the timestamp in the distributed lock information determines the distributed lock Information only corresponds to a thread.
5th, the thread for holding distributed lock under normal circumstances, remaining thread can not obtain distributed lock.Holding point In the case where the thread time-out of cloth lock, next thread to rob lock can discharge the lock of the time-out after robbing lock failure.Then Qiang Suo main forces are added and other threads continue fair play lock.
Referring to Fig. 3, the application example of the application is described below, by taking redis realizes distributed lock as an example:
1) distributed lock is initialized, and lock time-out time timeOut is set.
2) it when locking, first passes through lua script and obtains the current timestamp of redis server, then create a key and be The project of lockName, the timestamp that value is got before being.
3) start to rob lock process, first carry out redis instruction setnx key timestamp, indicate to get lock if returning to 1, Then service code is executed;Indicate that not getting lock continues waiting for lock work if returning to 0.
3) wait lock when, first judge there is currently distributed lock it is whether overtime.If it times out, release lock, then into Lock of robbing operates;If had not timed out, continue directly to rob lock.
5) after this task run is completed, release lock operation is carried out.
Release lock operation is the project deleted key in redis and be lockName, only when value is equal to current lock object In the timestamp that saves just carry out delete operation, otherwise illustrate that lock time-out has been released, throw exception needed to do rolling back action.
If executing time-out after some process obtains distributed lock:If at this moment coming to rob lock without other processes, It then can normally execute and discharge lock, because the lock record in redis is not removed;If there is other processes come to rob lock, then without Method normally discharges lock, can not discharge lock at this time, can carry out rollback processing by time-out.
The software approach that thread executes in the present embodiment can be understood as being a middleware, and the shape of packet is introduced with third party Formula is provided out.So-called middleware is exactly non-traffic technology class component.By taking Java language as an example, java application can draw Enter third-party Jar packet directly using and without its internal details of care.The software approach that thread executes can be fabricated separately At a Jar packet, for any java application calling.
It is of course also possible to which the software approach that thread is executed forms an online middleware.It is issued in the form of Web service Out, other applications are called in the form of Http;Or issue out in the form of Socket, other application is with TCP Form call.The way of realization for the software approach that the unlimited alignment journey of the application executes.
According to one embodiment provided by the present application, a kind of distributed lock executive device is provided.Referring to fig. 4, distributed lock Executive device includes:
Unit 41 is locked, utilizes the current time obtained from cache server to generate unique time identifier for thread, The locking including distributed lock information is sent to the cache server to instruct;Wherein, the distribution lock information includes described works as Preceding mark.
Wherein, locking unit 41 includes:
Timestamp acquisition instruction transmission unit 411 stabs acquisition instruction to the buffer service for the thread sending time Device;
Feedback unit 412 obtains the return value of the cache server feedback for the thread;Wherein, the return value Current time including the cache server, and, the microsecond numerical value that this current second has passed;
The current time and the microsecond numerical value are formed current time stamp for the thread, deserved by component units 413 Preceding timestamp is the time identifier.
It further include generating distribution before sending the locking instruction including distributed lock information to the cache server Two kinds of implementations of lock information:
The first implementation:First building key-value pair unit is identified as key for constructing lock in a distributed manner with described Key-value pair of the time identifier as value.First generates simultaneously storage unit, for generating and storing the distribution including the key-value pair Formula lock information.
Second of implementation:Second building key-value pair unit, for be arranged it is corresponding with distributed lock use the time;Structure Build in a distributed manner that lock mark is as key, using the time identifier and the timestamp for using the time and value as the key assignments of value It is right;Alternatively, lock mark is used as key in a distributed manner for building, with the character string of the time identifier and the character string using the time Merging character string as value key-value pair;Second generates simultaneously storage unit, generates and stores the distribution including the key-value pair Formula lock information.
Receiving unit 42, for receiving the returning the result corresponding with the locking instruction of the cache server transmission.
Access unit 43, if indicating that the thread obtains distributed lock for described return the result, the thread accesses are shared Resource simultaneously executes task operating corresponding with the shared resource.
Releasing unit 44, for the thread after execution task operating corresponding with the shared resource, only at this Timestamp is consistent with time identifier in the distributed lock information that the cache server stores in the distributed lock information of ground storage In the case where, just discharge the distributed lock.
Wherein releasing unit 44 specifically include:
Distributed lock information acquisition unit 441 is executing task operating corresponding with the shared resource for the thread After, it sends distributed lock acquisition of information and instructs to the cache server, and receive working as the cache server transmission Preceding distributed lock information.
Judging unit 442, time identifier and described current in the distributed lock information for judging thread-local storage Whether time identifier is consistent in distributed lock information.
Release profile formula locks instruction sending unit 443, if for the time in the distributed lock information of thread-local storage Mark is consistent with time identifier in the current distributed lock information, then sends the instruction of release profile formula lock to the buffer service Device, so that the cache server deletes the current distributed lock information.
Rollback unit 45, if for time identifier and the current distribution in the distributed lock information of thread-local storage Time identifier is inconsistent in formula lock information, then the thread throw exception prompting message, is executed with triggering rollback mechanism to the thread Rolling back action makes the thread roll back to the nearest state before obtaining distributed lock.
Lock unit 46 is robbed, if indicating that the thread does not obtain distributed lock for described return the result, thread execution is robbed Lock operation.Wherein, lock unit 46 is robbed to specifically include:
Overtime unit 461 is judged, for judging whether the thread for currently occupying distributed lock is overtime;If current occupy distribution The thread of formula lock has not timed out, then reenters the whether overtime step of the current thread for occupying distributed lock of judgement.
Release profile formula lock unit 462, if the thread time-out for currently occupying distributed lock, sends release profile formula Lock instruction is to the cache server, so that cache server deletes the corresponding distributed lock information of overtime thread;The thread into Entering to lock 41 execution thread of unit utilizes the current time obtained from cache server to generate unique time identifier, delays to described It deposits server and sends the locking instruction for including the steps that distributed lock information.
When the distributed lock information includes time identifier;The then current thread for occupying distributed lock of the judgement It is whether overtime, including:
It sends distributed lock acquisition of information to instruct to the cache server, and receives point that the cache server is sent The use time of cloth lock information, current time and distributed lock;It calculates in the current time and the distributed lock information The difference of time identifier;If whether the difference is greater than described using the time, then it represents that the current thread for occupying distributed lock is super When;If the difference uses the time no more than described, then it represents that the current thread for occupying distributed lock has not timed out.
Distributed lock information include in a distributed manner lock mark be used as key, with the time identifier and described using the time In the case of the key-value pair of timestamp and value as value, then whether time-out includes the current thread for occupying distributed lock of the judgement:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distribution that the cache server is sent Lock information and current time;Timestamp and value are extracted from the distributed lock information;Judge whether the current time is big In the timestamp and value;If so, indicating the current thread time-out for occupying distributed lock;If otherwise indicating current occupies distribution The thread of lock has not timed out.
It include that lock mark is as key in a distributed manner in the distributed lock information, with the character string of the time identifier and institute In the case of stating the merging character string using the character string of time, then whether the current thread for occupying distributed lock of the judgement is overtime Including:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distribution that the cache server is sent Lock information and current time;Calculate the difference of time identifier in the current time and distributed lock information;If the difference is big The time is used in described, it is determined that the current thread time-out for occupying distributed lock;If the difference uses the time no more than described, Then determine that the current thread for occupying distributed lock has not timed out.
About the concrete scheme of distributed lock executive device, embodiment shown in Fig. 2 may refer to, details are not described herein.
The application also provides a kind of application server, including:
Processor utilizes the current time obtained from cache server to generate unique time identifier, to institute for thread It states cache server and sends the locking instruction including distributed lock information;Wherein, the distribution lock information includes the current mark Know;Receive the returning the result corresponding with the locking instruction of the cache server transmission;If described return the result indicates to be somebody's turn to do Thread obtains distributed lock, then the thread accesses shared resource and execution task operating corresponding with the shared resource;The line After the corresponding execution task operating of shared resource described in Cheng Yu, timestamp in the distributed lock information that only local stores Under time identifier unanimous circumstances in the distributed lock information of cache server storage, the distributed lock is just discharged; If described return the result indicates that the thread does not obtain distributed lock, lock operation is robbed in thread execution;
Memory, for storing the distributed lock information.
Processor executes the thread and the current time obtained from cache server is utilized to generate unique time identifier step Suddenly, it specifically includes:The thread sending time stabs acquisition instruction to the cache server;The thread obtains the cache server The return value of feedback;Wherein, the return value includes the current time of the cache server, and, this current second is The microsecond numerical value passed;The current time and the microsecond numerical value are formed current time stamp, the current time stamp by the thread The as described time identifier.
Processor further includes generating before sending the locking instruction including distributed lock information to the cache server Distributed lock information may include following two kinds of implementations:
The first implementation:Lock mark is used as key in a distributed manner for building, using the time identifier as the key-value pair of value; It generates and stores the distributed lock information including the key-value pair.
Second of implementation:Setting is corresponding with distributed lock to use the time;Lock mark is used as key in a distributed manner for building, Using the time identifier and the timestamp for using the time and value as the key-value pair of value;Alternatively, lock is marked in a distributed manner for building Know and be used as key, using the merging character string of the character string of the time identifier and the character string for using the time as the key assignments of value It is right;It generates and stores the distributed lock information including the key-value pair.
Processor executes timestamp in the distributed lock information that the thread only local stores and deposits with the cache server In the distributed lock information of storage under time identifier unanimous circumstances, the distributed lock is just discharged, is specifically included:
The thread sends distributed lock acquisition of information and refers to after executing task operating corresponding with the shared resource It enables to the cache server, and receives the current distributed lock information that the cache server is sent;Judge the thread-local Whether time identifier and time identifier in the current distributed lock information are consistent in the distributed lock information of storage;If the thread Time identifier is consistent with time identifier in the current distributed lock information in the distributed lock information being locally stored, then sends and release It puts distributed lock to instruct to the cache server, so that the cache server deletes the current distributed lock information.
Processor, if being also used to time identifier and the current distribution in the distributed lock information of thread-local storage Time identifier is inconsistent in lock information, then the thread throw exception prompting message, is executed back with triggering rollback mechanism to the thread Rolling operation makes the thread roll back to the nearest state before obtaining distributed lock.
Processor executes thread execution and robs lock operation, specifically includes:Whether the current thread for occupying distributed lock of judgement Time-out;If currently occupying the thread time-out of distributed lock, sends release profile formula lock and instruct to the cache server, for Cache server deletes the corresponding distributed lock information of overtime thread;The thread is utilized into the thread and is obtained from cache server The current time taken generates unique time identifier, sends the locking including distributed lock information to the cache server and instructs The step of;If the thread for currently occupying distributed lock has not timed out, reentering the current thread for occupying distributed lock of judgement is No time-out step.
When the distributed lock information includes time identifier;It is distributed that processor executes the current occupancy of the judgement The thread of lock whether time-out procedure, specifically include:
It sends distributed lock acquisition of information to instruct to the cache server, and receives point that the cache server is sent The use time of cloth lock information, current time and distributed lock;It calculates in the current time and the distributed lock information The difference of time identifier;If whether the difference is greater than described using the time, then it represents that the current thread for occupying distributed lock is super When;If the difference uses the time no more than described, then it represents that the current thread for occupying distributed lock has not timed out.
Distributed lock information include in a distributed manner lock mark be used as key, with the time identifier and described using the time In the case of the key-value pair of timestamp and value as value, the current thread for occupying distributed lock of processor judgement whether specifically wrap by time-out It includes:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distribution that the cache server is sent Lock information and current time;Timestamp and value are extracted from the distributed lock information;Judge whether the current time is big In the timestamp and value;If so, indicating the current thread time-out for occupying distributed lock;If otherwise indicating current occupies distribution The thread of lock has not timed out.
It include that lock mark is as key in a distributed manner in the distributed lock information, with the character string of the time identifier and institute In the case of stating the merging character string using the character string of time, then whether the current thread for occupying distributed lock of the judgement is overtime Including:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distribution that the cache server is sent Lock information and current time;Calculate the difference of time identifier in the current time and distributed lock information;If the difference is big The time is used in described, it is determined that the current thread time-out for occupying distributed lock;If the difference uses the time no more than described, Then determine that the current thread for occupying distributed lock has not timed out.
Present invention also provides a kind of storage mediums, are stored thereon with computer program, and the computer program is processed Device executes, and realizes that the distributed lock executes each step of method:Thread utilizes the current time obtained from cache server Unique time identifier is generated, the locking including distributed lock information is sent to the cache server and instructs;Wherein, described point Cloth lock information includes the current identification;Receive return corresponding with the locking instruction knot that the cache server is sent Fruit;If described return the result indicates that the thread obtains distributed lock, the thread accesses shared resource and execution and shares with described The corresponding task operating of resource;The thread is only local deposited after execution task operating corresponding with the shared resource The consistent feelings of time identifier in the distributed lock information that timestamp and the cache server store in the distributed lock information of storage Under condition, the distributed lock is just discharged;If described return the result indicates that the thread does not obtain distributed lock, thread execution is robbed Lock operation.
Specific implementation about each step may refer to embodiment shown in Fig. 2, and details are not described herein.
If function described in the present embodiment method is realized in the form of SFU software functional unit and as independent product pin It sells or in use, can store in a storage medium readable by a compute device.Based on this understanding, the embodiment of the present application The part of the part that contributes to existing technology or the technical solution can be embodied in the form of software products, this is soft Part product is stored in a storage medium, including some instructions are used so that calculating equipment (it can be personal computer, Server, mobile computing device or network equipment etc.) execute all or part of step of each embodiment the method for the application Suddenly.And storage medium above-mentioned includes:USB flash disk, read-only memory (ROM, Read-Only Memory), is deposited mobile hard disk at random The various media that can store program code such as access to memory (RAM, Random Access Memory), magnetic or disk.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with it is other The difference of embodiment, same or similar part may refer to each other between each embodiment.
The foregoing description of the disclosed embodiments makes professional and technical personnel in the field can be realized or use the application. Various modifications to these embodiments will be readily apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the application.Therefore, the application It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest scope of cause.

Claims (14)

1. a kind of distributed lock executes method, which is characterized in that same shared applied to needing to access in the process of application server Multiple threads of resource, the distributed lock execute method and include:
Thread utilizes the current time obtained from cache server to generate unique time identifier, sends to the cache server Locking instruction including distributed lock information;Wherein, the distribution lock information includes the current identification;
Receive the returning the result corresponding with the locking instruction of the cache server transmission;
If described return the result indicates that the thread obtains distributed lock, the thread accesses shared resource and execution and shares with described The corresponding task operating of resource;
The thread is after execution task operating corresponding with the shared resource, the distributed lock information that only local stores In middle timestamp and the distributed lock information of cache server storage under time identifier unanimous circumstances, just release is described divides Cloth lock;
If described return the result indicates that the thread does not obtain distributed lock, lock operation is robbed in thread execution.
2. the method as described in claim 1, which is characterized in that the thread utilizes the current time obtained from cache server Unique time identifier is generated, including:
The thread sending time stabs acquisition instruction to the cache server;
The thread obtains the return value of the cache server feedback;Wherein, the return value includes the cache server Current time, and, the microsecond numerical value that this current second has passed;
The current time and the microsecond numerical value are formed current time stamp by the thread, which is the time Mark.
3. method according to claim 2, which is characterized in that send to the cache server including distributed lock information Locking instruction before, further include:
Lock mark is used as key in a distributed manner for building, using the time identifier as the key-value pair of value;
It generates and stores the distributed lock information including the key-value pair.
4. method according to claim 2, which is characterized in that send to the cache server including distributed lock information Locking instruction before, further include:
Setting is corresponding with distributed lock to use the time;
Lock mark is used as key in a distributed manner for building, using the time identifier and the timestamp for using the time and value as value Key-value pair;Alternatively, lock mark is used as key in a distributed manner for building, with the character string of the time identifier and the word using the time Accord with key-value pair of the merging character string of string as value;
It generates and stores the distributed lock information including the key-value pair.
5. the method as described in claim 1, which is characterized in that in the distributed lock information that the described thread only local stores In timestamp and the distributed lock information of cache server storage under time identifier unanimous circumstances, the distribution is just discharged Formula lock, including:
The thread after executing task operating corresponding with the shared resource, send distributed lock acquisition of information instruct to The cache server, and receive the current distributed lock information that the cache server is sent;
Judge that time identifier is marked with the time in the current distributed lock information in the distributed lock information of thread-local storage Whether consistent know;
If time identifier and time identifier in the current distributed lock information in the distributed lock information of thread-local storage Unanimously, then the instruction of release profile formula lock is sent to the cache server, so that the cache server deletes described current point Cloth lock information.
6. method as claimed in claim 5, which is characterized in that further include:
If time identifier and time identifier in the current distributed lock information in the distributed lock information of thread-local storage Inconsistent, then the thread throw exception prompting message, returns the thread to trigger rollback mechanism to thread execution rolling back action The nearest state being rolled into before obtaining distributed lock.
7. the method as described in claim 1, which is characterized in that lock operation is robbed in the thread execution, including:
Whether the current thread for occupying distributed lock of judgement is overtime;
If currently occupying the thread time-out of distributed lock, sends release profile formula lock and instruct to the cache server, for Cache server deletes the corresponding distributed lock information of overtime thread;The thread is utilized into the thread and is obtained from cache server The current time taken generates unique time identifier, sends the locking including distributed lock information to the cache server and instructs The step of;
If the thread for currently occupying distributed lock has not timed out, reenter whether the current thread for occupying distributed lock of judgement surpasses When step.
8. the method for claim 7, which is characterized in that the distributed lock information includes time identifier;It is then described to sentence Whether the disconnected current thread for occupying distributed lock is overtime, including:
It sends distributed lock acquisition of information to instruct to the cache server, and receives the distribution that the cache server is sent The use time of lock information, current time and distributed lock;
Calculate the difference of time identifier in the current time and the distributed lock information;
If whether the difference is greater than described using the time, then it represents that the current thread time-out for occupying distributed lock;
If the difference uses the time no more than described, then it represents that the current thread for occupying distributed lock has not timed out.
9. the method for claim 7, which is characterized in that distributed lock information includes locking mark in a distributed manner to be used as key, Using the time identifier and the timestamp for using the time and value as the key-value pair of value, then the judgement is current occupies distribution Whether time-out includes the thread of formula lock:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distributed lock letter that the cache server is sent Breath and current time;
Timestamp and value are extracted from the distributed lock information;
Judge whether the current time is greater than the timestamp and value;
If so, indicating the current thread time-out for occupying distributed lock;
If otherwise indicating, the current thread for occupying distributed lock is had not timed out.
10. the method for claim 7, which is characterized in that the distributed lock information includes locking mark in a distributed manner to make For key, with the merging character string of the character string of the time identifier and the character string using the time, then the judgement is current Whether time-out includes the thread of occupancy distributed lock:
It sends distributed lock acquisition of information to instruct to cache server, and receives the distributed lock letter that the cache server is sent Breath and current time;
Calculate the difference of time identifier in the current time and distributed lock information;
If the difference uses the time greater than described, it is determined that the current thread time-out for occupying distributed lock;
If the difference uses the time no more than described, it is determined that the current thread for occupying distributed lock has not timed out.
11. a kind of distributed lock executive device, which is characterized in that being integrated in the process of application server needs to access same share Multiple threads of resource, the distributed lock executive device include:
Unit is locked, utilizes the unique time identifier of the current time obtained from cache server generation for thread, to described Cache server sends the locking including distributed lock information and instructs;Wherein, the distribution lock information includes the current identification;
Receiving unit, for receiving the returning the result corresponding with the locking instruction of the cache server transmission;
Access unit, if indicating that the thread obtains distributed lock for described return the result, the thread accesses shared resource is simultaneously Execute task operating corresponding with the shared resource;
Releasing unit is only local stored for the thread after execution task operating corresponding with the shared resource Distributed lock information in timestamp and the cache server storage distributed lock information in time identifier unanimous circumstances Under, just discharge the distributed lock;
Lock unit is robbed, if indicating that the thread does not obtain distributed lock for described return the result, lock operation is robbed in thread execution.
12. a kind of distributed lock executes system, which is characterized in that including cache server, and, it is connected with the cache server One or more application server;The process of application server includes the multiple threads that need to access same shared resource;
Thread in the application server process utilizes the current time obtained from cache server to generate unique for thread Time identifier, to the cache server send include distributed lock information locking instruct;Wherein, the distribution lock information Including the current identification;Receive the returning the result corresponding with the locking instruction of the cache server transmission;If described Return the result indicate the thread obtain distributed lock, then the thread accesses shared resource and execute it is corresponding with the shared resource Task operating;The thread is after execution task operating corresponding with the shared resource, the distribution that only local stores In the distributed lock information that timestamp and the cache server store in lock information under time identifier unanimous circumstances, just discharge The distributed lock;If described return the result indicates that the thread does not obtain distributed lock, lock operation is robbed in thread execution.
13. a kind of application server, which is characterized in that including:
Processor utilizes the current time obtained from cache server to generate unique time identifier, delays to described for thread It deposits server and sends the locking instruction including distributed lock information;Wherein, the distribution lock information includes the current identification;It connects Receive the returning the result corresponding with the locking instruction of the cache server transmission;If described return the result indicates that the thread obtains Distributed lock is obtained, then the thread accesses shared resource and execution task operating corresponding with the shared resource;The thread with After the corresponding execution task operating of the shared resource, in the distributed lock information that only local stores timestamp with it is described In the distributed lock information of cache server storage under time identifier unanimous circumstances, the distributed lock is just discharged;If described Returning the result indicates that the thread does not obtain distributed lock, then lock operation is robbed in thread execution;
Memory, for storing the distributed lock information.
14. a kind of storage medium, is stored thereon with computer program, which is characterized in that the computer program is held by processor Row realizes that the described in any item distributed locks of claim 1-10 such as execute each step of method.
CN201810688442.8A 2018-06-28 2018-06-28 Distributed lock execution method, device and system, application server and storage medium Active CN108874552B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810688442.8A CN108874552B (en) 2018-06-28 2018-06-28 Distributed lock execution method, device and system, application server and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810688442.8A CN108874552B (en) 2018-06-28 2018-06-28 Distributed lock execution method, device and system, application server and storage medium

Publications (2)

Publication Number Publication Date
CN108874552A true CN108874552A (en) 2018-11-23
CN108874552B CN108874552B (en) 2021-09-21

Family

ID=64296497

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810688442.8A Active CN108874552B (en) 2018-06-28 2018-06-28 Distributed lock execution method, device and system, application server and storage medium

Country Status (1)

Country Link
CN (1) CN108874552B (en)

Cited By (33)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109743366A (en) * 2018-12-21 2019-05-10 苏宁易购集团股份有限公司 A kind of resource locking method, apparatus and system for scene of more living
CN110162384A (en) * 2019-04-19 2019-08-23 深圳壹账通智能科技有限公司 Time-out time dynamic adjusting method and system based on Redis distributed lock
CN110377405A (en) * 2019-06-17 2019-10-25 平安科技(深圳)有限公司 The concurrent processing method and relevant device of lightweight request
CN110677465A (en) * 2019-09-09 2020-01-10 北京信安世纪科技股份有限公司 Control method and device of distributed lock
CN110866021A (en) * 2019-10-16 2020-03-06 微梦创科网络科技(中国)有限公司 Go language based locking and releasing method and system for distributed lock
CN110888858A (en) * 2019-10-29 2020-03-17 北京奇艺世纪科技有限公司 Database operation method and device, storage medium and electronic device
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
CN111158878A (en) * 2019-12-30 2020-05-15 北京三快在线科技有限公司 Resource transfer request thread control method, device and storage medium
CN111208949A (en) * 2020-01-13 2020-05-29 上海依图网络科技有限公司 Method for determining data rollback time period in distributed storage system
CN111258976A (en) * 2018-12-03 2020-06-09 北京京东尚科信息技术有限公司 Distributed lock implementation method, system, device and storage medium
CN111259030A (en) * 2020-01-16 2020-06-09 平安医疗健康管理股份有限公司 Thread execution method and device based on distributed lock and storage medium
CN111258771A (en) * 2020-01-16 2020-06-09 青木数字技术股份有限公司 Method and system for realizing distributed lock based on Raft algorithm
CN111324622A (en) * 2020-02-20 2020-06-23 中国建设银行股份有限公司 Resource first-aid-purchase processing method, device, equipment and storage medium
CN111352948A (en) * 2020-03-31 2020-06-30 中国建设银行股份有限公司 Data processing method, device, equipment and storage medium
CN111405015A (en) * 2020-03-09 2020-07-10 中国建设银行股份有限公司 Data processing method, device, equipment and storage medium
CN111400330A (en) * 2020-03-13 2020-07-10 深圳前海微众银行股份有限公司 Task processing method, device, equipment and computer readable storage medium
CN111459963A (en) * 2020-04-07 2020-07-28 中国建设银行股份有限公司 Core accounting transaction concurrent processing method and device
CN111552474A (en) * 2020-03-26 2020-08-18 平安医疗健康管理股份有限公司 Processing method and device for executing distributed lock operation
CN111722934A (en) * 2020-06-12 2020-09-29 南京甄视智能科技有限公司 Distributed timing task processing method and system
WO2020211372A1 (en) * 2019-04-16 2020-10-22 平安科技(深圳)有限公司 Method and device for data buffering, and computer device
CN111880909A (en) * 2020-07-27 2020-11-03 平安科技(深圳)有限公司 Distributed data publishing method and device
CN112486696A (en) * 2020-12-11 2021-03-12 上海悦易网络信息技术有限公司 Method and equipment for acquiring distributed lock
CN112650776A (en) * 2020-11-03 2021-04-13 重庆盈熙横纵信息技术有限公司 Redis-based distributed lock implementation method, storage device and server
CN112835982A (en) * 2021-02-26 2021-05-25 浪潮云信息技术股份公司 Table lock implementation method based on distributed database
CN113127570A (en) * 2021-05-18 2021-07-16 上海莉莉丝科技股份有限公司 Data operation method, system, equipment and storage medium of distributed server
CN113138992A (en) * 2020-01-19 2021-07-20 上海静客网络科技有限公司 Method for constructing distributed lock
CN113282580A (en) * 2021-04-28 2021-08-20 青岛海尔科技有限公司 Method, storage medium and server for executing timed task
CN113342507A (en) * 2021-07-07 2021-09-03 湖南四方天箭信息科技有限公司 Distributed lock service implementation method and device and computer equipment
CN114679464A (en) * 2022-03-24 2022-06-28 未鲲(上海)科技服务有限公司 Data rollback method, device, equipment and storage medium based on distributed lock
CN115878696A (en) * 2023-03-06 2023-03-31 中国西安卫星测控中心 High-availability method and device for distributed data processing cluster
CN116389579A (en) * 2023-03-22 2023-07-04 安芯网盾(北京)科技有限公司 Report generation method and system based on micro-service
CN117520362A (en) * 2024-01-04 2024-02-06 北京佳讯飞鸿电气股份有限公司 Data management system, method, equipment and storage medium based on distributed lock

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1798645A1 (en) * 2005-12-13 2007-06-20 Deutsche Thomson-Brandt Gmbh Method and apparatus for protecting a data set
CN104268024A (en) * 2014-09-24 2015-01-07 浪潮(北京)电子信息产业有限公司 Method and device for achieving process mutual exclusion
CN107656815A (en) * 2016-07-26 2018-02-02 北京京东尚科信息技术有限公司 Method and apparatus for controlling distributed lock

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1798645A1 (en) * 2005-12-13 2007-06-20 Deutsche Thomson-Brandt Gmbh Method and apparatus for protecting a data set
CN104268024A (en) * 2014-09-24 2015-01-07 浪潮(北京)电子信息产业有限公司 Method and device for achieving process mutual exclusion
CN107656815A (en) * 2016-07-26 2018-02-02 北京京东尚科信息技术有限公司 Method and apparatus for controlling distributed lock

Cited By (47)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111258976A (en) * 2018-12-03 2020-06-09 北京京东尚科信息技术有限公司 Distributed lock implementation method, system, device and storage medium
CN109743366A (en) * 2018-12-21 2019-05-10 苏宁易购集团股份有限公司 A kind of resource locking method, apparatus and system for scene of more living
WO2020211372A1 (en) * 2019-04-16 2020-10-22 平安科技(深圳)有限公司 Method and device for data buffering, and computer device
CN110162384A (en) * 2019-04-19 2019-08-23 深圳壹账通智能科技有限公司 Time-out time dynamic adjusting method and system based on Redis distributed lock
CN110162384B (en) * 2019-04-19 2023-04-28 深圳壹账通智能科技有限公司 Redis distributed lock-based timeout time dynamic adjustment method and system
CN110377405A (en) * 2019-06-17 2019-10-25 平安科技(深圳)有限公司 The concurrent processing method and relevant device of lightweight request
CN110677465A (en) * 2019-09-09 2020-01-10 北京信安世纪科技股份有限公司 Control method and device of distributed lock
CN110866021A (en) * 2019-10-16 2020-03-06 微梦创科网络科技(中国)有限公司 Go language based locking and releasing method and system for distributed lock
CN110888858A (en) * 2019-10-29 2020-03-17 北京奇艺世纪科技有限公司 Database operation method and device, storage medium and electronic device
CN110888858B (en) * 2019-10-29 2023-06-30 北京奇艺世纪科技有限公司 Database operation method and device, storage medium and electronic device
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
CN111158878A (en) * 2019-12-30 2020-05-15 北京三快在线科技有限公司 Resource transfer request thread control method, device and storage medium
CN111158878B (en) * 2019-12-30 2023-08-29 北京三快在线科技有限公司 Resource transfer request thread control method, device and storage medium
CN111208949A (en) * 2020-01-13 2020-05-29 上海依图网络科技有限公司 Method for determining data rollback time period in distributed storage system
CN111259030A (en) * 2020-01-16 2020-06-09 平安医疗健康管理股份有限公司 Thread execution method and device based on distributed lock and storage medium
CN111258771A (en) * 2020-01-16 2020-06-09 青木数字技术股份有限公司 Method and system for realizing distributed lock based on Raft algorithm
CN113138992A (en) * 2020-01-19 2021-07-20 上海静客网络科技有限公司 Method for constructing distributed lock
CN111324622A (en) * 2020-02-20 2020-06-23 中国建设银行股份有限公司 Resource first-aid-purchase processing method, device, equipment and storage medium
CN111405015B (en) * 2020-03-09 2022-09-30 中国建设银行股份有限公司 Data processing method, device, equipment and storage medium
CN111405015A (en) * 2020-03-09 2020-07-10 中国建设银行股份有限公司 Data processing method, device, equipment and storage medium
CN111400330A (en) * 2020-03-13 2020-07-10 深圳前海微众银行股份有限公司 Task processing method, device, equipment and computer readable storage medium
CN111400330B (en) * 2020-03-13 2024-04-09 深圳前海微众银行股份有限公司 Task processing method, device, equipment and computer readable storage medium
CN111552474A (en) * 2020-03-26 2020-08-18 平安医疗健康管理股份有限公司 Processing method and device for executing distributed lock operation
CN111552474B (en) * 2020-03-26 2022-03-18 平安医疗健康管理股份有限公司 Processing method and device for executing distributed lock operation
CN111352948B (en) * 2020-03-31 2023-12-26 中国建设银行股份有限公司 Data processing method, device, equipment and storage medium
CN111352948A (en) * 2020-03-31 2020-06-30 中国建设银行股份有限公司 Data processing method, device, equipment and storage medium
CN111459963B (en) * 2020-04-07 2024-03-15 中国建设银行股份有限公司 Concurrent processing method and device for core accounting transaction
CN111459963A (en) * 2020-04-07 2020-07-28 中国建设银行股份有限公司 Core accounting transaction concurrent processing method and device
CN111722934A (en) * 2020-06-12 2020-09-29 南京甄视智能科技有限公司 Distributed timing task processing method and system
CN111880909A (en) * 2020-07-27 2020-11-03 平安科技(深圳)有限公司 Distributed data publishing method and device
CN112650776A (en) * 2020-11-03 2021-04-13 重庆盈熙横纵信息技术有限公司 Redis-based distributed lock implementation method, storage device and server
CN112486696A (en) * 2020-12-11 2021-03-12 上海悦易网络信息技术有限公司 Method and equipment for acquiring distributed lock
CN112835982B (en) * 2021-02-26 2023-03-24 浪潮云信息技术股份公司 Table lock implementation method based on distributed database
CN112835982A (en) * 2021-02-26 2021-05-25 浪潮云信息技术股份公司 Table lock implementation method based on distributed database
CN113282580A (en) * 2021-04-28 2021-08-20 青岛海尔科技有限公司 Method, storage medium and server for executing timed task
CN113127570A (en) * 2021-05-18 2021-07-16 上海莉莉丝科技股份有限公司 Data operation method, system, equipment and storage medium of distributed server
CN113127570B (en) * 2021-05-18 2022-11-04 上海莉莉丝科技股份有限公司 Data operation method, system, equipment and storage medium of distributed server
CN113342507A (en) * 2021-07-07 2021-09-03 湖南四方天箭信息科技有限公司 Distributed lock service implementation method and device and computer equipment
CN113342507B (en) * 2021-07-07 2024-03-29 湖南四方天箭信息科技有限公司 Distributed lock service realization method and device and computer equipment
CN114679464A (en) * 2022-03-24 2022-06-28 未鲲(上海)科技服务有限公司 Data rollback method, device, equipment and storage medium based on distributed lock
CN114679464B (en) * 2022-03-24 2024-02-13 深圳九有数据库有限公司 Data rollback method, device, equipment and storage medium based on distributed lock
CN115878696B (en) * 2023-03-06 2023-04-28 中国西安卫星测控中心 High availability method and device for distributed data processing cluster
CN115878696A (en) * 2023-03-06 2023-03-31 中国西安卫星测控中心 High-availability method and device for distributed data processing cluster
CN116389579A (en) * 2023-03-22 2023-07-04 安芯网盾(北京)科技有限公司 Report generation method and system based on micro-service
CN117520362A (en) * 2024-01-04 2024-02-06 北京佳讯飞鸿电气股份有限公司 Data management system, method, equipment and storage medium based on distributed lock
CN117520362B (en) * 2024-01-04 2024-04-12 北京佳讯飞鸿电气股份有限公司 Data management system, method, equipment and storage medium based on distributed lock

Also Published As

Publication number Publication date
CN108874552B (en) 2021-09-21

Similar Documents

Publication Publication Date Title
CN108874552A (en) Distributed lock executes method, apparatus and system, application server and storage medium
US7805482B2 (en) Method of correlating events in data packet streams
KR100210208B1 (en) Method and apparatus for enabling persistent attributes in an object oriented environment
CN109753364A (en) A kind of implementation method, equipment and the medium of network-based distributed lock
CN102831156B (en) Distributed transaction processing method on cloud computing platform
US6108654A (en) Method and system for locking resources in a computer system
US5923833A (en) Restart and recovery of OMG-compliant transaction systems
CN106878376B (en) Configuration management method and system
US7328213B2 (en) Transaction processing method, transaction control apparatus and program thereof
CN102681836B (en) The system and method being extended for a large amount of concurrent users
CN101043378B (en) Fail-safe system for managing of client-server communication
CN108038005A (en) Shared resource access method, client, server-side, system based on zookeeper
CN108717380B (en) Message processing method and device
CN111258771A (en) Method and system for realizing distributed lock based on Raft algorithm
CN105740042B (en) The management method and management system of virutal machine memory
CN108255610A (en) A kind of message broker Transmission system
CN111858677A (en) Local cache data access method, device, equipment and storage medium
CN113553153A (en) Service data processing method and device and micro-service architecture system
US20090100082A1 (en) Replication and mapping mechanism for recreating memory durations
CN113138992A (en) Method for constructing distributed lock
CN106210038B (en) The processing method and system of data operation request
CN106776076B (en) A kind of method and system for realizing MongoDB transaction management
CN115220891A (en) Method for processing high-concurrency batch tasks and related product
US10489213B2 (en) Execution of a method at a cluster of nodes
CN112565467A (en) Service processing method, device and storage 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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200731

Address after: 310000 2 6th Floor, No. 3588 Jiangnan Avenue, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Hangzhou Yunyi Network Technology Co.,Ltd.

Address before: 310053 9 floor, 2 building, 3588 Jiangnan Road, Binjiang District, Hangzhou, Zhejiang.

Applicant before: HANGZHOU YUN-IN NETWORK TECHNOLOGY Co.,Ltd.

GR01 Patent grant
GR01 Patent grant