CN115801864B - Method, system, device and storage medium for controlling resource locking time - Google Patents

Method, system, device and storage medium for controlling resource locking time Download PDF

Info

Publication number
CN115801864B
CN115801864B CN202211312779.1A CN202211312779A CN115801864B CN 115801864 B CN115801864 B CN 115801864B CN 202211312779 A CN202211312779 A CN 202211312779A CN 115801864 B CN115801864 B CN 115801864B
Authority
CN
China
Prior art keywords
service
resource
time
business
lock
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.)
Active
Application number
CN202211312779.1A
Other languages
Chinese (zh)
Other versions
CN115801864A (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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN202211312779.1A priority Critical patent/CN115801864B/en
Publication of CN115801864A publication Critical patent/CN115801864A/en
Application granted granted Critical
Publication of CN115801864B publication Critical patent/CN115801864B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Lock And Its Accessories (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a control method, a system, a device and a storage medium for resource locking time, wherein the method comprises the following steps: the business service applies for the resource locking to the resource service, and locks the serial program to be executed. After the business service obtains the execution authority, executing the serial program, updating the business execution state as in progress, and registering the business service state into the monitoring service. The traffic service timing communicates traffic service execution status to the monitoring service. The monitoring service updates the expiration time of the resource lock of the resource service according to the business service state, and sends a time update instruction to the resource server, and the expiration time is reset by the resource service. When the monitoring service cannot monitor the service execution state, an unlocking instruction is sent to the resource service; and after the business service is completed, sending an unlocking instruction to the resource service. And the resource service performs resource unlocking after receiving the unlocking instruction. The invention can prolong the time of resource locking according to the execution state of business service in time under the monitoring of the monitoring service.

Description

Method, system, device and storage medium for controlling resource locking time
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, a system, an apparatus, and a storage medium for controlling resource locking time.
Background
When a service application program needs to control a certain resource independently in a high concurrency environment, the resource needs to be locked, the service for obtaining the resource executes a corresponding program, a process which does not obtain the resource lock needs to wait until the process for obtaining the resource lock is executed to release the lock, the resource lock is obtained, a corresponding serial program is executed, and the multi-service process executes a certain section of resource codes in serial.
In a distributed scenario, the services of the resource service and the business service process are often on different servers, which has a problem that the business server controls the locking time of the resource, and if the locking time is too long, the response speed of the business application is affected; if the locking time is too short, the service is not executed yet, other services enter a resource critical area to be executed, and the exclusive sharing of the resources cannot be controlled. Thus, for a distributed scenario, controlling the lock time of a resource is a difficult problem to determine.
At present, in order to solve the problem of controlling the locking time of a resource, the locking expiration time is mainly set when a service locks the resource, and the resource service releases the locking of the service after the expiration of the time, so that the designated time of the service when locking is estimated by a time according to the execution time of the service, which is generally longer than the time used by the service to execute a serial program. However, as the traffic volume increases, the service execution time may become longer, and the resource lock expiration time is set too long, which may affect the execution of other service. Once the service execution time exceeds the expiration time of the resource lock, the resource service can be caused to delete the lock of the service, and other service services are allowed to lock the resource, so that the resource is shared and executed by two service services at the same time. Therefore, the existing scheme does not fundamentally solve the problem of the resource locking time.
Disclosure of Invention
In view of the above problems, an object of the present invention is to provide a method, a system, a device, and a storage medium for controlling a resource lock time, which can prolong the resource lock time in time according to a service execution state under the monitoring of a monitoring service.
The invention aims to achieve the aim, and the aim is achieved by the following technical scheme: a control method of resource locking time includes:
Deploying resource services and monitoring services;
the business service applies for the resource locking to the resource service, sets the lock expiration time, takes the lock under the concurrency of the multi-business service, and locks the serial program to be executed;
after the business service obtains the execution authority, executing the serial program, updating the business execution state as in progress, and registering the business service state into the monitoring service;
the business service sends heartbeat data packets to the monitoring service within a specified time to convey the execution state of the business service; the monitoring service updates the expiration time of the resource lock of the resource service according to the business service state and whether the locking time is about to expire, and sends a time update instruction to the resource server;
After receiving the time update instruction, the resource service resets the expiration time of the resource lock of the resource service;
When the monitoring service cannot monitor the service execution state, an unlocking instruction is sent to the resource service;
after the business service is completed, an unlocking instruction is sent to the resource service;
And the resource service performs resource unlocking after receiving the unlocking instruction.
Further, the deploying the resource service and the monitoring service includes:
The resource service is deployed on the redis server, and the monitoring service is deployed on the netty server.
Further, the service applies for locking the resource to the resource service, sets the lock expiration time, takes the lock under the concurrency of the multiple service, and locks the serial program to be executed, including:
the service sets a variable SERVICEID on the redis server, and if the variable does not exist, the service is set successfully, i.e. the resource lock is acquired, and the serial program to be executed is locked.
Further, after the service obtains the execution authority, executing the serial program, updating the service execution state as in progress, and registering the service state into the monitoring service, including:
After the service acquires the resource lock, the address port of the service, the variable name set on the redis server and the set variable expiration time are used as registration information to be sent to the netty server, and the address and the port of the service are sent to the redis server and stored in the URL variable;
And netty, after receiving the registration information, the server starts the monitoring service.
Further, the service sends a heartbeat packet to the monitoring service within a specified time to convey the service execution status, including:
The business service updates the business service state according to the execution condition of the serial codes;
and generating a heartbeat data packet from the business service state and sending the heartbeat data packet to the netty server at regular time.
Further, the monitoring service updates the expiration time of the resource lock of the resource service according to the business service state and whether the locking time is about to expire, including:
And netty, after the heartbeat data packet, the server judges the service state of the business in the heartbeat data packet, if the service state is the unfinished state, the current time is compared with the expiration time of the resource service resource lock, and if the current time exceeds the preset time difference, a request is sent to the redis server, and the expiration time of the resource service resource lock is reset.
Further, when the monitoring service cannot monitor the service execution state, sending an unlocking instruction to the resource service, including:
If netty server judges that the business service state is the completion state, then sending a request to the redis server to obtain the URL variable value on the redis server;
comparing the obtained URL variable value with the address and port information of the service server;
If the two types of information are consistent, the netty server sends an unlocking request to the redis server; if not, no unlock request is sent to the redis server.
Correspondingly, the invention also discloses a control system of the resource locking time, which comprises the following steps:
the deployment module is used for deploying the resource service and the monitoring service;
the resource locking module is used for applying resource locking to the resource service by the business service, setting lock expiration time, taking the lock under the concurrency of the multi-business service, and locking a serial program to be executed;
the registration module is used for executing the serial program after the business service acquires the execution authority, updating the business execution state into the in-process state and registering the business service state into the monitoring service;
The monitoring data transmission module is used for transmitting heartbeat data packets to the monitoring service in a specified time by the business service and conveying the execution state of the business service;
The updating judging module is used for updating the expiration time of the resource lock of the resource service according to the service state of the monitoring service and whether the locking time is about to expire, and sending a time updating instruction to the resource server;
The locking time updating module is used for resetting the expiration time of the resource lock of the resource service after the resource service receives the time updating instruction;
the first unlocking judging module is used for sending an unlocking instruction to the resource service when the monitoring service cannot monitor the service execution state;
The second unlocking judging module is used for sending an unlocking instruction to the resource service after the business service is completed;
and the unlocking module is used for unlocking the resources after the resource service receives the unlocking instruction.
Correspondingly, the invention discloses a control device for the resource locking time, which comprises the following steps:
A memory for storing a control program of the resource lock time;
a processor, configured to implement the steps of the method for controlling a resource lock time according to any one of the above when executing the control program for a resource lock time.
Accordingly, the invention discloses a readable storage medium, wherein the readable storage medium stores a control program of the resource locking time, and the control program of the resource locking time realizes the steps of the control method of the resource locking time when being executed by a processor.
Compared with the prior art, the invention has the beneficial effects that: a method, a system, a device and a storage medium for controlling the locking time of resources are provided, wherein a monitoring service is deployed between a business service and a resource service, the monitoring service is utilized to monitor after acquiring resources of the business service, the expiration time can be updated according to the execution state of the business, the business is ensured to be completed within the locking time, and the locking state of the resources is released after the completion of the execution of the business is monitored.
The invention monitors the time of the resource lock in real time through the monitoring service, and performs dynamic monitoring setting between the monitoring service and the business service, thereby ensuring that the business service independently executes serial codes and timely releases the locking time of the resource lock.
It can be seen that the present invention has outstanding substantial features and significant advances over the prior art, as well as the benefits of its implementation.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are required to be used in the embodiments or the description of the prior art will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present invention, and that other drawings can be obtained according to the provided drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a method of an embodiment of the present invention.
Fig. 2 is a system configuration diagram of an embodiment of the present invention.
In the figure, 1, a deployment module; 2. a resource locking module; 3. a registration module; 4. monitoring a data transmission module; 5. updating the judging module; 6. a lock time update module; 7. a first unlocking judgment module; 8. a second unlocking judgment module; 9. and unlocking the module.
Detailed Description
The core of the invention is to provide a control method for locking time of resources, in the prior art, when the service locks resources, the lock expiration time is set, and after the time expires, the resource service releases the lock of the service, so that the appointed time of the service when locked is estimated for a time according to the execution time of the service, which is generally longer than the time of the service for executing serial program. However, as the traffic volume increases, the service execution time may become longer, and the resource lock expiration time is set too long, which may affect the execution of other service. Once the service execution time exceeds the expiration time of the resource lock, the resource service can be caused to delete the lock of the service, and other service services are allowed to lock the resource, so that the resource is shared and executed by two service services at the same time. Therefore, the existing scheme does not fundamentally solve the problem of the resource locking time.
The method for controlling the locking time of the resources provided by the invention comprises the steps of firstly, deploying the resource service and the monitoring service, applying for the resource locking to the resource service by the business service, setting the lock expiration time, taking the lock under the concurrence of the multi-business service, and locking the serial program to be executed. After the business service obtains the execution authority, executing the serial program, updating the business execution state as in progress, and registering the business service state into the monitoring service. Then, the business service sends a heartbeat data packet to the monitoring service within a specified time to convey the execution state of the business service. At this time, the monitoring service updates the expiration time of the resource service resource lock according to the service state and whether the locking time is about to expire, and sends a time update instruction to the resource server; and resetting the expiration time of the resource lock of the resource service after the resource service receives the time update instruction. When the monitoring service cannot monitor the service execution state, an unlocking instruction is sent to the resource service; and after the business service is completed, sending an unlocking instruction to the resource service. And the resource service performs resource unlocking after receiving the unlocking instruction. Therefore, the invention can prolong the time of resource locking according to the service execution state in time under the monitoring of the monitoring service, ensure that the service completes the service within the locking time, and release the resource locking state after the monitoring of the completion of the service execution.
In order to better understand the aspects of the present invention, the present invention will be described in further detail with reference to the accompanying drawings and detailed description. It will be apparent that the described embodiments are only some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Embodiment one:
as shown in fig. 1, the present embodiment provides a method for controlling a resource locking time, including the following steps:
S1: deploying resource services and monitoring services.
By way of example, a resource service is deployed on a redis server and a monitoring service is deployed on a netty server.
S2: the business service applies for the resource locking to the resource service, sets the lock expiration time, takes the lock under the concurrency of the multi-business service, and locks the serial program to be executed.
By way of example, the business service sets a variable SERVICEID on the redis server, and if the variable does not exist, the business service sets successfully, i.e., acquires a resource lock, locks the serial program to be executed.
S3: after the business service obtains the execution authority, executing the serial program, updating the business execution state as in progress, and registering the business service state into the monitoring service.
Specifically: after the service obtains the resource lock, the address port of the service, the variable name set on the redis server and the set variable expiration time are sent to the netty server as registration information, and the address and port of the service are sent to the redis server and stored in the URL variable. And starting the monitoring service after netty server receives the registration information.
S4: the business service sends heartbeat data packets to the monitoring service within a specified time to convey the execution state of the business service.
First, the business service updates the business service state according to the execution condition of the serial code. The traffic service status is then generated into heartbeat packets, which are sent to the netty server at regular time.
S5: and the monitoring service updates the expiration time of the resource lock of the resource service according to the business service state and whether the locking time is about to expire, and sends a time update instruction to the resource server.
As an example, the netty server determines the service state of the service in the heartbeat packet after the heartbeat packet, if the service state is not completed, compares the current time with the expiration time of the resource service resource lock, if the current time exceeds the preset time difference, sends a request to the redis server, and resets the expiration time of the resource service resource lock.
S6: and resetting the expiration time of the resource lock of the resource service after the resource service receives the time update instruction.
S7: and when the monitoring service cannot monitor the service execution state, sending an unlocking instruction to the resource service.
Specifically, if netty server determines that the service state is a completion state, and the service execution state cannot be monitored at this time, a request is sent to the redis server to obtain the URL variable value on the redis server. Then, comparing the obtained URL variable value with the address and port information of the service server; if the two types of information are consistent, the netty server sends an unlocking request to the redis server; if not, no unlock request is sent to the redis server.
S8: and after the business service is completed, sending an unlocking instruction to the resource service.
As an example, the business service sends an unlock request to the redis server if execution is completed.
S9: and the resource service performs resource unlocking after receiving the unlocking instruction.
As an example, the redis server deletes variable SERVICEID after receiving the unlock request.
It should be noted that, in the method, the Redis server refers to a server adopting a Redis database, and the Redis is a fully open-source key-value database which complies with the BSD protocol and has high performance. netty the server is a server employing netty architecture, netty is a client/server framework that leverages the capabilities of Java's advanced network, hiding its back complexity and providing an easy-to-use API.
The embodiment provides a control method for locking time of resources, which is characterized in that a monitoring service is deployed between a business service and a resource service, the monitoring service is utilized to monitor after acquiring resources of the business service, the expiration time is updated according to the business execution state, the business can be ensured to be completed within the locking time, and the resource locking state is released after the completion of the business execution is monitored.
Embodiment two:
Based on the first embodiment, as shown in fig. 2, the invention also discloses a control system for the resource locking time, which comprises: the system comprises a deployment module 1, a resource locking module 2, a registration module 3, a monitoring data transmission module 4, an updating judging module 5, a locking time updating module 6, a first unlocking judging module 7, a second unlocking judging module 8 and an unlocking module 9.
The deployment module 1 is used for deploying resource services and monitoring services.
And the resource locking module 2 is used for applying resource locking to the resource service by the business service, setting the lock expiration time, taking the lock under the concurrency of the multi-business service, and locking the serial program to be executed.
And the registration module 3 is used for executing the serial program after the business service acquires the execution authority, updating the business execution state to be in progress and registering the business service state into the monitoring service.
And the monitoring data transmission module 4 is used for transmitting the heartbeat data packet to the monitoring service by the business service within a specified time and conveying the execution state of the business service.
And the updating judging module 5 is used for updating the expiration time of the resource lock of the resource service according to the business service state and whether the locking time is about to expire by the monitoring service and sending a time updating instruction to the resource server.
And the locking time updating module 6 is used for resetting the expiration time of the resource lock of the resource service after the resource service receives the time updating instruction.
The first unlocking judging module 7 is configured to send an unlocking instruction to the resource service when the monitoring service cannot monitor the service execution state.
And the second unlocking judging module 8 is used for sending an unlocking instruction to the resource service after the business service is completed.
And the unlocking module 9 is used for unlocking the resources after the resource service receives the unlocking instruction.
The embodiment provides a control system for the resource locking time, which can monitor the resource locking time in real time through a monitoring service, and dynamically monitor and set between the monitoring service and a business service, so that the business service is ensured to independently execute serial codes, and the locking time of the resource lock is ensured to be released in time.
Embodiment III:
the embodiment discloses a control device for resource locking time, which comprises a processor and a memory; the processor executes the control program of the resource locking time stored in the memory to realize the following steps:
1. Deploying resource services and monitoring services.
2. The business service applies for the resource locking to the resource service, sets the lock expiration time, takes the lock under the concurrency of the multi-business service, and locks the serial program to be executed.
3. After the business service obtains the execution authority, executing the serial program, updating the business execution state as in progress, and registering the business service state into the monitoring service.
4. The business service sends heartbeat data packets to the monitoring service within a specified time to convey the execution state of the business service.
5. And the monitoring service updates the expiration time of the resource lock of the resource service according to the business service state and whether the locking time is about to expire, and sends a time update instruction to the resource server.
6. And resetting the expiration time of the resource lock of the resource service after the resource service receives the time update instruction.
7. And when the monitoring service cannot monitor the service execution state, sending an unlocking instruction to the resource service.
8. And after the business service is completed, sending an unlocking instruction to the resource service.
9. And the resource service performs resource unlocking after receiving the unlocking instruction.
Further, the device for controlling the resource locking time in this embodiment may further include:
The input interface is used for acquiring a control program of the externally imported resource locking time, storing the acquired control program of the resource locking time into the memory, and acquiring various instructions and parameters transmitted by the external terminal equipment and transmitting the various instructions and parameters into the processor so that the processor can develop corresponding processing by utilizing the various instructions and parameters. In this embodiment, the input interface may specifically include, but is not limited to, a USB interface, a serial interface, a voice input interface, a fingerprint input interface, a hard disk reading interface, and the like.
And the output interface is used for outputting various data generated by the processor to the terminal equipment connected with the output interface so that other terminal equipment connected with the output interface can acquire various data generated by the processor. In this embodiment, the output interface may specifically include, but is not limited to, a USB interface, a serial interface, and the like.
And the communication unit is used for establishing remote communication connection between the control device of the resource locking time and the external server so that the control device of the resource locking time can mount the image file to the external server. In this embodiment, the communication unit may specifically include, but is not limited to, a remote communication unit based on a wireless communication technology or a wired communication technology.
And the keyboard is used for acquiring various parameter data or instructions input by a user by knocking the key cap in real time.
And the display is used for running the related information of the short-circuit positioning process of the power supply line of the server to display in real time.
A mouse may be used to assist a user in inputting data and to simplify user operations.
Embodiment four:
The present embodiment also discloses a readable storage medium, where the readable storage medium includes Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art. The readable storage medium stores a control program of the resource lock time, which when executed by the processor, implements the steps of:
1. Deploying resource services and monitoring services.
2. The business service applies for the resource locking to the resource service, sets the lock expiration time, takes the lock under the concurrency of the multi-business service, and locks the serial program to be executed.
3. After the business service obtains the execution authority, executing the serial program, updating the business execution state as in progress, and registering the business service state into the monitoring service.
4. The business service sends heartbeat data packets to the monitoring service within a specified time to convey the execution state of the business service.
5. And the monitoring service updates the expiration time of the resource lock of the resource service according to the business service state and whether the locking time is about to expire, and sends a time update instruction to the resource server.
6. And resetting the expiration time of the resource lock of the resource service after the resource service receives the time update instruction.
7. And when the monitoring service cannot monitor the service execution state, sending an unlocking instruction to the resource service.
8. And after the business service is completed, sending an unlocking instruction to the resource service.
9. And the resource service performs resource unlocking after receiving the unlocking instruction.
In summary, the invention can prolong the time of resource locking according to the service execution state in time under the monitoring of the monitoring service, ensure that the service completes the service within the locking time, and release the resource locking state after the monitoring of the completion of the service execution.
In this specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, so that the same or similar parts between the embodiments are referred to each other. For the method disclosed in the embodiment, since it corresponds to the system disclosed in the embodiment, the description is relatively simple, and the relevant points refer to the description of the method section.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative elements and steps are described above generally in terms of functionality in order to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the several embodiments provided by the present invention, it should be understood that the disclosed systems, and methods may be implemented in other ways. For example, the system embodiments described above are merely illustrative, e.g., the division of the elements is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple elements or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interface, system or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional module in the embodiments of the present invention may be integrated in one processing unit, or each module may exist alone physically, or two or more modules may be integrated in one unit.
Similarly, each processing unit in the embodiments of the present invention may be integrated in one functional module, or each processing unit may exist physically, or two or more processing units may be integrated in one functional module.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. The software modules may be disposed in Random Access Memory (RAM), memory, read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
Finally, it is further noted that relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Moreover, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The method, system, device and readable storage medium for controlling the resource locking time provided by the invention are described in detail above. The principles and embodiments of the present invention have been described herein with reference to specific examples, the description of which is intended only to facilitate an understanding of the method of the present invention and its core ideas. It should be noted that it will be apparent to those skilled in the art that various modifications and adaptations of the invention can be made without departing from the principles of the invention and these modifications and adaptations are intended to be within the scope of the invention as defined in the following claims.

Claims (10)

1. The method for controlling the resource locking time is characterized by comprising the following steps:
Deploying resource services and monitoring services;
the business service applies for the resource locking to the resource service, sets the lock expiration time, takes the lock under the concurrency of the multi-business service, and locks the serial program to be executed;
after the business service obtains the execution authority, executing the serial program, updating the business execution state as in progress, and registering the business service state into the monitoring service;
the business service sends heartbeat data packets to the monitoring service within a specified time to convey the execution state of the business service;
the monitoring service updates the expiration time of the resource lock of the resource service according to the business service state and whether the locking time is about to expire, and sends a time update instruction to the resource server;
After receiving the time update instruction, the resource service resets the expiration time of the resource lock of the resource service;
When the monitoring service cannot monitor the service execution state, an unlocking instruction is sent to the resource service;
after the business service is completed, an unlocking instruction is sent to the resource service;
And the resource service performs resource unlocking after receiving the unlocking instruction.
2. The method for controlling a resource lock time according to claim 1, wherein the deploying the resource service and the monitoring service comprises:
The resource service is deployed on the redis server, and the monitoring service is deployed on the netty server.
3. The method for controlling the locking time of resources according to claim 2, wherein the service applies for the locking of resources to the resource service, sets the lock expiration time, takes the lock under the concurrency of the multiple service, and locks the serial program to be executed, comprising:
the service sets a variable SERVICEID on the redis server, and if the variable does not exist, the service is set successfully, i.e. the resource lock is acquired, and the serial program to be executed is locked.
4. The method for controlling a resource lock time according to claim 3, wherein after the service obtains the execution authority, executing the serial program to update the service execution status to be in progress, and registering the service status to the monitoring service comprises:
After the service acquires the resource lock, the address port of the service, the variable name set on the redis server and the set variable expiration time are used as registration information to be sent to the netty server, and the address and the port of the service are sent to the redis server and stored in the URL variable;
And netty, after receiving the registration information, the server starts the monitoring service.
5. The method for controlling a lock time of a resource according to claim 4, wherein the service transmitting a heartbeat packet to the monitoring service within a predetermined time, communicating a service execution state, comprises: the business service updates the business service state according to the execution condition of the serial codes;
and generating a heartbeat data packet from the business service state and sending the heartbeat data packet to the netty server at regular time.
6. The method of claim 5, wherein the monitoring service updates the expiration time of the resource lock of the resource service based on the traffic service status and whether the lock time is to be expired, comprising:
And netty, after the heartbeat data packet, the server judges the service state of the business in the heartbeat data packet, if the service state is the unfinished state, the current time is compared with the expiration time of the resource service resource lock, and if the current time exceeds the preset time difference, a request is sent to the redis server, and the expiration time of the resource service resource lock is reset.
7. The method for controlling a resource lock time according to claim 6, wherein when monitoring a service execution state that cannot be monitored by a service, sending an unlock instruction to the resource service comprises:
If netty server judges that the business service state is the completion state, then sending a request to the redis server to obtain the URL variable value on the redis server;
comparing the obtained URL variable value with the address and port information of the service server;
If the two types of information are consistent, the netty server sends an unlocking request to the redis server; if not, no unlock request is sent to the redis server.
8. A control system for a resource lock time, comprising:
the deployment module is used for deploying the resource service and the monitoring service;
the resource locking module is used for applying resource locking to the resource service by the business service, setting lock expiration time, taking the lock under the concurrency of the multi-business service, and locking a serial program to be executed;
the registration module is used for executing the serial program after the business service acquires the execution authority, updating the business execution state into the in-process state and registering the business service state into the monitoring service;
The monitoring data transmission module is used for transmitting heartbeat data packets to the monitoring service in a specified time by the business service and conveying the execution state of the business service;
The updating judging module is used for updating the expiration time of the resource lock of the resource service according to the service state of the monitoring service and whether the locking time is about to expire, and sending a time updating instruction to the resource server;
The locking time updating module is used for resetting the expiration time of the resource lock of the resource service after the resource service receives the time updating instruction;
the first unlocking judging module is used for sending an unlocking instruction to the resource service when the monitoring service cannot monitor the service execution state;
The second unlocking judging module is used for sending an unlocking instruction to the resource service after the business service is completed;
and the unlocking module is used for unlocking the resources after the resource service receives the unlocking instruction.
9. A control device for locking time of a resource, comprising:
A memory for storing a control program of the resource lock time;
A processor for implementing the steps of the method for controlling a resource lock time according to any one of claims 1 to 7 when executing the program for controlling a resource lock time.
10. A readable storage medium, characterized by: the readable storage medium has stored thereon a control program for a resource lock time, which when executed by a processor, implements the steps of the method for controlling a resource lock time according to any one of claims 1 to 7.
CN202211312779.1A 2022-10-25 2022-10-25 Method, system, device and storage medium for controlling resource locking time Active CN115801864B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211312779.1A CN115801864B (en) 2022-10-25 2022-10-25 Method, system, device and storage medium for controlling resource locking time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211312779.1A CN115801864B (en) 2022-10-25 2022-10-25 Method, system, device and storage medium for controlling resource locking time

Publications (2)

Publication Number Publication Date
CN115801864A CN115801864A (en) 2023-03-14
CN115801864B true CN115801864B (en) 2024-06-04

Family

ID=85433756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211312779.1A Active CN115801864B (en) 2022-10-25 2022-10-25 Method, system, device and storage medium for controlling resource locking time

Country Status (1)

Country Link
CN (1) CN115801864B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697136A (en) * 2009-10-27 2010-04-21 金蝶软件(中国)有限公司 Method and device for controlling resource
US10360064B1 (en) * 2013-08-19 2019-07-23 Amazon Technologies, Inc. Task scheduling, execution and monitoring
CN112256443A (en) * 2020-10-14 2021-01-22 杭州当虹科技股份有限公司 Dynamic cluster lock system based on redis
CN114979244A (en) * 2022-04-29 2022-08-30 上海交通大学 Multi-chain trusted transaction BaaS service platform architecture based on Hash time locking protocol

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9544396B2 (en) * 2011-02-23 2017-01-10 Lookout, Inc. Remote application installation and control for a mobile device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101697136A (en) * 2009-10-27 2010-04-21 金蝶软件(中国)有限公司 Method and device for controlling resource
US10360064B1 (en) * 2013-08-19 2019-07-23 Amazon Technologies, Inc. Task scheduling, execution and monitoring
CN112256443A (en) * 2020-10-14 2021-01-22 杭州当虹科技股份有限公司 Dynamic cluster lock system based on redis
CN114979244A (en) * 2022-04-29 2022-08-30 上海交通大学 Multi-chain trusted transaction BaaS service platform architecture based on Hash time locking protocol

Also Published As

Publication number Publication date
CN115801864A (en) 2023-03-14

Similar Documents

Publication Publication Date Title
US10257800B2 (en) Method and apparatus for authenticating access authorization in wireless communication system
EP3185469B1 (en) Method and apparatus for authenticating access authority for specific resource in wireless communication system
US9900727B2 (en) Method and apparatus for controlling access in wireless communication system
JP4856246B2 (en) Method for performing management operation by communication terminal, terminal, and system thereof
CN109194760A (en) Method for processing business, network system and server
CN112861190B (en) Data cross-chain cooperation method, system and device
KR20090117874A (en) System and method for extending sessions
CN111181991A (en) Method and device for constructing terminal access platform of Internet of things
CN106464667B (en) Certificate management method, equipment and system
CN110191451B (en) State synchronization method, mobile terminal, system and device of Bluetooth equipment
KR102005059B1 (en) Apparatus for providing home network service and method thereof
WO2022062807A1 (en) Device control method, server, and storage medium
EP3682619B1 (en) Service layer message templates in a communications network
CN105025027A (en) RPC security authentication method of multi-control storage system
US20150127831A1 (en) Method and device for enabling or disabling server in wireless communication system
US9438603B2 (en) Method for managing access right of terminal to resource by server in wireless communication system, and device for same
CN103209090A (en) Remote network management system and business operation method thereof
CN112260863A (en) Organization-level network equipment connection management method and device and computer equipment
KR101704319B1 (en) Parameter configuration system, program management device, and information process device
CN115801864B (en) Method, system, device and storage medium for controlling resource locking time
CN112600744A (en) Authority control method and device, storage medium and electronic device
US20200304307A1 (en) Token management apparatus and non-transitory computer readable medium storing token management program
US20210044594A1 (en) System, control method, and storage medium
US11075897B2 (en) System and method for communicating with a service processor
CN115486033A (en) Equipment access method and device in Internet of things, computer equipment 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
GR01 Patent grant
GR01 Patent grant