Single example object loading method and device, storage medium and electronic equipment

The asynchronous loading of singleton objects based on a page routing configuration table and object pool management addresses inefficiencies in traditional startup-based initialization, enhancing resource utilization and performance by creating objects only when needed.

CN119201276AActive Publication Date: 2024-12-27HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD

Patent Information

Application Number
CN202411298787.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-14
Publication Date
2024-12-27
Estimated Expiration
2044-09-14

AI Technical Summary

Technical Problem

Traditional methods for creating singleton objects require initialization at program startup, leading to resource waste and performance overhead, especially in large applications where many objects are not accessed, resulting in inefficient memory and computing resource utilization.

Method used

A method for asynchronously loading a page routing configuration table that includes singleton object information, querying for needed objects on demand, and maintaining an object pool to manage singleton objects dynamically, ensuring they are created only when required.

Benefits of technology

Improves system resource utilization efficiency and startup performance by optimizing singleton object creation and management, adapting to changing business needs, and reducing unnecessary resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119201276A_ABST
    Figure CN119201276A_ABST
Patent Text Reader

Abstract

The invention provides a singleton object loading method and device, a storage medium and electronic equipment, and is applied to the technical field of computers. The method comprises the following steps: when a terminal device starts a target application, firstly, asynchronously loading a page routing configuration table of the application; the table comprises a plurality of page routing definitions, corresponding page singleton service information and service function enabling states of the page singleton service information. And when the user accesses the page, checking the page routing configuration table to confirm whether a corresponding page routing definition exists. If so, singleton service information related thereto will be identified. And for the started singleton service, searching a corresponding singleton object in a preset object pool. If the object is found, the object is loaded, and a plurality of pre-configured singleton objects are stored in the preset object pool. According to the method and the device, the dynamic loading of the singleton object as required is realized through the page routing configuration table, and the creation and loading of the singleton object can be managed by reasonably utilizing computer resources, so that the utilization efficiency of system resources is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a singleton object loading method, device, storage medium and electronic device. Background Art

[0002] In modern software development, the singleton pattern is a common design pattern that aims to ensure that a class has only one instance and provide a global access point. This pattern is widely used in many applications, especially in scenarios where shared state or resource management is required. However, traditional methods of creating singleton objects often face a series of problems that affect application performance and resource utilization efficiency.

[0003] However, existing methods for creating singleton objects usually require initializing all singleton objects at the program startup stage. Although this approach can ensure the availability of singleton objects to a certain extent, it also brings significant resource waste and performance overhead. Especially in large applications, many singleton objects may not be accessed or needed during actual use by users, which leads to a waste of memory and computing resources.

[0004] Therefore, how to create and manage singleton objects on demand and realize dynamic loading of singleton objects has become a technical problem that technical personnel in this field urgently need to solve. Summary of the invention

[0005] In view of the above problems, the present invention provides a singleton object loading method, device, storage medium and electronic device that overcome the above problems or at least partially solve the above problems. The technical solution is as follows:

[0006] A singleton object loading method, comprising:

[0007] In the case where the terminal device starts the target application, asynchronously load the page routing configuration table of the target application, wherein the page routing configuration table includes page singleton object information of the target application, and the page singleton object information includes page routing definition information of each page in the target application, at least one page singleton service information having a mapping relationship with the page routing definition information, and a business function enabling status corresponding to the page singleton service information;

[0008] When the target page of the target application is opened, querying the page routing configuration table to see whether there is target page routing definition information of the target page, and if so, confirming the singleton service information of each target page that has a mapping relationship with the target page routing definition information;

[0009] For the target page singleton service information whose business function enablement status is enabled, a query is made in the preset object pool whether there is a target page singleton object corresponding to the target page singleton service information. If so, the target page singleton object is loaded, wherein the preset object pool stores multiple configured singleton objects.

[0010] Optionally, the method further includes:

[0011] When it is found that there is no target page singleton object corresponding to the target page singleton service information in the preset object pool, creating the target page singleton object by using the target page singleton service information;

[0012] After the target page singleton object is created, the target page singleton object is loaded and added to the preset object pool.

[0013] Optionally, before asynchronously loading the page routing configuration table of the target application, the method further includes:

[0014] Obtaining the page routing definition information of each page in the target application;

[0015] Respectively constructing a mapping relationship between each of the page routing definition information and at least one of the page singleton service information, and setting an enabled state of a business function corresponding to the page singleton service information, so as to generate the page singleton object information of the target application;

[0016] The page routing configuration table of the target application is created by at least using the page singleton object information.

[0017] Optionally, the method further includes:

[0018] Set the singleton object destruction attribute corresponding to the page singleton service information;

[0019] When exiting the target page, the target page singleton object whose singleton object destruction attribute is destroyed is destroyed.

[0020] Optionally, before asynchronously loading the page routing configuration table of the target application, the method further includes:

[0021] Obtaining at least one global singleton service information of the target application;

[0022] respectively setting the business function activation status corresponding to each of the global singleton service information to generate the global singleton object information of the target application;

[0023] The step of creating the page routing configuration table of the target application by at least using the page singleton object information includes:

[0024] The page routing configuration table of the target application is constructed using the page singleton object information and the global singleton object information.

[0025] Optionally, the method further includes:

[0026] When the target page of the target application is opened, obtaining each piece of the global singleton service information in the global singleton object information in the page routing configuration table;

[0027] For the global singleton service information whose business function activation status is enabled, the preset object pool is queried whether there is a target global singleton object corresponding to the global singleton service information. If so, the target global singleton object is loaded; if not, the target global singleton object is created using the global singleton service information, and the target global singleton object is added to the preset object pool.

[0028] Optionally, the page routing definition information includes a page path and a page class name of a page of the target application, and when the target page of the target application is opened, querying the page routing configuration table to see whether the target page routing definition information of the target page exists includes:

[0029] In the case where the user accesses the target page of the target application through the routing mechanism, the page path of the target page is obtained; the page path is used as a query condition to query whether there is the page routing definition information matching the page path in the page routing configuration table, and if so, the page routing definition information is confirmed as the target page routing definition information of the target page;

[0030] In the case that the target page visited by the user is a hard-coded page, the page class name of the target page is obtained; the page class name is used as a query condition, and the page routing configuration table is queried to see whether there is page routing definition information that matches the page class name; if so, the page routing definition information is confirmed as the target page routing definition information of the target page.

[0031] A singleton object loading device comprises: a page routing configuration table loading unit, a page routing definition information query unit, a page singleton service information confirmation unit, a page singleton object query unit and a page singleton object loading unit.

[0032] The page routing configuration table loading unit is used to asynchronously load the page routing configuration table of the target application when the terminal device starts the target application, wherein the page routing configuration table includes page singleton object information of the target application, and the page singleton object information includes page routing definition information of each page in the target application, at least one page singleton service information having a mapping relationship with the page routing definition information, and a business function enabling state corresponding to the page singleton service information;

[0033] The page routing definition information query unit is used to query whether the target page routing definition information of the target page exists in the page routing configuration table when the target page of the target application is opened, and if yes, trigger the page singleton service information confirmation unit;

[0034] The page singleton service information confirmation unit is used to confirm each target page singleton service information that has a mapping relationship with the target page routing definition information;

[0035] The page singleton object query unit is used to query whether there is a target page singleton service information corresponding to the target page singleton service information in a preset object pool for the target page singleton service information whose business function activation status is enabled, and if yes, trigger the page singleton object loading unit;

[0036] The page singleton object loading unit is used to load the target page singleton object;

[0037] Wherein, the preset object pool stores a plurality of configured singleton objects.

[0038] A computer-readable storage medium stores a program, wherein when the program is executed by a processor, the singleton object loading method described in any one of the above items is implemented.

[0039] An electronic device comprises at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other via the bus; and the processor is used to call program instructions in the memory to execute any of the singleton object loading methods described above.

[0040] By means of the above technical scheme, the present invention provides a singleton object loading method, device, storage medium and electronic device, the method comprising: when a terminal device starts a target application, asynchronously loading a page routing configuration table of the target application, wherein the page routing configuration table includes page singleton object information of the target application, the page singleton object information includes page routing definition information of each page in the target application, at least one page singleton service information having a mapping relationship with the page routing definition information, and a business function enabling status corresponding to the page singleton service information; when a target page of the target application is opened, querying in the page routing configuration table whether there is target page routing definition information of the target page, if so, confirming each target page singleton service information having a mapping relationship with the target page routing definition information; for target page singleton service information whose business function enabling status is enabled, querying in a preset object pool whether there is a target page singleton object corresponding to the target page singleton service information, if so, loading the target page singleton object, wherein a plurality of configured singleton objects are stored in the preset object pool. The present invention realizes dynamic on-demand loading of singleton objects through a page routing configuration table, and can reasonably utilize computer resources to manage the creation and loading of singleton objects, thereby effectively improving system resource utilization efficiency and startup performance.

[0041] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0043] Figure 1 A schematic diagram showing a flow chart of an implementation of a singleton object loading method provided in an embodiment of the present invention;

[0044] Figure 2 A schematic flow chart of another implementation of a singleton object loading method provided in an embodiment of the present invention is shown;

[0045] Figure 3 A schematic flow chart of another implementation of a singleton object loading method provided in an embodiment of the present invention is shown;

[0046] Figure 4 An example diagram of a page routing configuration table provided by an embodiment of the present invention is shown;

[0047] Figure 5 A schematic diagram of the structure of a singleton object loading device provided by an embodiment of the present invention is shown;

[0048] Figure 6 A schematic structural diagram of an electronic device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0049] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.

[0050] In modern software development, the singleton pattern is a design pattern that aims to ensure that a class has only one instance and provides a global access point. Although this pattern is very common in scenarios that require sharing state or managing resources, traditional methods of creating singleton objects often have performance and resource utilization efficiency issues. Typically, existing methods require that all singleton objects be initialized at the program startup phase, which ensures the availability of the object but also leads to resource waste and performance overhead. Especially in large applications, many singleton objects may not be accessed or needed during actual use, resulting in unnecessary consumption of memory and computing resources.

[0051] To solve this problem, the industry has proposed some on-demand loading strategies. A common practice is to hard-code the creation logic of the singleton object into the page to achieve on-demand loading of the singleton. However, this method has obvious shortcomings. First, the hard-coding method creates singleton objects according to fixed logic every time the page is loaded, even if these objects are not necessarily required in the context of the current user. This approach not only reduces the flexibility of the system, but also increases the complexity of maintenance. When business needs change or user contexts are different, hard-coded logic is difficult to adjust effectively, making it difficult for the system to adapt to real-time changing needs.

[0052] In summary, the resource waste and performance overhead caused by the traditional method of batch loading singleton objects at program startup, as well as the lack of flexibility of existing technologies in implementing on-demand loading of singletons through hard coding, all indicate that the current singleton management strategy urgently needs to be improved.

[0053] Based on this, in an embodiment of the present invention, a singleton object loading method is provided. When the terminal device starts the target application, the page routing configuration table of the application is first asynchronously loaded. The table contains multiple page routing definitions, corresponding page singleton service information and its business function enablement status. When a user accesses a page, the page routing configuration table is checked to confirm whether there is a corresponding page routing definition. If it exists, the singleton service information related to it will be identified. For enabled singleton services, the corresponding singleton object is searched in the preset object pool. If found, the object will be loaded, and the preset object pool stores multiple pre-configured singleton objects. It can be seen that the present invention optimizes the creation and management methods of singleton objects through the page routing configuration table, which can not only improve the performance of the system, but also enhance the system's adaptability to business needs and achieve more efficient resource utilization.

[0054] like Figure 1 As shown, a flowchart of an implementation of a singleton object loading method provided by an embodiment of the present invention is provided. The method may include:

[0055] S100. When the terminal device starts the target application, the page routing configuration table of the target application is asynchronously loaded, wherein the page routing configuration table includes the page singleton object information of the target application, and the page singleton object information includes the page routing definition information of each page in the target application, at least one page singleton service information having a mapping relationship with the page routing definition information, and the business function enabling status corresponding to the page singleton service information.

[0056] Among them, terminal devices refer to hardware devices used by users, such as smartphones, tablets, personal computers, etc. Terminal devices can run applications, process user input and display content.

[0057] The target application refers to the specific software or program that the user launches on the terminal device, such as social media applications, e-commerce platforms, games or other functional applications. The target application meets the user's needs by providing specific functions and interfaces.

[0058] Among them, asynchronous loading is a programming technique that allows an application to perform certain operations in the background without blocking the main thread or user interface.

[0059] The page routing configuration table is a data structure that contains routing information for each page in the target application. The page routing configuration table records all pages of the application and their corresponding access paths (routes), as well as the services and function states related to these pages.

[0060] The page singleton object information refers to the detailed information of the singleton object associated with the page in the application. A singleton object is an object that only creates one instance during the running of the application. Singleton objects usually contain the state and behavior of the page, ensuring that they can be used and accessed efficiently in different contexts.

[0061] The page routing definition information refers to a specific entry in the page routing configuration table, which describes the unique identifier or access path of a certain page. The page routing definition information defines how a user navigates to a corresponding page and usually includes a URL or a specific path string.

[0062] The page singleton service information refers to the service information associated with the specific page routing definition information. These services are usually components that process the business logic of the page, and can include functions such as data acquisition and state management. The page singleton service exists in singleton mode to ensure that only one instance processes a specific page logic throughout the application life cycle.

[0063] Among them, the business function enablement status refers to whether the function related to the page singleton service information is enabled in the current application environment. It is usually represented by a Boolean value (such as "enabled" or "disabled"). The business function enablement status determines whether a specific function can be used when a user visits the relevant page, affecting the behavior of the page and the user experience.

[0064] Specifically, when a user starts a target application on a mobile device, an embodiment of the present invention can use a library for processing network requests (for example, URLSession (iOS) or OkHttp (Android)) to execute asynchronous HTTP requests, and process the server's response through a callback function to asynchronously obtain the latest page routing configuration table of the target application from the server.

[0065] Optionally, in the event that a request to obtain a page routing configuration table fails due to network fluctuations or server failures, an embodiment of the present invention can automatically retry the request to obtain a page routing configuration table. After retrying a preset number of times, if the request to obtain the page routing configuration table still fails, the page routing configuration table in the local cache of the most recent successful request is switched to ensure that the application can run smoothly and provide a good user experience.

[0066] S110. When the target page of the target application is opened, query the page routing configuration table to see whether there is target page routing definition information of the target page. If yes, execute step S120.

[0067] Specifically, when the user opens the target page of the target application, the embodiment of the present invention will query the page routing configuration table to determine whether there is page routing definition information of the target page. If the corresponding page routing definition information is found, it means that the target page is supported and can be loaded, and then the next step is executed.

[0068] Optionally, in the embodiment of the present invention, when the target page route definition information of the target page does not exist in the page route configuration table query, that is, the target page does not involve the singleton creation logic, the target page can be loaded normally. The embodiment of the present invention provides normal page loading logic for the scenario where the target page does not involve the singleton creation logic, which can ensure that the user experiences the target page normally.

[0069] S120: Confirm the singleton service information of each target page that has a mapping relationship with the target page routing definition information.

[0070] Specifically, the embodiment of the present invention confirms all singleton service information related to the target page routing definition information, that is, the singleton service associated with the current page, to identify the page service component that needs to be loaded.

[0071] S130. For the target page singleton service information whose business function enabling status is enabled, query whether there is a target page singleton object corresponding to the target page singleton service information in the preset object pool. If yes, execute step S140.

[0072] Among them, the preset object pool stores multiple configured singleton objects.

[0073] Specifically, the embodiment of the present invention searches a preset object pool for a page singleton service whose business function is enabled in the enabled state to see whether a page singleton object corresponding to the service already exists. If the page singleton object is found in the object pool, it does not need to be recreated and the page singleton object can be used directly. The embodiment of the present invention ensures that each singleton object is created only once by maintaining a pool of created singleton objects, thereby avoiding waste of resources caused by repeatedly creating the same singleton object.

[0074] S140, loading the target page singleton object.

[0075] Specifically, after finding the page singleton object of the target page in the preset object pool, the embodiment of the present invention can load the page singleton object for the target page operation. The embodiment of the present invention effectively avoids application performance degradation and invalid resource consumption by loading the singleton object only when the route is configured and the business function is activated.

[0076] In actual applications, due to business logic reasons (such as AB testing or function offline, etc.), some singleton objects do not need to be created. In this case, the business function enablement status corresponding to the corresponding target page singleton service information can be set to disabled to indicate that the corresponding singleton objects do not need to be created.

[0077] Scenarios where the business function enablement status is set to disabled may include the product testing phase, when certain functions are not available to a specific user group, or when functions are temporarily offline. The purpose of setting the "enablement switch" is to flexibly control the release and deactivation of functions, thereby avoiding unnecessary resource occupation and confusion in user experience, and ensuring that singleton objects are managed reasonably and efficiently in the application. For example, during the review of an application, if a business function fails to pass the review for some reason, the business function enablement status can be configured to "disabled", thereby prohibiting the creation of related singleton objects and disabling the service.

[0078] It is understandable that the page routing definition information can be mapped to multiple page singleton service information. In these page singleton service information, the embodiment of the present invention can skip the creation of page singleton objects whose business function enablement status is disabled, and continue to load page singleton objects whose business function enablement is enabled. For page singleton objects that have not been created, the embodiment of the present invention can hide the content or prompts related to the functions of the page singleton object in the loaded target page, while ensuring the normal operation of the functions of other created page singleton objects.

[0079] Optionally, when the business function corresponding to the singleton service information of any page of the target application is disabled, the embodiment of the present invention can guide the user to view a preset error page or a preset default page, or prompt the user to check and update the application to ensure that the user experience is not affected. Under the dynamic on-demand loading mechanism, the embodiment of the present invention provides a corresponding fallback strategy for a variety of scenarios where singleton objects do not need to be created, which can maintain the robustness of the underlying code and ensure the user's service experience.

[0080] The present invention provides a singleton object loading method, the method comprising: when a terminal device starts a target application, asynchronously loading a page routing configuration table of the target application, wherein the page routing configuration table includes a plurality of page routing definition information, at least one page singleton service information having a mapping relationship with the page routing definition information, and a business function enabling state corresponding to the page singleton service information; when a target page of the target application is opened, querying in the page routing configuration table whether there is a target page routing definition information of the target page, if yes, confirming each target page singleton service information having a mapping relationship with the target page routing definition information; for the target page singleton service information whose business function enabling state is enabled, querying in a preset object pool whether there is a target page singleton object corresponding to the target page singleton service information, if yes, loading the target page singleton object, wherein a plurality of configured singleton objects are stored in the preset object pool. The present invention realizes dynamic on-demand loading of singleton objects through a page routing configuration table, can reasonably utilize computer resources to manage the creation and loading of singleton objects, thereby effectively improving system resource utilization efficiency and startup performance.

[0081] Optional, in the above Figure 1 On the basis of one or more corresponding embodiments, in another optional embodiment provided by the embodiment of the present invention, the method may further include:

[0082] When it is found in the preset object pool that there is no target page singleton object corresponding to the target page singleton service information, the target page singleton object is created using the target page singleton service information; after the target page singleton object is created, the target page singleton object is loaded and added to the preset object pool.

[0083] When loading a target page, the embodiment of the present invention will first query whether a singleton object associated with the target page already exists in the preset object pool. If so, the singleton object is directly obtained from the preset object pool to avoid repeated creation. If not, it is necessary to create a new singleton object based on the page singleton service information of the target page. For example: when a user visits the "home" page, SingletonA (user information management) and SingletonB (data statistics module) are created and loaded according to the instructions of the configuration table. These singleton objects are only created when the user visits the page, realizing on-demand loading, thereby optimizing resource utilization efficiency.

[0084] Specifically, the page singleton service information usually includes the configuration information, dependencies, initialization parameters, etc. required for the business logic of the page. By reading this information, the embodiment of the present invention can initialize the singleton object according to the established creation process. The creation process may include: first, obtain the initial configuration required for the target page from the page singleton service information, such as specific business rules, database connections, external dependency services, etc. Secondly, according to the description in the page singleton service information, initialize other resources or objects that the singleton object depends on, such as configuration loading, service calls, etc. Finally, use the initial configuration and dependencies to call the constructor or factory method of the target singleton object to instantiate the singleton object.

[0085] After the singleton object is created, the embodiment of the present invention will load the singleton object into the memory and prepare it for use by the target page. At the same time, in order to avoid repeated creation, the singleton object will be stored in a preset object pool so that subsequent requests for the same page can reuse the singleton object.

[0086] The embodiment of the present invention can dynamically create and load singleton objects when needed through the page routing definition information in the page routing configuration table, thereby avoiding the pre-allocation of unnecessary resources at the application startup stage. At the same time, an object pool of created singleton objects is maintained to ensure that each singleton object is only created in sequence, avoiding the waste of resources caused by repeated creation.

[0087] For example, taking the MGTV APP as an example, its home page tag contains multiple channel pages. Through the singleton object loading method provided by the embodiment of the present invention, the recommendation algorithm singletons related to each page can be dynamically loaded according to the page routing configuration table. When the user visits the "home page", only the recommendation algorithm singleton corresponding to the home page is created and loaded; and when the user switches to the "TV series" channel, the singleton corresponding to the channel is created and loaded, thereby effectively avoiding the preloading of useless singletons, thereby improving the efficiency and response speed of the application.

[0088] In the traditional on-demand loading method, if the creation of a singleton object fails, it may cause business errors or UI confusion. However, in the scenario of dynamically creating a singleton based on page routing, the situation where the singleton is not effective has been fully considered during coding. Therefore, even if the creation of a singleton object fails, you can deal with it by referring to the fallback strategy that does not enable the singleton in the interface, such as skipping the creation of the singleton object, guiding the user to view the preset error page or preset default page, or prompting the user to check for application updates, so as to ensure that the user experience is not affected.

[0089] Optional, based on Figure 1 The method shown, such as Figure 2As shown, a flow chart of another implementation of a singleton object loading method provided by an embodiment of the present invention is provided. Before asynchronously loading the page routing configuration table of the target application, the method may further include:

[0090] S200: Obtain page routing definition information for each page in the target application.

[0091] Specifically, the embodiment of the present invention can collect and organize key information such as URL paths and page class names of all pages in the target application, thereby obtaining page routing definition information of each page in the target application.

[0092] S210: Construct a mapping relationship between each page routing definition information and at least one page singleton service information respectively, and set the business function enabling state corresponding to the page singleton service information to generate page singleton object information of the target application.

[0093] Specifically, the embodiment of the present invention can determine the singleton objects (services or components) required for each page, and set the enabled state of these singleton objects according to business requirements. By constructing a mapping relationship between page routing definition information and page singleton service information, the singleton objects required by each page at runtime are clarified, thereby generating corresponding page singleton object information.

[0094] S220: Create a page routing configuration table of the target application using at least the page singleton object information.

[0095] Specifically, the embodiment of the present invention can use the generated page singleton object information to construct a page routing configuration table of the target application to summarize the routing information of each page, the corresponding singleton object and its enabled status.

[0096] The embodiment of the present invention can dynamically manage the relationship between application pages and singleton objects by creating a page routing configuration table of the target application, thereby facilitating the creation of singleton objects on demand to improve resource utilization efficiency and adapt to changes in business needs.

[0097] Optional, in the above Figure 2 On the basis of one or more corresponding embodiments, in another optional embodiment provided by the embodiment of the present invention, the method may further include:

[0098] Set the singleton object destruction attribute corresponding to the page singleton service information. When exiting the target page, destroy the target page singleton object whose singleton object destruction attribute is destroyed.

[0099] The singleton object destruction attribute refers to an attribute used to indicate whether a singleton object should be destroyed or its resources should be released when exiting the target page.

[0100] Specifically, when defining corresponding page singleton service information for each page, the embodiment of the present invention specifies a singleton object destruction attribute for the page singleton service information. The singleton object destruction attribute is usually a Boolean value and may be named "destroyOnExit" or a similar identifier.

[0101] When the user exits the target page or navigates to another page, the embodiment of the present invention can determine the singleton object destruction attribute of the singleton object used in the current page. If the singleton object destruction attribute is set to a true value (e.g., true), the singleton object is destroyed to release the resources occupied by the singleton object and avoid unnecessary memory occupation.

[0102] The embodiment of the present invention can effectively manage the life cycle of a singleton object by setting a singleton object destruction attribute, so that the application can reasonably utilize system resources while maintaining efficient performance.

[0103] Optional, based on Figure 2 The method shown, such as Figure 3 As shown, a flow chart of another implementation of a singleton object loading method provided by an embodiment of the present invention is provided. Before asynchronously loading the page routing configuration table of the target application, the method may further include:

[0104] S300: Obtain at least one global singleton service information of a target application.

[0105] The global singleton service information refers to the instance service or object information defined by the target application in the entire application scope. The global singleton service information includes some core functions or states of the target application so that each part of the entire application can access and use it.

[0106] Specifically, the embodiment of the present invention can obtain the global singleton service information of the target application by reading the service from the configuration file of the target application, the service registration center or other sources.

[0107] S310: respectively set the business function activation status corresponding to each piece of global singleton service information to generate global singleton object information of the target application.

[0108] The global singleton object information refers to detailed information of a specific instance or object associated with the global singleton service information.

[0109] Specifically, after obtaining the global singleton service information, the embodiment of the present invention sets the corresponding business function activation state for the global singleton service information, specifies the global singleton object required by the application at runtime, and thereby generates corresponding global singleton object information.

[0110] Step S220 may be specifically step S320.

[0111] S320: Build a page routing configuration table of the target application using the page singleton object information and the global singleton object information.

[0112] Among them, the page routing configuration table constructed by the page singleton object information and the global singleton object information can be as follows Figure 4 As shown in the figure. The page routing configuration table is only requested from the server when the application is cold started, so the page routing configuration table will not change while the application is running. This means that the state of the singleton object will not be affected by configuration changes while the application is running. If the page routing configuration table is changed after a cold start, these changes will take effect at the next cold start. Therefore, there is no need to deal with the "expiration" problem of the singleton object at runtime. The singleton object is recreated or initialized only according to the new page routing configuration table at cold start, thereby ensuring the stability of the system and the efficient use of resources.

[0113] The pseudo code of the instance structure of the page routing configuration table can be

[0114]

[0115] The embodiment of the present invention uniformly manages the page singleton object information and global singleton object information of the application page through the page routing configuration table, which is conducive to flexible adjustment of the creation and loading of singleton objects involving the application page, thereby helping to adapt to real-time changes in business needs.

[0116] Optional, in the above Figure 3 On the basis of one or more corresponding embodiments, in another optional embodiment provided by the embodiment of the present invention, the method may further include:

[0117] When the target page of the target application is opened, the global singleton service information in the global singleton object information is obtained in the page routing configuration table. For the global singleton service information whose business function is enabled, the preset object pool is queried to see whether the target global singleton object corresponding to the global singleton service information exists. If yes, the target global singleton object is loaded. If not, the global singleton service information is used to create the target global singleton object, and the target global singleton object is added to the preset object pool.

[0118] Specifically, when a user opens a target page of a target application, an embodiment of the present invention queries a page routing configuration table to obtain information about each global singleton service in the global singleton object information of the target application, that is, the global singleton service associated with the target application, to identify the global service component that needs to be loaded.

[0119] Specifically, for a global singleton service whose business function is enabled in the enabled state, the embodiment of the present invention searches the preset object pool for a global singleton object corresponding to the service. If the global singleton object is found in the object pool, it does not need to be recreated and the global singleton object is used directly. By maintaining a pool of created singleton objects, the embodiment of the present invention ensures that each singleton object is created only once, thereby avoiding the waste of resources caused by repeatedly creating the same singleton object.

[0120] Specifically, after finding the global singleton object of the target application in the preset object pool, the embodiment of the present invention can load the global singleton object for the target page operation. The embodiment of the present invention effectively avoids application performance degradation and ineffective resource consumption by loading the singleton object only when the global service has been configured and the business function is activated.

[0121] It is understandable that, similar to the page singleton service information, for the global singleton service information, the embodiment of the present invention can skip the creation of the global singleton object whose business function enablement status is disabled, and continue to load the global singleton object whose business function enablement is enabled. For the global singleton object that has not been created, the embodiment of the present invention can hide the content or prompt related to the function of the global singleton object in the loaded target page, while ensuring the normal operation of the functions of other created global singleton objects.

[0122] The embodiment of the present invention manages global singleton objects by presetting an object pool, and only loads or creates global singleton objects when needed, which can avoid the overhead of repeated object creation and reduce resource consumption, thereby improving the response speed of the application and enhancing the overall performance of the application.

[0123] Optional, in the above Figure 1 On the basis of one or more corresponding embodiments, in another optional embodiment provided by the embodiment of the present invention, the page routing definition information includes the page path and page class name of the page of the target application. When the target page of the target application is opened, the page routing configuration table is queried to determine whether the target page routing definition information of the target page exists. Specifically, the following may be included:

[0124] When a user accesses the target page of the target application through the routing mechanism, the page path of the requested target page is obtained; the page path is used as a query condition to query whether there is page routing definition information matching the page path in the page routing configuration table; if so, the page routing definition information is confirmed as the target page routing definition information of the target page.

[0125] The page path refers to the URL path that users need to use when accessing a page in an application, such as " / home", " / about", and " / products".

[0126] Specifically, the user can navigate to the target page in the target application by clicking a link, a bookmark, or manually entering a URL. The embodiment of the present invention uses the acquired page path as a condition in response to the complete page path requested by the user to query the page routing configuration table to check whether there is page routing definition information matching the path. If the query result contains a matching page path, the corresponding page routing definition information is confirmed as the target page routing definition information of the target page. This indicates that the application has successfully found the page logic corresponding to the user's request path.

[0127] When the target page accessed by the user is a hard-coded page, the page class name of the target page is obtained; the page class name is used as a query condition to query whether there is page routing definition information matching the page class name in the page routing configuration table; if so, the page routing definition information is confirmed as the target page routing definition information of the target page.

[0128] The page class name refers to the class name corresponding to the page logic, usually a class defined in JavaScript or other languages, used to render and manage the logic of the page. For example: "HomePage" and "AboutPage".

[0129] In some cases, the page may not be generated by dynamic routing, but hard-coded (for example, a page defined directly in the code). In response to this situation, the embodiment of the present invention can obtain the corresponding page class name from the accessed page, use the obtained page class name as a query condition to query the page routing configuration table again, and check whether there is page routing definition information matching the page class name. If a matching page class name is found, the corresponding routing definition information is confirmed as the target page routing definition information of the target page.

[0130] The embodiment of the present invention confirms the routing definition information of the target page requested by the user through the page path and page class name, so that the target application can flexibly handle different types of page access requests, which is conducive to supporting multiple access methods (paths and class names) and adapting to diverse application requirements, thereby helping to improve the maintainability of the application and user experience.

[0131] In order to facilitate understanding of the overall process of singleton object management of the singleton object loading method provided by the embodiment of the present invention, an example is given here to illustrate: First, initialize the singleton pool. When the application is cold started, the global singleton pool will be initialized according to the globalSingletons configuration item in the page routing configuration table, and all global singleton objects, such as LoggerService and DatabaseService, will be created and stored for shared use during application operation. When processing page loading, the corresponding configuration will be matched according to different scenarios to create and manage the required singleton objects.

[0132] For routing scenarios: When a user accesses a page through a routing mechanism (such as iPhone's UniversalLink), find a match in the path field in the configuration table based on the request path (for example: / home). Look for a path field in the configuration table that matches the request path. If a match is found, load the corresponding page and its required singleton object. For example: A user accesses the / home route through myapp: / / home, finds the HomePage page based on the path field, and checks whether the UserService singleton object needs to be loaded. If UserService does not yet exist in the singleton pool, the system creates it and adds it to the pool.

[0133] For non-routing scenarios: For pages instantiated by hard-coding (for example, using the new keyword directly), match the page class name (such as HomePage) with the page field in the configuration table. Find the page field in the configuration table that matches the page class name to determine whether the corresponding singleton object needs to be created and loaded. For example: When instantiating HomePage in the code, find the corresponding page configuration based on the page field and check whether the UserService singleton object needs to be created. If UserService does not yet exist in the singleton pool, create and initialize the object.

[0134] When the page disappears, the destroyOnExit property of the singleton object determines whether to destroy the object. If the destroyOnExit property is true, the singleton object will be destroyed and removed from the preset object pool. If the destroyOnExit property is false, the singleton object will be retained for subsequent use by other pages. For example: when accessing the / profile page, if the destroyOnExit property of ProfileService is true, the ProfileService instance will be destroyed and removed from the object pool after the page disappears.

[0135] The embodiment of the present invention avoids the situation in which singleton objects occupy memory for a long time in traditional solutions by dynamically loading on demand, and in particular, reduces resource waste by automatically destroying the object when it is no longer needed. At the same time, by intelligently managing the life cycle of singleton objects, it is possible to improve resource utilization efficiency and reduce the complexity of manual management.

[0136] The singleton object loading method provided in the embodiment of the present invention adopts a flexibly configurable singleton mode, which is not restricted by specific business in principle. It is particularly suitable for large-scale multi-functional application scenarios that require global resource sharing and complex business logic management, and can ensure efficient and stable utilization of resources and improve user experience.

[0137] Although operations are depicted in a particular order, this should not be understood as requiring that the operations be performed in the particular order shown or in a sequential order.Multitasking and parallel processing may be advantageous under certain circumstances.

[0138] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.

[0139] Corresponding to the above method embodiment, the embodiment of the present invention also provides a singleton object loading device, whose structure is as follows: Figure 5 As shown, it may include: a page routing configuration table loading unit 10, a page routing definition information query unit 20, a page singleton service information confirmation unit 30, a page singleton object query unit 40 and a page singleton object loading unit 50.

[0140] The page routing configuration table loading unit 10 is used to asynchronously load the page routing configuration table of the target application when the terminal device starts the target application, wherein the page routing configuration table includes the page singleton object information of the target application, and the page singleton object information includes the page routing definition information of each page in the target application, at least one page singleton service information that has a mapping relationship with the page routing definition information, and the business function activation status corresponding to the page singleton service information.

[0141] The page routing definition information query unit 20 is used to query whether the target page routing definition information of the target page exists in the page routing configuration table when the target page of the target application is opened, and if yes, trigger the page singleton service information confirmation unit 30.

[0142] The page singleton service information confirmation unit 30 is used to confirm each target page singleton service information that has a mapping relationship with the target page routing definition information.

[0143] The page singleton object query unit 40 is used to query whether there is a target page singleton service information corresponding to the target page singleton service information whose business function activation status is enabled in the preset object pool, and if so, trigger the page singleton object loading unit 50.

[0144] The page singleton object loading unit 50 is used to load the target page singleton object.

[0145] Among them, the preset object pool stores multiple configured singleton objects.

[0146] Optionally, the singleton object loading device may further include: a page singleton object creating unit and a page singleton object storing unit.

[0147] The page singleton object creation unit is used to create a target page singleton object using the target page singleton service information when there is no target page singleton object corresponding to the target page singleton service information in the preset object pool. After the target page singleton object is created, the page singleton object loading unit 50 is triggered to load the target page singleton object, and the page singleton object storage unit is triggered to add the target page singleton object to the preset object pool.

[0148] Optionally, the singleton object loading device may further include: a page routing definition information obtaining unit, a page singleton object information generating unit and a page routing configuration table creating unit.

[0149] The page routing definition information obtaining unit is used to obtain the page routing definition information of each page in the target application before the page routing configuration table loading unit 10 asynchronously loads the page routing configuration table of the target application;

[0150] A page singleton object information generation unit, used to respectively construct a mapping relationship between each page routing definition information and at least one page singleton service information, and set the business function activation state corresponding to the page singleton service information to generate page singleton object information of the target application;

[0151] The page routing configuration table creation unit is used to create a page routing configuration table of a target application by at least using the page singleton object information.

[0152] Optionally, the singleton object loading device may further include: a singleton object destruction property setting unit and a page singleton object destruction unit.

[0153] The singleton object destruction attribute setting unit is used to set the singleton object destruction attribute corresponding to the page singleton service information.

[0154] The page singleton object destruction unit is used to destroy the target page singleton object whose singleton object destruction attribute is destroyed when exiting the target page.

[0155] Optionally, the singleton object loading device may further include: a global singleton service information obtaining unit and a global singleton object information generating unit.

[0156] The global singleton service information obtaining unit is used to obtain at least one global singleton service information of a target application.

[0157] The global singleton object information generating unit is used to respectively set the business function enabling status corresponding to each piece of global singleton service information to generate the global singleton object information of the target application.

[0158] The page routing configuration table creation unit can be specifically used to construct a page routing configuration table of a target application by using page singleton object information and global singleton object information.

[0159] Optionally, the singleton object loading device may further include: a global singleton service information acquisition unit, a global singleton object query unit, a global singleton object loading unit, a global singleton object creation unit and a global singleton object storage unit.

[0160] The global singleton service information acquisition unit is used to acquire each piece of global singleton service information in the global singleton object information in the page routing configuration table when the target page of the target application is opened.

[0161] The global singleton object query unit is used to query whether the target global singleton object corresponding to the global singleton service information whose business function is enabled is in the enabled state in the preset object pool. If so, the global singleton object loading unit is triggered; if not, the global singleton object creation unit is triggered.

[0162] The global singleton object loading unit is used to load the target global singleton object.

[0163] The global singleton object creation unit is used to create a target global singleton object using the global singleton service information.

[0164] The global singleton object storage unit is used to add the target global singleton object to the preset object pool.

[0165] Optionally, the page routing definition information includes a page path and a page class name of a page of the target application.

[0166] Optionally, the page routing definition information query unit 20 may include: a routing access scenario matching subunit and a non-routing scenario matching subunit.

[0167] The routing access scenario matching sub-unit is used to obtain the page path of the requested target page when the user accesses the target page of the target application through the routing mechanism; using the page path as the query condition, querying in the page routing configuration table whether there is page routing definition information matching the page path, and if so, confirming the page routing definition information as the target page routing definition information of the target page.

[0168] The non-routing scenario matching sub-unit is used to obtain the page class name of the target page when the target page visited by the user is a hard-coded page; the page class name is used as a query condition to query whether there is page routing definition information matching the page class name in the page routing configuration table, and if so, the page routing definition information is confirmed as the target page routing definition information of the target page.

[0169] The present invention provides a singleton object loading device, which is used to asynchronously load the page routing configuration table of the target application when the terminal device starts the target application, wherein the page routing configuration table includes the page singleton object information of the target application, and the page singleton object information includes the page routing definition information of each page in the target application, at least one page singleton service information with a mapping relationship with the page routing definition information, and the business function enabling state corresponding to the page singleton service information; when the target page of the target application is opened, the page routing configuration table is queried to see whether there is the target page routing definition information of the target page, and if so, the singleton service information of each target page with a mapping relationship with the target page routing definition information is confirmed; for the target page singleton service information with a business function enabling state of enabled, the preset object pool is queried to see whether there is a target page singleton object corresponding to the target page singleton service information, and if so, the target page singleton object is loaded, wherein the preset object pool stores a plurality of configured singleton objects. The present invention realizes dynamic on-demand loading of singleton objects through the page routing configuration table, and can reasonably use computer resources to manage the creation and loading of singleton objects, thereby effectively improving the system resource utilization efficiency and startup performance.

[0170] Regarding the device in the above embodiment, the specific manner in which each unit performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.

[0171] The singleton object loading device includes a processor and a memory. The above-mentioned page routing configuration table loading unit 10, page routing definition information query unit 20, page singleton service information confirmation unit 30, page singleton object query unit 40 and page singleton object loading unit 50 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.

[0172] The processor contains a kernel, which calls the corresponding program unit from the memory. The kernel can be set to one or more, and the kernel parameters can be adjusted to achieve dynamic on-demand loading of singleton objects through the page routing configuration table, and the computer resources can be reasonably used to manage the creation and loading of singleton objects, thereby effectively improving the efficiency of system resource utilization.

[0173] An embodiment of the present invention provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the singleton object loading method is implemented.

[0174] An embodiment of the present invention provides a processor, which is used to run a program, wherein the singleton object loading method is executed when the program is running.

[0175] like Figure 6 As shown, an embodiment of the present invention provides an electronic device 1000, which includes at least one processor 1001, at least one memory 1002 connected to the processor 1001, and a bus 1003; wherein the processor 1001 and the memory 1002 communicate with each other through the bus 1003; the processor 1001 is used to call the program instructions in the memory 1002 to execute the above-mentioned singleton object loading method. The electronic device in this article can be a server, a PC, a PAD, a mobile phone, etc.

[0176] The present invention also provides a computer program product, which, when executed on an electronic device, is suitable for executing a program that initializes the steps of the singleton object loading method.

[0177] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatuses, electronic devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to generate a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0178] In a typical configuration, an electronic device includes one or more processors (CPU), a memory, and a bus. The electronic device may also include an input / output interface, a network interface, and the like.

[0179] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.

[0180] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.

[0181] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0182] It is understandable that before using the technical solutions disclosed in the embodiments of the present disclosure, the types, scope of use, usage scenarios, etc. of the personal information involved in the present disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.

[0183] In the description of the present invention, it should be understood that the terms "up", "down", "front", "back", "left" and "right" etc. indicating directions or positional relationships are based on the directions or positional relationships shown in the accompanying drawings. They are only for the convenience of describing the present invention and simplifying the description. They do not indicate or imply that the positions or elements referred to must have specific directions, be constructed and operate in specific directions. Therefore, they should not be understood as limitations of the present invention.

[0184] It should be noted that, in this article, relational terms such as first and second, etc. 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. It should also be noted that the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity 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, commodity or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.

[0185] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, systems or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0186] The above are only embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent substitution, improvement, etc. made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims

1. A singleton object loading method, characterized in that: include: In the case where the terminal device starts the target application, asynchronously load the page routing configuration table of the target application, wherein the page routing configuration table includes page singleton object information of the target application, and the page singleton object information includes page routing definition information of each page in the target application, at least one page singleton service information having a mapping relationship with the page routing definition information, and a business function enabling status corresponding to the page singleton service information; When the target page of the target application is opened, querying the page routing configuration table to see whether there is target page routing definition information of the target page, and if so, confirming the singleton service information of each target page that has a mapping relationship with the target page routing definition information; For the target page singleton service information whose business function enablement status is enabled, a query is made in the preset object pool whether there is a target page singleton object corresponding to the target page singleton service information. If so, the target page singleton object is loaded, wherein the preset object pool stores multiple configured singleton objects.

2. The method according to claim 1, characterized in that Also includes: When it is found that there is no target page singleton object corresponding to the target page singleton service information in the preset object pool, creating the target page singleton object by using the target page singleton service information; After the target page singleton object is created, the target page singleton object is loaded and added to the preset object pool.

3. The method according to claim 1, characterized in that Before asynchronously loading the page routing configuration table of the target application, the method further includes: Obtaining the page routing definition information of each page in the target application; Respectively constructing a mapping relationship between each of the page routing definition information and at least one of the page singleton service information, and setting an enabled state of a business function corresponding to the page singleton service information, so as to generate the page singleton object information of the target application; The page routing configuration table of the target application is created by at least using the page singleton object information.

4. The method according to claim 3, characterized in that Also includes: Set the singleton object destruction attribute corresponding to the page singleton service information; When exiting the target page, the target page singleton object whose singleton object destruction attribute is destroyed is destroyed.

5. The method according to claim 3, characterized in that: Before asynchronously loading the page routing configuration table of the target application, the method further includes: Obtaining at least one global singleton service information of the target application; respectively setting the business function activation status corresponding to each of the global singleton service information to generate the global singleton object information of the target application; The step of creating the page routing configuration table of the target application by at least using the page singleton object information includes: The page routing configuration table of the target application is constructed using the page singleton object information and the global singleton object information.

6. The method according to claim 5, characterized in that Also includes: When the target page of the target application is opened, obtaining each piece of the global singleton service information in the global singleton object information in the page routing configuration table; For the global singleton service information whose business function activation status is enabled, the preset object pool is queried whether there is a target global singleton object corresponding to the global singleton service information. If so, the target global singleton object is loaded; if not, the target global singleton object is created using the global singleton service information, and the target global singleton object is added to the preset object pool.

7. The method according to claim 1, characterized in that The page routing definition information includes the page path and page class name of the page of the target application. When the target page of the target application is opened, querying the page routing configuration table to see whether the target page routing definition information of the target page exists includes: In the case where the user accesses the target page of the target application through the routing mechanism, the page path of the target page is obtained; the page path is used as a query condition to query whether there is the page routing definition information matching the page path in the page routing configuration table, and if so, the page routing definition information is confirmed as the target page routing definition information of the target page; In the case that the target page visited by the user is a hard-coded page, the page class name of the target page is obtained; the page class name is used as a query condition, and the page routing configuration table is queried to see whether there is page routing definition information that matches the page class name; if so, the page routing definition information is confirmed as the target page routing definition information of the target page.

8. A singleton object loading device, characterized in that: include: Page routing configuration table loading unit, page routing definition information query unit, page singleton service information confirmation unit, page singleton object query unit and page singleton object loading unit, The page routing configuration table loading unit is used to asynchronously load the page routing configuration table of the target application when the terminal device starts the target application, wherein the page routing configuration table includes page singleton object information of the target application, and the page singleton object information includes page routing definition information of each page in the target application, at least one page singleton service information having a mapping relationship with the page routing definition information, and a business function enabling state corresponding to the page singleton service information; The page routing definition information query unit is used to query whether the target page routing definition information of the target page exists in the page routing configuration table when the target page of the target application is opened, and if yes, trigger the page singleton service information confirmation unit; The page singleton service information confirmation unit is used to confirm each target page singleton service information that has a mapping relationship with the target page routing definition information; The page singleton object query unit is used to query whether there is a target page singleton service information corresponding to the target page singleton service information in a preset object pool for the target page singleton service information whose business function activation status is enabled, and if yes, trigger the page singleton object loading unit; The page singleton object loading unit is used to load the target page singleton object; Wherein, the preset object pool stores a plurality of configured singleton objects.

9. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the singleton object loading method according to any one of claims 1 to 7 is implemented.

10. An electronic device, characterized in that: The electronic device includes at least one processor, and at least one memory and a bus connected to the processor; wherein the processor and the memory communicate with each other through the bus; the processor is used to call program instructions in the memory to execute the singleton object loading method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method of persistently loading page

    CN107679108A

  • Single-example object creation method, system and device

    CN109284094A

  • Data processing method and device and electronic equipment

    CN110619185A

  • Load balancing service state visualization system

    CN114153691A

  • Page caching method and device, equipment and storage medium

    CN117492855A

Cited By

  • Database connection method and device, computer equipment, medium and program product

    CN121509020A