Service object processing method and device, equipment and storage medium

By introducing preset operations of scope objects into the service container and the use of scope managers, the problem of inflexible service object life cycle management in the prior art is solved, automated service object management is realized, and the stability and maintainability of the system are improved.

CN119883201APending Publication Date: 2025-04-25BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311374546.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-23
Publication Date
2025-04-25

AI Technical Summary

Technical Problem

The existing service container implementation method lacks the ability to flexibly manage the life cycle of the service object, which leads to manual control of the service container being very prone to errors in complex client interface display and interaction scenarios, and is prone to memory leakage and access to unlived or uncreated service objects.

Method used

By defining preset entry and departure operations of scope objects, use the scope manager to create and manage scope nodes and service controllers in the scope tree structure, automatically controlling the start and stop of service objects.

Benefits of technology

It realizes the ability to flexibly manage the life cycle of service objects, avoids memory leaks and error access problems, and improves the robustness and maintainability of the code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883201A_ABST
    Figure CN119883201A_ABST
Patent Text Reader

Abstract

The invention provides a service object processing method and device, equipment and a storage medium, and the method comprises the steps: creating a first action domain node for a first action domain object in an action domain tree structure through an action domain manager when it is determined that the action domain manager detects a preset entering operation of the first action domain object, and creating a first service controller for the first action domain node. And calling the first service controller through the action domain manager, and obtaining and starting a service object corresponding to the first action domain object. According to the embodiment of the invention, a service container implementation mode is provided based on the action domain object, and the corresponding service object is controlled to be started through the preset entry operation of the action domain object, so that the function of the service container is realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular to a service object processing method, device, equipment and storage medium. Background Art

[0002] In the field of computer programming, a service container refers to a technology that uses inversion of control to manage the creation, execution, and destruction of service objects and automatically resolves dependencies between service objects.

[0003] There are currently a variety of service container implementation methods, but all have more or less defects. Therefore, how to implement a new service container implementation method is a technical problem that urgently needs to be solved. Summary of the invention

[0004] In order to solve the above technical problems, the embodiments of the present disclosure provide a service object processing method.

[0005] In a first aspect, the present disclosure provides a service object processing method, the method comprising:

[0006] When it is determined that the scope manager detects a preset entry operation of the first scope object, a first scope node is created for the first scope object in a scope tree structure by the scope manager; wherein the preset entry operation is used to indicate that the first scope object enters a valid state, the scope tree structure is used to maintain validity constraint relationships between scope objects, and the first scope node is used to store operation data corresponding to the first scope object;

[0007] and, creating a first service controller for the first scope node;

[0008] The scope manager calls the first service controller to obtain a service object corresponding to the first scope object, and starts the service object.

[0009] In an optional implementation manner, the acquiring the service object corresponding to the first scope object by calling the first service controller through the scope manager includes:

[0010] The scope manager calls the first service controller to query a preset service registry, and obtains a service object associated with the scope type to which the first scope object belongs, as the service object corresponding to the first scope object; wherein the pre-service registry is used to store an association relationship between a pre-defined scope type and a service object.

[0011] In an optional implementation manner, the method further includes:

[0012] When it is determined that the scope manager detects a preset leave operation of the second scope object, querying the scope manager for a second scope node corresponding to the second scope object in the scope tree structure; wherein the preset leave operation is used to indicate that the second scope object leaves a valid state;

[0013] The scope manager calls the second service controller of the second scope node to control the service object corresponding to the second scope object to stop running.

[0014] In an optional implementation manner, before the calling of the second service controller of the second scope node by the scope manager to control the service object corresponding to the second scope object to stop running, the method further includes:

[0015] Determine whether the second scope node has a child scope node based on the scope tree structure;

[0016] If it is determined that the second scope node has a child scope node, determining whether the service object corresponding to the child scope node stops running;

[0017] Correspondingly, calling the second service controller of the second scope node through the scope manager to control the service object corresponding to the second scope object to stop running includes:

[0018] After determining that the service objects corresponding to the respective child scope nodes of the second scope node have stopped running, the scope manager calls the second service controller of the second scope node to control the service objects corresponding to the second scope object to stop running.

[0019] In an optional implementation manner, the method further includes:

[0020] When it is determined that the scope manager detects a query operation of a third scope object, querying a third scope node corresponding to the third scope object in the scope tree structure through the scope manager;

[0021] The scope manager calls the third service controller of the third scope node to query the service object corresponding to the third scope object.

[0022] In an optional implementation, the first scope object has an associated code structure unit, and a preset entry operation of the first scope object is triggered based on a preset valid state of the code structure unit.

[0023] In an optional implementation manner, the method further includes:

[0024] After determining that the scope manager detects that multiple scope objects corresponding to the same intersection scope object all create corresponding scope nodes, the scope manager generates a first intersection scope object based on the multiple scope objects, and creates an intersection scope node for the first intersection scope object in the scope tree structure; wherein the multiple scope objects have a common scope object, and the first intersection scope object includes an intersection of the multiple scope objects;

[0025] and, creating an intersection service controller for the intersection scope node;

[0026] The scope manager calls the intersection service controller to obtain a service object corresponding to the first intersection scope object, and starts the service object.

[0027] In an optional implementation manner, the method further includes:

[0028] When it is determined that the scope manager detects a preset entry operation of the first scope object, determining whether the first scope object corresponds to any intersection scope object;

[0029] If it is determined that the first scope object corresponds to any intersection scope object, the preset relationship between the intersection scope object and the first scope object is recorded; wherein the preset relationship between the intersection scope object and the first scope object is used to determine whether multiple scope objects corresponding to the intersection scope object all create corresponding scope nodes.

[0030] In an optional implementation manner, after the scope manager calls the first service controller to obtain the service object corresponding to the first scope object and before the service object is started, the method further includes:

[0031] If it is determined that the service object corresponding to the first scope object includes a preset conversion service object, the preset service object is used to replace the target service object for startup.

[0032] In an optional implementation manner, after the scope manager calls the first service controller to obtain the service object corresponding to the first scope object and before the service object is started, the method further includes:

[0033] If it is determined that the service object corresponding to the first scope object includes a preset scheduling service object, obtaining service startup sequence information provided by the preset scheduling service object;

[0034] Accordingly, starting the service object includes:

[0035] Based on the service startup sequence information, the service object corresponding to the first scope object is started.

[0036] In an optional implementation manner, the creating a first service controller for the first scope node includes:

[0037] A first service controller is created within the first scope node.

[0038] In a second aspect, the present disclosure provides a service object processing device, the device comprising:

[0039] A first creation module, configured to create a first scope node for the first scope object in a scope tree structure through the scope manager when it is determined that the scope manager detects a preset entry operation of the first scope object; wherein the preset entry operation is used to indicate that the first scope object enters a valid state, the scope tree structure is used to maintain validity constraint relationships between scope objects, and the first scope node is used to store operation data corresponding to the first scope object;

[0040] A second creation module, configured to create a first service controller for the first scope node;

[0041] A startup module is used to call the first service controller through the scope manager to obtain the service object corresponding to the first scope object, and start the service object.

[0042] In a third aspect, the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the above method.

[0043] In a fourth aspect, the present disclosure provides a service object processing device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the computer program.

[0044] In a fifth aspect, the present disclosure provides a computer program product, wherein the computer program product comprises a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.

[0045] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has at least the following advantages:

[0046] The embodiment of the present disclosure provides a service object processing method. When it is determined that the scope manager detects a preset entry operation of a first scope object, the scope manager creates a first scope node for the first scope object in a scope tree structure, and creates a first service controller for the first scope node. The scope manager calls the first service controller to obtain and start the service object corresponding to the first scope object. The embodiment of the present disclosure provides a service container implementation method based on the scope object. Through the preset entry operation of the scope object, the startup of the corresponding service object is controlled, thereby realizing the function of the service container. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0048] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0049] Figure 1 A schematic diagram of a scope object provided in an embodiment of the present disclosure;

[0050] Figure 2 A schematic diagram of another scope object provided in an embodiment of the present disclosure;

[0051] Figure 3 A flowchart of a service object processing method provided by an embodiment of the present disclosure;

[0052] Figure 4 A schematic diagram of an implementation process of a service object processing method provided in an embodiment of the present disclosure;

[0053] Figure 5 A schematic diagram of a service registration table provided in an embodiment of the present disclosure;

[0054] Figure 6 A schematic diagram of a nested relationship provided for an embodiment of the present disclosure;

[0055] Figure 7 A schematic diagram of an intersection relationship provided in an embodiment of the present disclosure;

[0056] Figure 8 A schematic diagram of the structure of a service object processing device provided in an embodiment of the present disclosure;

[0057] Fig. 9A schematic diagram of the structure of a service object processing device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0058] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0059] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0060] A service container is a system that uses inversion of control to manage the creation, execution, and destruction of service objects and automatically resolves the dependencies between service objects. The service container automatically creates a group of service objects at the right time and actively provides other service objects that the service object depends on to the service object. This process is also called dependency injection.

[0061] Since the current service container implementation lacks the ability to flexibly manage the life cycle of service objects, it can only rely on business code to manually control the start and stop of the service container to achieve the creation and destruction of service objects. In scenarios where functional modules such as client interface display and interaction have complex and nested life cycles, manual control of the service container is prone to errors, such as memory leaks and access to non-surviving or uncreated service objects. It is difficult to meet the requirements of increasingly complex client interface display and interaction functions for code robustness and maintainability.

[0062] To this end, the present disclosure provides a new implementation method of a service container. Specifically, an abstract lifecycle descriptor is defined, hereinafter referred to as a scope. The scope can be associated with a code structure unit, wherein the code structure unit includes but is not limited to a code block, i.e., a block-level scope of a programming language, a business component in an Android system, such as an Activity component, a ViewModel component, and a user interface component, such as a panel component, a pop-up window component, etc. If the code structure unit has multiple instances, there may be multiple instances of the scope. For example, assuming that the code structure unit is a panel component, there may be multiple instances of the scope of the panel component after opening multiple similar panel components.

[0063] Scope is defined based on the way of defining new types in programming languages. For example, interfaceMyScope:Scope, where MyScope is a scope type defined in programming languages, and Scope is the common parent type of all scope types. It is worth noting that the above method is only for illustrating the definition of scope types, and is not intended to be a limitation.

[0064] In addition, a scope type can contain attributes, and the attributes of a scope type can be called environment variables within the scope type.

[0065] In addition, after the scope type is instantiated, a scope object is obtained, that is, an instance of a scope type is called a scope object.

[0066] The scope object has two basic operations, namely, the preset entry operation and the preset exit operation in the embodiment of the present disclosure, wherein the preset entry operation is used to indicate that the scope object enters a valid state, and the preset exit operation is used to indicate that the scope object leaves the valid state, that is, enters an invalid state. Figure 1 As shown, it is a schematic diagram of a scope object provided by an embodiment of the present disclosure, wherein when a preset entry operation of scope object A is detected, scope object A enters a valid state, and when a preset exit operation of scope object A is detected, scope object A leaves the valid state.

[0067] The preset entry operation and preset exit operation of the scope object can be bound to the code structure unit. When the bound code structure unit enters the valid state, the preset entry operation of its corresponding scope object is triggered, so that the scope object synchronously enters the valid state. When the bound code structure unit leaves the valid state, the preset exit operation of the scope object is triggered, so that the scope object synchronously leaves the valid state. Specifically, the user can customize the valid state of the code structure unit based on needs. For example, when a code structure unit is executed, the code structure unit can be regarded as entering the valid state. For another example, when the user interface UI panel is opened, the UI panel can be regarded as entering the valid state. Figure 2 As shown, it is a schematic diagram of another scope object provided by an embodiment of the present disclosure, wherein when user interface A is opened, that is, user interface A enters a valid state, the preset entry operation of its corresponding scope object A is triggered, so that scope object A synchronously enters a valid state.

[0068] The service object refers to an object managed by the service container implemented by the service object processing method provided in the embodiment of the present disclosure.

[0069] The service object includes a start function for implementing the service object and a stop function for implementing the service object. The specific implementation logic of the start function and the stop function can be designed based on business requirements, and the embodiments of the present disclosure do not limit this.

[0070] A service object can be associated with one or more scope types, and an instance of a scope type is a scope object. In an optional implementation, the association relationship between a service object and a scope type can be implemented by using JVM annotations in the source code.

[0071] Among them, the service object can be run through @RunInScope <myscope>Specifies that the service object runs within the scope type MyScope, that is, when it is detected that any instance of the scope type MyScope (scope object) enters a valid state, an instance of the service object MyService is started; when it is detected that the MyScope scope object leaves the valid state, the service object MyService stops running.

[0072] In addition, the service object can specify its dependencies, which can be other service objects or environment variables in the scope type associated with the service object or its parent scope type, so as to ensure that the dependencies specified by the service object are valid. Because the premise of entering the MyScope scope is entering its parent scope, the life cycle of the MyScope scope must be included in its parent scope, and any scope object with the same life cycle as its parent scope (that is, other service objects in the service container corresponding to its parent scope) must be in a valid state. As shown in the above source code, the dependency specified by the service object MyService is the environment variable environment1 in the scope type MyScope. The dependencies of the service object can be determined by the compiler statically checking the rationality of the dependencies to determine whether there is a dependency problem. If there is a dependency problem, a dependency error will occur.

[0073] On the basis of the above content, the present disclosure provides a service object processing method. Specifically, when it is determined that the scope manager detects a preset entry operation of the first scope object, the scope manager creates a first scope node for the first scope object in the scope tree structure, and creates a first service controller for the first scope node. Among them, the preset entry operation is used to characterize that the first scope object enters a valid state, the scope tree structure is used to maintain the dependency relationship between scope objects, and the first scope node is used to store the operation data corresponding to the first scope object. The scope manager calls the first service controller to obtain the service object corresponding to the first scope object, and starts the service object corresponding to the first scope object. The embodiment of the present disclosure provides a service container implementation method based on the scope object, and controls the startup of the corresponding service object through the preset entry operation of the scope object, thereby realizing the function of the service container.

[0074] In addition, in the service object processing method provided in the embodiment of the present disclosure, there is an association relationship between the scope object and one or more service objects. By pre-defining the entry and exit timing of the scope object (for example, by binding with an existing code structure, etc.), and then binding one or more service objects to the scope object, the service object is indirectly managed by operating the entry and exit of the scope object.

[0075] Specifically, the present disclosure provides a method for processing a service object. Figure 3 , is a flow chart of a service object processing method provided by an embodiment of the present disclosure, the method specifically comprising:

[0076] S301: When it is determined that the scope manager detects a preset entry operation of a first scope object, create a first scope node for the first scope object in a scope tree structure through the scope manager.

[0077] The preset entry operation is used to indicate that the first scope object enters a valid state, the scope tree structure is used to maintain validity constraint relationships between scope objects, and the first scope node is used to store operation data corresponding to the first scope object.

[0078] The service object processing method provided by the embodiment of the present disclosure can be applied to a software development system, in which a scope manager is deployed, and the scope manager is used to detect / track the state of each scope object and maintain the validity constraint relationship between each scope object. A software development user can define a preset entry operation and a preset exit operation of a scope object based on an interface provided by the scope manager.

[0079] The first scope object can be any scope object. When the scope manager detects the preset entry operation of the first scope object, it indicates that the first scope object enters a valid state, and the scope manager creates / generates a first scope node for the first scope object in the scope tree structure. The scope manager uses the scope tree structure to manage the relationship between each scope object and record the operation data of each scope object.

[0080] Specifically, there is a mapping relationship between the scope nodes and the scope objects in the scope tree structure, and each scope node is used to record / store the operation data of the corresponding scope object, such as the operation status data, operation process data, etc. of the scope object.

[0081] like Figure 4 As shown, it is a schematic diagram of the implementation process of a service object processing method provided by an embodiment of the present disclosure, wherein a scope manager 401 maintains a scope tree structure 402, and the scope tree structure includes a root scope node and multiple leaf scope nodes under the root scope node, including scope nodes 1, 2, and 3.

[0082] In actual application, when the scope manager detects the preset entry operation of the first scope object, it creates a scope node for the first scope object in the scope tree structure 402, assuming it is scope node 1. Scope node 1 is used to store the operation data corresponding to the first scope object.

[0083] In the embodiment of the present disclosure, the first scope object has an associated code structure unit, and the preset entry operation of the first scope object is triggered based on the preset valid state of the code structure unit. The preset valid state can be defined based on demand.

[0084] In the disclosed embodiment, the scope tree structure is used to maintain the validity constraint relationship between each scope object, and the validity constraint relationship may include a nested relationship, etc. Take scopes A and B with a nested relationship as an example, B is a child scope of A, and B is a child node of A in the scope tree structure. When the scope manager executes a leave operation, it will first execute the leave operation on the scopes corresponding to all child nodes, so as to ensure the "last in, first out" principle in the nested relationship (i.e., the order of entering A-entering B-leaving B-leaving A).

[0085] S302: Create a first service controller for the first scope node.

[0086] In the embodiment of the present disclosure, after the scope controller creates a first scope node for the first scope object in the scope tree structure, it creates a first service controller for the first scope node.

[0087] In the embodiment of the present disclosure, each scope node in the scope tree structure is created with its own service controller, which is used to control the service object associated with the scope object corresponding to the scope node where the scope node is located.

[0088] In an optional implementation, the service controller may be placed in a scope node. Specifically, after the scope controller creates a first scope node for a first scope object in a scope tree structure, it creates a first service controller in the first scope node.

[0089] In another optional implementation, there may be only a single instance of a service controller, which internally associates each scope node with a service object by means of a mapping (eg, a hash table).

[0090] S303: Calling the first service controller through the scope manager to obtain a service object corresponding to the first scope object, and starting the service object.

[0091] In the embodiment of the present disclosure, after the first service controller is created, the first service controller is called through the scope manager to obtain the service object corresponding to the first scope object, and each of the obtained service objects is started.

[0092] In an optional implementation, the scope manager calls the first service controller to query a preset service registry, thereby obtaining a service object associated with the scope type to which the first scope object belongs, as the service object corresponding to the first scope object; wherein the pre-service registry is used to store an association relationship between a pre-defined scope type and a service object.

[0093] The preset service registry maintains various static configurations related to the service container, which may include the association between each scope type and the service type. The instance of the service type is called a service object. In addition, it may also include the configuration information of each service type. Figure 5 As shown, it is a schematic diagram of a service registry provided by an embodiment of the present disclosure, wherein there is an association relationship between scope type Scope A and service types Service1, Service2 and Service3, that is, the associated services of scope type Scope A include service types Service1, Service2 and Service3. In addition, service types Service1, Service2 and Service3 respectively store configuration information, such as exposed interfaces, loading methods, whether it is a meta-service, etc.

[0094] During the application initialization phase, the code generator is used to write various static configurations related to the service container into the preset service registry during code compilation to support querying of the service controller at runtime.

[0095] In an optional implementation, the code generator scans the annotations in the source code for marking the association between the scope type and the service type, obtains the association between the scope type and the service type, and writes it into a preset service registry. The code generator scans and collects the dependencies of each service object, performs dependency static checking, and finds potential dependency errors.

[0096] In the present disclosure, Figure 5 As shown, the first service controller is called through the scope manager, and the first service controller obtains the service object corresponding to the first scope object by querying the preset service registry, such as Figure 5 The service objects 1, 2, and 3 are shown, and the first service controller starts the service objects 1, 2, and 3.

[0097] In the service object processing method provided by the embodiment of the present disclosure, when it is determined that the scope manager detects a preset entry operation of the first scope object, a first scope node is created for the first scope object in the scope tree structure through the scope manager, and a first service controller is created for the first scope node. Among them, the preset entry operation is used to characterize that the first scope object enters a valid state, the scope tree structure is used to maintain the dependency relationship between scope objects, and the first scope node is used to store the operation data corresponding to the first scope object. The first service controller is called by the scope manager to obtain the service object corresponding to the first scope object, and the service object corresponding to the first scope object is started. The embodiment of the present disclosure provides a service container implementation method based on the scope object, and controls the startup of its corresponding service object through the preset entry operation of the scope object, thereby realizing the function of the service container.

[0098] In addition, in the service object processing method provided in the embodiment of the present disclosure, there is an association relationship between the scope object and one or more service objects. By pre-defining the entry and exit timing of the scope object (for example, by binding with an existing code structure, etc.), and then binding one or more service objects to the scope object, the service object is indirectly managed by operating the entry and exit of the scope object.

[0099] In the embodiment of the present disclosure, the scope object has not only a preset entry operation but also a preset exit operation. To this end, when it is determined that the scope manager detects the preset exit operation of the second scope object, the scope manager queries the second scope node corresponding to the second scope object in the scope tree structure; wherein the preset exit operation is used to characterize that the second scope object leaves the valid state.

[0100] The second scope object in the embodiment of the present disclosure can be any scope object. The scope manager detects the preset leave operation of the second scope object, indicating that the second scope object leaves the valid state. Therefore, the scope manager can query the scope node corresponding to the second scope object in the scope tree structure as the second scope node, and call the second service controller of the second scope node to control the service object corresponding to the second scope object to stop running.

[0101] In an optional implementation, the scope calls the second service controller to query a preset service registry to obtain a service object corresponding to the second scope object and control it to stop running.

[0102] In the embodiments of the present disclosure, there may be a preset logical relationship between scope types or between scope objects, wherein the preset logical relationship may include a nested relationship. Figure 6 As shown, it is a schematic diagram of a nested relationship provided by an embodiment of the present disclosure. Assuming that scope objects A and B have a nested relationship, and scope object B is a subscope of scope object A, then a necessary condition for scope object B to be in a valid state is that scope object A is in a valid state. Before scope object A leaves the valid state, scope object B leaves the valid state first. The nested relationship between scope objects is similar to a first-in, last-out data structure.

[0103] The nested relationship between scope objects is reflected in the scope tree structure as the relationship between the root node and the leaf node. Before the scope object corresponding to a scope node in the scope tree structure leaves the valid state, the scope objects corresponding to each of its leaf nodes also leave the valid state.

[0104] Based on the above content, therefore, before controlling the service object corresponding to the second scope object to stop running, the second service controller first determines whether the second scope node in the scope tree structure has a child scope node, and if so, determines whether the service objects corresponding to each child scope node have all stopped running. If it is determined that the service objects corresponding to each child scope node have all stopped running, the second service controller of the second scope node is called through the scope manager to control the service object corresponding to the second scope object to stop running, thereby avoiding running errors.

[0105] In the embodiment of the present disclosure, there may be a preset logical relationship between scope types or scope objects, and may also include an intersection relationship. Figure 7 As shown, it is a schematic diagram of an intersection relationship provided by an embodiment of the present disclosure, assuming that scope objects S1, S2, and S3 directly or indirectly have a common parent scope object P, that is, scope objects S1, S2, and S3 are nested inside scope object P. The scope manager can control the generation of an intersection scope object I based on scope objects S1, S2, S3, and P, and intersection scope object I includes the intersection part of scope objects S1, S2, S3, and P. If any scope object corresponding to intersection scope object I (such as scope object S1) leaves the valid state, intersection scope object I synchronously leaves the valid state. If any scope object corresponding to intersection scope object I (such as scope object S1) is created in scope object P and belongs to an instance of the same scope type (assuming it is scope object S1), the scope manager controls the generation of a new intersection scope object i based on scope objects S1, S2, S3, and P.

[0106] Based on the above content, therefore, after determining that the scope manager detects that multiple scope objects corresponding to the same intersection scope object have all created corresponding scope nodes, the scope manager generates a first intersection scope object based on the multiple scope objects, creates an intersection scope node for the first intersection scope object in the scope tree structure, and creates an intersection service controller in the intersection scope node; wherein the multiple scope objects have a common scope object, and the first intersection scope object includes the intersection of the multiple scope objects. Then, the scope manager calls the intersection service controller to obtain the service object corresponding to the first intersection scope object, and starts the service object.

[0107] It can be understood that the intersection relationship between scope objects can be used to solve the problem of target service objects that need to rely on multiple service objects. By establishing an association relationship between the intersection scope object and the target service object, it is possible to enter the intersection scope object of the target service object after all dependent service objects are started, and then start the target service object.

[0108] In an optional implementation, when it is determined that the scope manager detects a preset entry operation of a first scope object, it is determined whether the first scope object corresponds to any intersection scope object. If it is determined that the first scope object corresponds to any intersection scope object, the preset relationship between the intersection scope object and the first scope object is recorded; wherein the preset relationship between the intersection scope object and the first scope object is used to determine whether multiple scope objects corresponding to the intersection scope object have all created corresponding scope nodes. Further, after it is determined that the scope manager detects that multiple scope objects corresponding to the same intersection scope object have all created corresponding scope nodes, the scope manager generates a first intersection scope object based on the multiple scope objects.

[0109] In an optional implementation, the scope tree structure supports query operations for scope objects. Specifically, when it is determined that the scope manager detects a query operation for a third scope object, the scope manager queries a third scope node corresponding to the third scope object in the scope tree structure; then, the scope manager calls a third service controller in the third scope node to query a service object corresponding to the third scope object. The third scope node can be any scope node in the scope tree structure.

[0110] In an optional implementation, the service object may be a service object of a specific type, which is used to affect the operation of a specific service object of the scope object in which it is located. The service object of a specific type may include a transformation service object. The transformation service object is used to intervene in the construction process of other service objects in the same scope object.

[0111] Specifically, after the scope manager calls the first service controller to obtain the service object corresponding to the first scope object, if it is determined that the service object corresponding to the first scope object includes a preset transformation service object, the preset service object is used to replace the target service object for startup.

[0112] In another optional implementation, the service object of the specific type may further include a scheduling service object. The scheduling service object is used to intervene in the startup sequence or startup timing of other service objects in the same scope object.

[0113] Specifically, after the scope manager calls the first service controller to obtain the service object corresponding to the first scope object, if it is determined that the service object corresponding to the first scope object includes a preset scheduling service object, the service startup sequence information provided by the preset scheduling service object is obtained; then, based on the service startup sequence information, the service object corresponding to the first scope object is started.

[0114] Based on the above method embodiment, the present disclosure also provides a service object processing device, referring to Figure 8 , is a schematic diagram of the structure of a service object processing device provided by an embodiment of the present disclosure, the device comprising:

[0115] A first creation module 801 is used to create a first scope node for the first scope object in a scope tree structure through the scope manager when it is determined that the scope manager detects a preset entry operation of the first scope object; wherein the preset entry operation is used to indicate that the first scope object enters a valid state, the scope tree structure is used to maintain validity constraint relationships between scope objects, and the first scope node is used to store operation data corresponding to the first scope object;

[0116] A second creation module 802, configured to create a first service controller for the first scope node;

[0117] The first acquisition module 803 is used to call the first service controller through the scope manager to acquire the service object corresponding to the first scope object, and start the service object.

[0118] In an optional implementation manner, the acquisition module is specifically used to:

[0119] The scope manager calls the first service controller to query a preset service registry, and obtains a service object associated with the scope type to which the first scope object belongs, as the service object corresponding to the first scope object; wherein the pre-service registry is used to store an association relationship between a pre-defined scope type and a service object.

[0120] In an optional implementation, the device further includes:

[0121] A first query module is configured to query a second scope node corresponding to the second scope object in the scope tree structure through the scope manager when it is determined that the scope manager detects a preset leave operation of the second scope object; wherein the preset leave operation is used to indicate that the second scope object leaves a valid state;

[0122] The first control module is used to call the second service controller of the second scope node through the scope manager to control the service object corresponding to the second scope object to stop running.

[0123] In an optional implementation, the device further includes:

[0124] A first determination module, configured to determine whether the second scope node has a child scope node based on the scope tree structure;

[0125] A second determination module, configured to determine whether a service object corresponding to a child scope node stops running if it is determined that the second scope node has a child scope node;

[0126] Accordingly, the control module is specifically used for:

[0127] After determining that the service objects corresponding to the respective child scope nodes of the second scope node have stopped running, the scope manager calls the second service controller in the second scope node to control the service objects corresponding to the second scope object to stop running.

[0128] In an optional implementation, the device further includes:

[0129] A second query module is configured to query a third scope node corresponding to the third scope object in the scope tree structure through the scope manager when it is determined that the scope manager detects a query operation of the third scope object;

[0130] The third query module is used to call the third service controller in the third scope node through the scope manager to query the service object corresponding to the third scope object.

[0131] In an optional implementation, the first scope object has an associated code structure unit, and a preset entry operation of the first scope object is triggered based on a preset valid state of the code structure unit.

[0132] In an optional implementation, the device further includes:

[0133] A third creation module is used to generate a first intersection scope object based on the multiple scope objects detected by the scope manager and create an intersection scope node for the first intersection scope object in the scope tree structure after determining that the scope manager has detected that multiple scope objects corresponding to the same intersection scope object have all created corresponding scope nodes; wherein the multiple scope objects have a common scope object, and the first intersection scope object includes an intersection of the multiple scope objects;

[0134] A fourth creation module, used to create an intersection service controller in the intersection scope node;

[0135] The second acquisition module is used to call the intersection service controller through the scope manager to acquire the service object corresponding to the first intersection scope object, and start the service object.

[0136] In an optional implementation, the device further includes:

[0137] A third determination module, configured to determine whether the first scope object corresponds to any intersection scope object when it is determined that the scope manager detects a preset entry operation of the first scope object;

[0138] A recording module is used to determine that the first scope object corresponds to any intersection scope object, and then record a preset relationship between the intersection scope object and the first scope object; wherein the preset relationship between the intersection scope object and the first scope object is used to determine whether multiple scope objects corresponding to the intersection scope object all create corresponding scope nodes.

[0139] In an optional implementation, the device further includes:

[0140] The replacement module is used to replace the target service object with the preset service object to start if it is determined that the service object corresponding to the first scope object includes a preset conversion service object.

[0141] In an optional implementation, the device further includes:

[0142] A third acquisition module, configured to acquire service startup sequence information provided by the preset scheduling service object if it is determined that the service object corresponding to the first scope object includes a preset scheduling service object;

[0143] Accordingly, the first acquisition module includes:

[0144] A startup submodule is used to start the service object corresponding to the first scope object based on the service startup sequence information.

[0145] In an optional implementation, the second creation module is specifically configured to create a first service controller in the first scope node.

[0146] In the service object processing device provided by the embodiment of the present disclosure, when it is determined that the scope manager detects a preset entry operation of the first scope object, a first scope node is created for the first scope object in the scope tree structure through the scope manager, and a first service controller is created for the first scope node. The first service controller is called by the scope manager to obtain and start the service object corresponding to the first scope object. The embodiment of the present disclosure provides a service container implementation method based on the scope object, and controls the startup of the corresponding service object through the preset entry operation of the scope object, thereby realizing the function of the service container.

[0147] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure further provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the service object processing method described in the embodiments of the present disclosure.

[0148] The embodiment of the present disclosure further provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the service object processing method described in the embodiment of the present disclosure is implemented.

[0149] In addition, the present disclosure also provides a service object processing device, see Fig. 9 As shown, it may include:

[0150] Processor 901, memory 902, input device 903 and output device 904. The number of processors 901 in the service object processing device can be one or more. Fig. 9 In some embodiments of the present disclosure, the processor 901, the memory 902, the input device 903 and the output device 904 may be connected via a bus or other means, wherein: Fig. 9 The example of connecting through bus is taken in the following.

[0151] The memory 902 can be used to store software programs and modules. The processor 901 executes various functional applications and data processing of the service object processing device by running the software programs and modules stored in the memory 902. The memory 902 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc. In addition, the memory 902 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The input device 903 can be used to receive input digital or character information, and generate signal input related to user settings and function control of the service object processing device.

[0152] Specifically in this embodiment, the processor 901 will load the executable files corresponding to the processes of one or more applications into the memory 902 according to the following instructions, and the processor 901 will run the applications stored in the memory 902, thereby realizing the various functions of the above-mentioned service object processing device.

[0153] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0154] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.< / myscope>

Claims

1. A service object processing method, characterized in that: The method comprises: When it is determined that the scope manager detects a preset entry operation of the first scope object, a first scope node is created for the first scope object in a scope tree structure by the scope manager; wherein the preset entry operation is used to indicate that the first scope object enters a valid state, the scope tree structure is used to maintain validity constraint relationships between scope objects, and the first scope node is used to store operation data corresponding to the first scope object; and, creating a first service controller for the first scope node; The scope manager calls the first service controller to obtain a service object corresponding to the first scope object, and starts the service object.

2. The method according to claim 1, characterized in that The step of calling the first service controller through the scope manager to obtain the service object corresponding to the first scope object includes: The scope manager calls the first service controller to query a preset service registry, and obtains a service object associated with the scope type to which the first scope object belongs, as the service object corresponding to the first scope object; wherein the pre-service registry is used to store an association relationship between a pre-defined scope type and a service object.

3. The method according to claim 1, characterized in that The method further comprises: When it is determined that the scope manager detects a preset leave operation of the second scope object, querying the scope manager for a second scope node corresponding to the second scope object in the scope tree structure; wherein the preset leave operation is used to indicate that the second scope object leaves a valid state; The scope manager calls the second service controller of the second scope node to control the service object corresponding to the second scope object to stop running.

4. The method according to claim 3, characterized in that Before calling the second service controller of the second scope node by the scope manager to control the service object corresponding to the second scope object to stop running, the method further includes: Determine whether the second scope node has a child scope node based on the scope tree structure; If it is determined that the second scope node has a child scope node, determining whether the service object corresponding to the child scope node stops running; Correspondingly, calling the second service controller of the second scope node through the scope manager to control the service object corresponding to the second scope object to stop running includes: After determining that the service objects corresponding to the respective child scope nodes of the second scope node have stopped running, the scope manager calls the second service controller of the second scope node to control the service objects corresponding to the second scope object to stop running.

5. The method according to claim 1, characterized in that The method further comprises: When it is determined that the scope manager detects a query operation of a third scope object, querying a third scope node corresponding to the third scope object in the scope tree structure through the scope manager; The scope manager calls the third service controller of the third scope node to query the service object corresponding to the third scope object.

6. The method according to claim 1, characterized in that The method further comprises: After determining that the scope manager detects that multiple scope objects corresponding to the same intersection scope object all create corresponding scope nodes, the scope manager generates a first intersection scope object based on the multiple scope objects, and creates an intersection scope node for the first intersection scope object in the scope tree structure; wherein the multiple scope objects have a common scope object, and the first intersection scope object includes an intersection of the multiple scope objects; and, creating an intersection service controller for the intersection scope node; The scope manager calls the intersection service controller to obtain a service object corresponding to the first intersection scope object, and starts the service object.

7. The method according to claim 6, characterized in that The method further comprises: When it is determined that the scope manager detects a preset entry operation of the first scope object, determining whether the first scope object corresponds to any intersection scope object; If it is determined that the first scope object corresponds to any intersection scope object, the preset relationship between the intersection scope object and the first scope object is recorded; wherein the preset relationship between the intersection scope object and the first scope object is used to determine whether multiple scope objects corresponding to the intersection scope object all create corresponding scope nodes.

8. The method according to claim 1, characterized in that After the scope manager calls the first service controller to obtain the service object corresponding to the first scope object and before the service object is started, the method further includes: If it is determined that the service object corresponding to the first scope object includes a preset conversion service object, the preset service object is used to replace the target service object for startup.

9. The method according to claim 1, characterized in that: After the scope manager calls the first service controller to obtain the service object corresponding to the first scope object and before the service object is started, the method further includes: If it is determined that the service object corresponding to the first scope object includes a preset scheduling service object, obtaining service startup sequence information provided by the preset scheduling service object; Accordingly, starting the service object includes: Based on the service startup sequence information, the service object corresponding to the first scope object is started.

10. The method according to claim 1, characterized in that The creating a first service controller for the first scope node includes: A first service controller is created within the first scope node.

11. A service object processing device, characterized in that: The device comprises: A first creation module, configured to create a first scope node for the first scope object in a scope tree structure through the scope manager when it is determined that the scope manager detects a preset entry operation of the first scope object; wherein the preset entry operation is used to indicate that the first scope object enters a valid state, the scope tree structure is used to maintain validity constraint relationships between scope objects, and the first scope node is used to store operation data corresponding to the first scope object; A second creation module, configured to create a first service controller for the first scope node; A startup module is used to call the first service controller through the scope manager to obtain the service object corresponding to the first scope object, and start the service object.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 10.

13. A service object processing device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method according to any one of claims 1 to 10 is implemented.