WO2023179183A1 - 子程序同步处理 - Google Patents

子程序同步处理 Download PDF

Info

Publication number
WO2023179183A1
WO2023179183A1 PCT/CN2023/071370 CN2023071370W WO2023179183A1 WO 2023179183 A1 WO2023179183 A1 WO 2023179183A1 CN 2023071370 W CN2023071370 W CN 2023071370W WO 2023179183 A1 WO2023179183 A1 WO 2023179183A1
Authority
WO
WIPO (PCT)
Prior art keywords
local
subprogram
event
page
subroutine
Prior art date
Application number
PCT/CN2023/071370
Other languages
English (en)
French (fr)
Inventor
李军
翟一帆
齐普
杨祥
杨昌俊
潘云逸
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2023179183A1 publication Critical patent/WO2023179183A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores

Definitions

  • This document relates to the field of data processing technology, especially methods and devices for subroutine synchronization processing.
  • Duanyun Mini Program is an application mode that renders mini programs in the cloud and displays mini program pages on terminal devices. It includes cloud mini programs and local mini programs, so that mini programs are no longer limited by the hardware configuration of the terminal device. Provide users with a better performance experience. However, this model also divides the working process of the mini program into two parts: local and cloud, running in the local terminal device and the cloud virtual system respectively.
  • One or more embodiments of this specification provide a subprogram synchronization processing method, which is applied to a remote server, including: obtaining the triggering event of the local subprogram of the terminal device; detecting the local subprogram and the corresponding remote subprogram in the program container.
  • the collaborative state the program container is installed on the virtual machine deployed by the remote server; if the collaborative state is an interactive synchronization state, the trigger event is parsed to obtain the event type of the trigger event; based on the program container Execute the event response action corresponding to the event type, and synchronize the subroutine page obtained after the action is executed to the terminal device.
  • Embodiments of this specification provide another subprogram synchronization processing method, applied to terminal equipment, including: detecting trigger events of local subprograms, and uploading the trigger events to a remote server; receiving subprogram pages synchronized by the remote server , the subroutine page is obtained after executing an event response action corresponding to the event type of the triggering event based on the program container; performing page update processing for the local subroutine according to the subroutine page.
  • the program container is installed in a virtual machine deployed by the remote server.
  • the embodiment of this specification provides a subprogram synchronization processing device, running on a remote server, including: a trigger event acquisition module configured to obtain the trigger event of the local subprogram of the terminal device; a collaborative status detection module configured to detect the The collaboration state of the local subprogram and the corresponding remote subprogram in the program container.
  • the program container is installed in the virtual machine deployed by the remote server.
  • the event type parsing module is run, and the event The type parsing module is configured to parse the trigger event to obtain the event type of the trigger event; the event response action execution module is configured to execute the event response action corresponding to the event type based on the program container, and add the action The subroutine page obtained after execution is synchronized to the terminal device.
  • One or more embodiments of this specification provide another subprogram synchronization processing device, running on a terminal device, including: a trigger event detection module configured to detect trigger events of local subprograms and report the trigger events to a remote server. Upload; the subprogram page receiving module is configured to receive the subprogram page synchronized by the remote server; the subprogram page is obtained after executing the event response action corresponding to the event type of the trigger event based on the program container; page update processing A module configured to perform page update processing for the local subroutine according to the subroutine page.
  • the program container is installed in a virtual machine deployed by the remote server.
  • One or more embodiments of this specification provide a subprogram synchronization processing device, including a processor and a memory configured to store computer-executable instructions.
  • the computer-executable instructions When executed, the computer-executable instructions cause the processor to: obtain a terminal Triggering events of local subprograms of the device; detecting the collaboration state of the local subprogram and the corresponding remote subprogram in the program container, which is installed in a virtual machine deployed on the remote server; if the collaboration state is an interactive synchronization state , parse the trigger event to obtain the event type of the trigger event; execute an event response action corresponding to the event type based on the program container, and synchronize the subroutine page obtained after the action is executed to the terminal device.
  • One or more embodiments of the present specification provide another subprogram synchronization processing device, including a processor and a memory configured to store computer-executable instructions, which when executed cause the processor to: detect trigger events of the local subprogram, and upload the trigger event to the remote server; receive the subprogram page synchronized by the remote server, and the subprogram page executes an event response corresponding to the event type of the trigger event based on the program container Obtained after the action; perform page update processing for the local subroutine according to the subroutine page.
  • the program container is installed in a virtual machine deployed by the remote server.
  • One or more embodiments of this specification provide a storage medium for storing computer-executable instructions.
  • the computer-executable instructions When executed by a processor, the computer-executable instructions implement the following process: obtain the triggering event of the local subroutine of the terminal device; Detect the collaboration status of the local subprogram and the corresponding remote subprogram in the program container.
  • the program container is installed in a virtual machine deployed on the remote server; if the collaboration status is an interactive synchronization status, analyze the trigger event to obtain The event type of the trigger event; execute an event response action corresponding to the event type based on the program container, and synchronize the subroutine page obtained after the action is executed to the terminal device.
  • One or more embodiments of this specification provide another storage medium for storing computer-executable instructions.
  • the computer-executable instructions When executed by the processor, the computer-executable instructions implement the following process: detect the triggering event of the local subroutine, and The trigger event is uploaded to the remote server; a subroutine page synchronized by the remote server is received, and the subroutine page is obtained after the event response action corresponding to the event type of the trigger event is executed based on the program container; according to the subroutine The page performs page update processing for the local subroutine.
  • the program container is installed in a virtual machine deployed by the remote server.
  • Figure 1 is a processing flow chart of a subroutine synchronization processing method provided by the embodiment of this specification
  • Figure 2 is a schematic diagram of a remote subroutine and local subroutine system block diagram provided by the embodiment of this specification;
  • Figure 3 is a processing sequence diagram of a subroutine synchronization processing method applied to interactive synchronization scenarios provided by the embodiment of this specification;
  • Figure 4 is a processing sequence diagram of a subroutine synchronization processing method applied to a startup synchronization scenario provided by an embodiment of this specification;
  • Figure 5 is a processing flow chart of a subroutine synchronization processing method applied to local exit scenarios provided by the embodiment of this specification;
  • Figure 6 is a processing flow chart of another subroutine synchronization processing method provided by the embodiment of this specification.
  • Figure 7 is a schematic diagram of a subroutine synchronization processing device provided by an embodiment of this specification.
  • Figure 8 is a schematic diagram of another subprogram synchronization processing device provided by the embodiment of this specification.
  • Figure 9 is a schematic structural diagram of a subroutine synchronization processing device provided by an embodiment of this specification.
  • Figure 10 is a schematic structural diagram of another subroutine synchronization processing device provided by an embodiment of this specification.
  • FIG. 1 An embodiment of a subroutine synchronization processing method provided in this specification: Referring to Figure 1, the subroutine synchronization processing method provided by this embodiment is applied to a remote server and specifically includes steps S102 to S108.
  • Step S102 Obtain the trigger event of the local subroutine of the terminal device.
  • the Duanyun applet renders the applet page in the cloud, displays the application mode of the applet page on the terminal device, and divides the working process of the applet into two parts: local and cloud, which run on the terminal device and cloud virtualization respectively.
  • the page synchronization mechanism is not established for the end-cloud applet, it may cause the page of the local applet and the cloud applet to be out of sync, degrading the user experience.
  • the subroutine synchronization processing method provided in this embodiment establishes a page synchronization mechanism between the remote subroutine and the local subroutine by cooperating with the terminal device. Specifically, the trigger event of the local subroutine of the terminal device is obtained. , and detect the collaboration state of the local subprogram and the corresponding remote subprogram in the program container. If the collaboration state is the interactive synchronization state, determine and execute the corresponding event response action based on the event type of the trigger event obtained by parsing the trigger event.
  • the subprogram described in this embodiment refers to a program function module or application component installed on a terminal device or a remote server, or a program function module or application component loaded and installed by a terminal device or a remote server, such as an applet.
  • the subroutines have the ability to independently provide self-closed-loop services, such as subroutines with self-closed-loop capabilities for service reservation and subscription message push.
  • the local subroutine refers to a program function module or application component installed on the terminal device, or a program function module or application component loaded and installed by the terminal device, such as a local applet.
  • the remote server includes a cloud server.
  • the terminal equipment is configured with a display screen, including but not limited to at least one of the following: user terminals, vehicle terminals installed on vehicles, IoT (Internet of Things) devices external to vehicles, smart speakers, unmanned vending machines, and interactive advertisements screens, POS (Point of sale) devices, as well as smart home appliances such as smart TVs and smart refrigerators, as well as smart wearable products.
  • the triggering event includes at least one of the following: a startup request event, an interaction event, and an exit event; optionally, the triggering event includes an interaction event intercepted and uploaded by the terminal device; when the terminal device detects a user After triggering the interaction event submitted by the interaction interface configured by the local subprogram, the interaction event is intercepted.
  • the startup request event refers to an event submitted by the terminal device to the remote server for the startup of the local subprogram and the display of the accessed page;
  • the interactive event refers to the event submitted by the user triggering a certain control in the local subprogram.
  • Events such as interactive events generated after the user inputs information through the interactive interface configured on the currently visited page of the local subprogram or page jump events generated after the user triggers the interactive interface configured on the currently visited page of the local subprogram;
  • the exit event Including abnormal exit events of local subprograms, such as crash events of local subprograms.
  • the remote server and the terminal device cooperate to implement subroutine synchronization processing.
  • the subroutines are divided into local subroutines and remote subroutines.
  • Page rendering is performed in the remote subroutine, and the rendered page is rendered in the local subroutine. It shows that the local subroutine runs on the operating system of the terminal device.
  • the page access of the local subroutine is through the access interface configured by the operating system, such as the access interface configured by the operating system of the IoT terminal.
  • the page access of the local subroutine can also be accessed through the access interface configured by the operating system of the IoT terminal.
  • the access interface for remote and local interaction is carried out.
  • the page access of the local subroutine can also be carried out through the access interface in the application program equipped with the local subroutine or the access interface in the local subapplication program; the remote server is deployed with many virtual machines (virtual machines).
  • System the program container runs in the virtual machine of the remote server.
  • the program container has a detection service.
  • the detection service is used to detect the exit and running status of the local subprogram and the remote subprogram to prevent the exit status of the local subprogram and the remote subprogram from being inconsistent.
  • the exit status of the local subprogram and the remote subprogram are synchronized. Multiple subprograms can be run in the program container, or only one subprogram can be run.
  • the remote server is a cloud server.
  • a customized transmission control protocol is used between the cloud server and the terminal device for event or data communication.
  • the local subroutine runs on the operating system of the terminal device.
  • the cloud server is deployed with many virtual systems. , the number is variable.
  • the program container runs in the virtual system of the remote server.
  • the program container has a detection service. The detection service is used to detect the exit and running status of local subprograms and remote subprograms. Multiple subprograms can be run in the program container, or only Run 1 subroutine.
  • the triggering event of the local subroutine of the terminal device is obtained. Before that, the terminal device detects the triggering event of the local subroutine and uploads the triggering event to the remote server.
  • the interactive event submitted by the user to trigger the interactive interface configured by the local subprogram is obtained; the interactive event is intercepted and sent to the remote server Upload.
  • Step S104 Detect the coordination status of the local subprogram and the corresponding remote subprogram in the program container.
  • the program container is installed in a virtual machine deployed by the remote server; it should be noted that the virtual machine here includes a single virtual machine deployed by the remote server or a virtual machine group deployed by the remote server.
  • the program container described in this embodiment refers to a running framework or running engine provided for the remote server.
  • the remote subprogram can be run in the program container.
  • the remote subroutine in this embodiment is mounted on the program container running in the virtual machine of the remote server.
  • the remote subroutine refers to the program function module or application component installed on the remote server, or the program function module or application component loaded and installed by the remote server, such as a cloud applet.
  • the collaborative state refers to the state in which the local subroutine and the remote subroutine cooperate to render the page.
  • the terminal device uploads the trigger event to the remote server, and renders the access page in the remote subroutine based on the interaction event to synchronize the display status of the terminal device in the local subroutine.
  • the collaborative state includes interactive synchronization state, startup synchronization state and local exit state.
  • the interaction synchronization state is the coordination state corresponding to the interaction event of the local subprogram
  • the startup synchronization state is the coordination state corresponding to the startup request event of the local subprogram
  • the local exit status is the coordination state corresponding to the exit event of the local subprogram.
  • this step detects the coordination status of the local subprogram and the corresponding remote subprogram in the program container to respond to the triggering event of the local subprogram according to the coordination status.
  • the detected collaboration states between local subprograms and remote subprograms include three types, namely interactive synchronization state, startup synchronization state, and local exit state. The following are the responses to trigger events in these three collaborative states. The process is explained in detail.
  • steps S106 and S108 for the detailed description of the response process to the trigger event in the interactive synchronization state.
  • step S108 for the specific description of the response process to the trigger event in the startup synchronization state and the local exit state.
  • Step S106 If the collaborative state is an interactive synchronization state, parse the trigger event to obtain the event type of the trigger event.
  • the detected collaboration state is an interactive collaboration state
  • the trigger event is parsed to obtain the event type of the trigger event to determine the event type corresponding to the event type. Event response actions and execution.
  • the detected collaboration status between the local subprogram and the remote subprogram includes three types, namely interactive synchronization status, startup synchronization status, and local exit status. If the collaboration status is the interactive synchronization status, the trigger event is parsed to obtain the trigger. For the event type of the event, you can specifically use the event parsing model to input the triggering event into the event parsing model for event type parsing, and obtain the event type corresponding to the triggering event output by the event parsing model.
  • the event types obtained by parsing in this embodiment include interaction event types, rollback event types and/or exit event types; for example, the interaction event is when the user triggers an interactive control configured by a local subroutine to input interactive information or the user triggers a local subroutine.
  • a service in the request jumps to the service page of the service or the user triggers an interactive control configured in the local subroutine to request the display of pop-up box information.
  • the rollback event triggers the rollback control for the user
  • the exit event triggers the exit control for the user.
  • Step S108 Execute an event response action corresponding to the event type based on the program container, and synchronize the subprogram page obtained after the action is executed to the terminal device.
  • the event response actions described in this embodiment refer to actions to be performed in response to a triggering event.
  • the trigger event is parsed to obtain the event type of the trigger event.
  • this step uses the program container to execute the event response action corresponding to the event type obtained through parsing, and
  • the subroutine page obtained by the action execution is synchronized to the terminal device to display the subroutine page in the local subroutine of the terminal device to ensure that the local subroutine and the remote subroutine page are synchronized.
  • the above-mentioned analysis of the trigger event is used to obtain the event type of the trigger event.
  • Event type is an interactive event type, render the access page in the remote subroutine according to the trigger event; synchronize the rendered access page to the terminal device; if The event type is a rollback event type, and it is judged whether the access page of the local subroutine corresponding to the triggering event has a superior page; if it exists, the superior page is rendered in the remote subroutine according to the triggering event; The rendered upper-level page is synchronized to the terminal device.
  • the terminal device receives the rendered access page synchronized by the remote server and displays the access page in the local subroutine.
  • the access page here refers to the page generated based on the trigger event, such as the user Trigger a service in the local subroutine and jump to the access page of the service.
  • the terminal device receives the superior page of the access page of the local subprogram synchronized by the remote server and rendered in the remote subprogram, and according to the superior page
  • the page updates the access page of the local subprogram, that is, updates the page originally displayed by the local subprogram based on the superior page.
  • the terminal device receives the previous local subprogram of the local subprogram synchronized by the remote server. Access page; update the access page of the local subroutine based on the access page of the previous local subroutine.
  • the terminal device receives the exit command for the local subprogram issued by the remote server and exits the local subprogram. The execution of the subroutine.
  • the access page is rendered in the remote subroutine according to the triggering event; if the event type is a rollback event type, it is determined whether the access page of the local subroutine corresponding to the triggering event has a superior page; if it exists, Render the upper-level page in the remote subroutine according to the trigger event; if it does not exist, determine whether the page stack data is empty; if not, query and read the previous page of the local subroutine according to the program access sequence recorded in the page stack data.
  • the access page of the local subprogram if it is empty, an exit command for the local subprogram is issued to the terminal device, and resources are released for the target virtual machine running the program container.
  • the event response action corresponding to the event type is executed in the following manner:
  • event type is an exit event type
  • the event response action corresponding to the event type can also be executed in the following manner: if the event type is an exit event type, determine whether the page stack data is empty; if not, access according to the program recorded in the page stack data In sequence, query and read the access page of the previous local subroutine of the local subroutine.
  • the local subroutine jumps from the access page of A to the access page of B, and then returns from the access page of B to the access page of A.
  • the page record of the access page of B is deleted from the recorded page stack data to prevent the invalid page data from occupying storage resources. , improve storage resource utilization.
  • the corresponding virtual machine can be assigned to the terminal device, and based on this, the program container can be run and the remote subprogram can be run within the program container, and the remote subprogram can be run in the remote subprogram.
  • Page rendering of the accessed page is performed within the program. Specifically, in an optional implementation provided by this embodiment, the following operations are also performed: If the collaborative state is the startup synchronization state, the terminal device is sent to the virtual machine pool in the virtual machine pool.
  • the terminal device detects the start request event of the local subprogram submitted by the user triggering the access control of the local subprogram, intercepts the start request event and uploads it to the remote server.
  • the local subprogram displays the startup screen, and the startup screen can Contains startup animation.
  • the remote server obtains the startup request event of the local subprogram of the terminal, and requests the remote server to allocate the corresponding target virtual machine through the startup request event; detects the coordination status of the local subprogram and the corresponding remote subprogram in the program container.
  • the corresponding remote subroutine in the program container is empty, that is, it has not been started. In this case, the collaborative state is the started collaborative state.
  • the device identifier of the terminal device is bound to the virtual machine identifier of the target virtual machine; in addition, the account identifier of the local subroutine and the terminal device can also be bound.
  • the device ID of the target virtual machine is bound to the virtual machine ID of the target virtual machine; when the local subroutine is equipped with a host application running on the terminal device, the account ID of the host application and/or the device ID of the terminal device and the target virtual machine can be bound. Bind the virtual machine ID of the machine.
  • the remote server deploys a certain number of virtual machines.
  • the virtual machine pool refers to a virtual machine pool composed of virtual machines corresponding to virtual machine IDs that are not bound to the device ID of the terminal device, that is, idle and unused virtual machines.
  • the virtual machine corresponding to the virtual machine identifier only provides services to the terminal device corresponding to the device identifier; the virtual machine includes Virtual system; the access page refers to the first page displayed after starting the local subroutine.
  • the collaborative state can also be a local exit state, that is, the exit status of the local subroutine is detected.
  • the following operations are also performed: if the collaborative state is a local exit state, exit the running of the remote subroutine in the program container, and release resources for the target virtual machine running the program container; wherein, the program The detection service of the container delivers detection messages to the terminal device according to a preset time period, and determines that the collaborative state is a local exit state when detecting that the number of unresponsive detection messages from the local subroutine exceeds the preset number.
  • the detection service of the program container is based on the preset Set a time period (such as 1ms) to send detection messages to the terminal device to determine whether the local subprogram exits the operation based on whether the local subprogram responds to the detection message.
  • a time period such as 1ms
  • collaboration status is the local exit status, it means that the local subprogram has exited.
  • the virtual machine resources of the remote server are not released, causing resource waste, and even other users cannot request allocation from the remote server.
  • Virtual machine resources exit the running of the remote subroutine in the program container, and release resources for the target virtual machine running the program container to improve resource utilization.
  • the user inputs the exit event through gesture exit, and the remote subprogram exits.
  • the local subprogram may not exit, the local subprogram displays a black screen, or the remote subprogram exits abnormally (such as crashing). Synchronize the exit message to the local subprogram, and the local subprogram displays a black screen, which reduces the user experience.
  • this embodiment provides an optional implementation method.
  • the detection service of the program container detects the exit event of the remote subprogram and promptly reports it to the local subprogram.
  • the terminal device synchronizes the exit instructions for the local subprogram.
  • the specific implementation process is: detect the exit event of the remote subprogram based on the detection service of the program container; if the exit event is an abnormal exit event, notify the terminal device Synchronize the exit instructions for the local subprogram to exit the running of the local subprogram; close the program container, and release resources for the target virtual machine allocated to the terminal device.
  • the detection service of the program container detects the exit event of the remote subprogram, which means that the remote subprogram exits. If the exit event is a normal exit event, it means that when the local subprogram exits, the remote subprogram also exits.
  • the exit event of the program is a normal exit event, and no processing is required at this time; if the exit event is an abnormal exit event, it means that the remote subprogram has exited without the local subprogram exiting, and it is an abnormal exit. At this time, it reports to the terminal device Synchronize the exit instructions for the local subprogram.
  • the terminal device exits the running of the local subprogram, synchronizes the exit status of the local subprogram and the remote subprogram, closes the program container, and releases the target virtual machine resources in a timely manner to improve the cloud server Resource utilization for virtual machines.
  • the subprogram synchronization processing method first obtains the trigger event of the local subprogram of the terminal device, detects the collaboration status of the local subprogram and the corresponding remote subprogram in the program container, and secondly, if the collaboration status is In the interactive synchronization state, parse the trigger event to obtain the event type of the trigger event; if the event type is the interactive event type, render the access page in the remote subroutine according to the trigger event; synchronize the rendered access page to the terminal device; if the event type For the rollback event type, determine whether the access page of the local subroutine corresponding to the trigger event has a superior page; if it exists, render the superior page in the remote subroutine according to the trigger event, and synchronize the rendered superior page to the terminal device.
  • Exit instructions and release resources for the target virtual machine running the program container if the event type is an exit event type, synchronize the exit notification for the local subprogram to the detection service of the program container to record the exit status of the local subprogram and determine Whether the page stack data is empty; if not, according to the program access sequence recorded in the page stack data, query and read the access page of the previous local subroutine of the local subroutine, and read the previous local subroutine
  • the access page is synchronized to the terminal device.
  • the exit command for the local subroutine is issued to the terminal device, and the resources are released for the target virtual machine running the program container; again, if the collaboration state is the startup synchronization state, in the virtual Allocate the corresponding target virtual machine to the terminal device in the machine pool and perform binding processing; start the target virtual machine after the binding is completed, and start the program container based on the target virtual machine; run the remote subroutine in the program container, and target the target virtual machine based on the program container.
  • the remote subroutine renders the page to obtain the access page; synchronizes the access page to the terminal device for display in the local subroutine; if the collaboration status is the local exit status, exit the running of the remote subroutine in the program container, and target the running program container
  • the target virtual machine performs resource release; among them, the detection service of the program container sends detection messages to the terminal device according to a preset time period, and determines the collaboration state when it detects that the number of detection messages that the local subprogram has not responded to exceeds the preset number. Is the local exit status.
  • the detection service based on the program container detects the exit event of the remote subprogram; if the exit event is an abnormal exit event, synchronize the exit command for the local subprogram to the terminal device to exit the running of the local subprogram; close the program container, and respond to the The target virtual machine allocated by the terminal device releases resources.
  • the display page of the local subprogram is synchronized with the display page of the remote subprogram, thereby improving the user experience.
  • Step S304 Detect the collaboration status of the local subprogram and the corresponding cloud subprogram in the program container.
  • the program container is installed on a virtual machine deployed on a cloud server.
  • Step S306 If the collaboration state is the interactive synchronization state, analyze the interactive event to obtain the event type of the interactive event.
  • Step S308 if the event type is a rollback event type, determine whether the access page of the local subprogram corresponding to the interaction event has a superior page based on the program container; if it exists, render the superior page in the cloud subprogram based on the program container and the interaction event. And synchronize the rendered upper-level page to the terminal device; if it does not exist, execute step S310 to step S312.
  • the event type is an exit event type
  • the virtual machine releases resources.
  • the access page is rendered in the remote subroutine based on the interactive event.
  • Step S310 Synchronize the exit notification for the local subprogram to the detection service of the program container to record the exit status of the local subprogram.
  • Step S312 determine whether the page stack data is empty; if not, execute steps S314 to step S316;
  • Step S314 According to the program access sequence recorded in the page stack data, query and read the access page of the previous local subprogram of the local subprogram.
  • Step S316 Synchronize the read access page of the previous local subprogram of the local subprogram to the terminal device.
  • Step S322 Issue an exit instruction for the local subprogram to the terminal device, and release resources for the target virtual machine running the program container.
  • subroutine synchronization processing method provided in this embodiment in the startup synchronization scenario as an example to further explain the subroutine synchronization processing method provided in this embodiment.
  • the processing method specifically includes the following steps.
  • Step S404 Detect the collaboration status of the local subprogram and the corresponding cloud subprogram in the program container.
  • the program container is installed on a virtual machine deployed on a cloud server.
  • Step S406 Allocate the corresponding target virtual machine to the terminal device in the virtual machine pool and perform binding processing.
  • Step S408 After the binding is completed, start the target virtual machine, and start the program container based on the target virtual machine.
  • Step S410 Run the cloud subprogram in the program container, and perform page rendering for the cloud subprogram based on the program container to obtain the access page.
  • Step S412 Synchronize the access page to the terminal device for display in the local subroutine.
  • Step S502 The detection service based on the program container delivers detection messages to the terminal device according to a preset time period.
  • Step S504 After detecting that the number of detection messages for which the local subroutine has not responded exceeds a preset number, the collaborative state is determined to be the local exit state.
  • Step S506 Exit the running of the cloud subprogram in the program container.
  • Step S508 Release resources for the target virtual machine running the program container.
  • the implementation process of the subroutine synchronization processing method for the interactive synchronization scenario and the startup synchronization scenario provided above is executed by the remote server.
  • the following method embodiment provides the implementation process of the subroutine synchronization processing method for the interactive synchronization scenario and the startup synchronization scenario. , executed by the terminal device, and the two cooperate with each other during the execution process. Therefore, to read the above implementation process, please refer to the corresponding content of the following method embodiments.
  • This specification provides another embodiment of a subprogram synchronization processing method:
  • a subprogram synchronization processing method is provided, which is applied to a remote server.
  • this embodiment also provides a subprogram synchronization processing method.
  • the synchronization processing method is applied to terminal equipment and will be described below with reference to the accompanying drawings.
  • the subroutine synchronization processing method provided by this embodiment is applied to a terminal device and specifically includes steps S602 to S606.
  • Step S602 Detect the triggering event of the local subroutine, and upload the triggering event to the remote server.
  • the subprogram synchronization processing method provided by this embodiment cooperates with the remote server to detect the triggering events of the local subprogram, and uploads the detected triggering events to the remote server to render the page on the remote server and display the received
  • the subprogram page synchronized by the remote server introduces the page synchronization mechanism between the local subprogram and the remote subprogram to ensure that the access page displayed by the local subprogram is synchronized with the access page displayed by the remote subprogram, improving the user experience.
  • the subprogram described in this embodiment refers to a program function module or application component installed on a terminal device or a remote server, or a program function module or application component loaded and installed by a terminal device or a remote server, such as an applet.
  • the subroutines have the ability to independently provide self-closed-loop services, such as subroutines with self-closed-loop capabilities for service reservation and subscription message push.
  • the local subroutine refers to a program function module or application component installed on the terminal device, or a program function module or application component loaded and installed by the terminal device, such as a local applet.
  • the remote server includes a cloud server.
  • the terminal equipment is configured with a display screen, including but not limited to at least one of the following: user terminals, vehicle terminals installed on vehicles, IoT (Internet of Things) devices external to vehicles, smart speakers, unmanned vending machines, and interactive advertisements screens, POS (Point of sale) devices, as well as smart home appliances such as smart TVs and smart refrigerators, as well as smart wearable products.
  • the triggering event includes at least one of the following: startup request event, interaction event, exit event; specifically, the triggering event includes an interaction event intercepted and uploaded by the terminal device; the terminal device detects that the user triggers the local subroutine configuration After the interaction event is submitted by the interaction interface, the interaction event is intercepted.
  • the startup request event refers to an event submitted by the terminal device to the remote server for the startup of the local subprogram and the display of the accessed page;
  • the interactive event refers to the event submitted by the user triggering a certain control in the local subprogram.
  • Events such as interactive events generated after the user inputs information through the interactive interface configured on the currently visited page of the local subprogram or page jump events generated after the user triggers the interactive interface configured on the currently visited page of the local subprogram;
  • the exit event Including abnormal exit events of local subprograms, such as crash events of local subprograms.
  • the remote server and the terminal device cooperate to implement subroutine synchronization processing.
  • the subroutines are divided into local subroutines and remote subroutines.
  • Page rendering is performed in the remote subroutine, and the rendered page is rendered in the local subroutine. It shows that the local subroutine runs on the operating system of the terminal device.
  • the page access of the local subroutine is through the access interface configured by the operating system, such as the access interface configured by the operating system of the IoT terminal.
  • the page access of the local subroutine can also be accessed through the access interface configured by the operating system of the IoT terminal.
  • the access interface for remote and local interaction is carried out.
  • the page access of the local subroutine can also be carried out through the access interface in the application program equipped with the local subroutine or the access interface in the local subapplication program; the remote server is deployed with many virtual machines (virtual machines).
  • System the program container runs in the virtual machine of the remote server.
  • the program container has a detection service.
  • the detection service is used to detect the exit and running status of the local subprogram and the remote subprogram to prevent the exit status of the local subprogram and the remote subprogram from being inconsistent.
  • the exit status of the local subprogram and the remote subprogram are synchronized. Multiple subprograms can be run in the program container, or only one subprogram can be run.
  • the program container is installed in a virtual machine deployed by a remote server; it should be noted that the virtual machine here includes a single virtual machine deployed by the remote server or a virtual machine group deployed by the remote server.
  • the program container refers to a running framework or running engine provided for the remote server. By installing the program container on the virtual machine deployed on the remote server, the remote subprogram can be run in the program container.
  • the remote subroutine in this embodiment is mounted on the program container running in the virtual machine of the remote server.
  • the remote subroutine refers to the program function module or application component installed on the remote server, or the program function module or application component loaded and installed by the remote server, such as a cloud applet.
  • the remote server is a cloud server.
  • a customized transmission control protocol is used between the cloud server and the terminal device for event or data communication.
  • the local subroutine runs on the operating system of the terminal device.
  • the cloud server is deployed with many virtual systems. , the number is variable.
  • the program container runs in the virtual system of the remote server.
  • the program container has a detection service. The detection service is used to detect the exit and running status of local subprograms and remote subprograms. Multiple subprograms can be run in the program container, or only Run 1 subroutine.
  • the triggering event of the local subroutine is detected, and the detected triggering event is uploaded to the remote server to respond to the event on the remote server.
  • the remote server obtains the triggering event of the local subroutine of the terminal device.
  • users can input interaction events through the interface configured by the local subprogram.
  • the local subprogram does not respond to the interaction event, but intercepts the interaction event and uploads it to the remote server to perform the interaction on the remote server. Response to events.
  • the specific implementation process of detecting the triggering event of the local subprogram and sending the triggering event to the remote server is as follows: Obtaining the interactive interface submitted by the user to trigger the configuration of the local subprogram. Interactive events: intercept the interactive events and upload them to the remote server.
  • the remote server After the remote server obtains the trigger event of the local subprogram, the remote server detects the collaboration state of the local subprogram and the corresponding remote subprogram in the program container; the collaboration state refers to the cooperation between the local subprogram and the remote subprogram for page rendering. state.
  • the terminal device uploads the trigger event to the remote server, and renders the access page in the remote subroutine based on the interaction event to synchronize the status of the terminal device displayed in the local subroutine.
  • the collaborative state includes interactive synchronization state, startup synchronization state and local exit state.
  • the interaction synchronization state is the coordination state corresponding to the interaction event of the local subprogram
  • the startup synchronization state is the coordination state corresponding to the startup request event of the local subprogram
  • the local exit status is the coordination state corresponding to the exit event of the local subprogram.
  • the detected collaboration states between local subprograms and remote subprograms include three types, namely interactive synchronization state, startup synchronization state, and local exit state. The following are the responses to trigger events in these three collaborative states. The process is explained in detail.
  • the collaborative state is the interactive synchronization state
  • the trigger event is parsed to obtain the event type of the trigger event, and the event response action corresponding to the event type is executed based on the program container.
  • the event parsing model can be used to input the triggering event into the event parsing model for event type parsing. , obtain the event type corresponding to the trigger event output by the event parsing model.
  • the event types include interactive event types, rollback event types and/or exit event types; for example, the interactive event is when the user triggers an interactive control configured in the local subroutine to input interactive information or the user triggers an interactive control in the local subroutine.
  • a service request jumps to the service page of the service or the user triggers an interactive control configured in a local subroutine to request the display of pop-up box information.
  • the rollback event triggers the rollback control for the user
  • the exit event triggers the exit control for the user.
  • the remote server executes the event response action corresponding to the event type based on the program container, and synchronizes the subroutine page obtained after the action is executed to the terminal device to
  • the subprogram page is displayed in the local subprogram of the terminal device to ensure that the local subprogram and the remote subprogram page are synchronized.
  • the subprogram page of the remote subprogram is rendered and synchronized to the terminal device. , to improve the performance and aesthetics of local subprograms and further enhance the user experience.
  • the above-mentioned analysis of the trigger event is performed to obtain the event type of the trigger event.
  • the remote server executes the event response action corresponding to the event type in the following manner: if the event type is an interactive event type, renders the access page in the remote subroutine according to the trigger event; synchronizes the rendered access page to the terminal device ; If the event type is a rollback event type, determine whether the access page of the local subroutine corresponding to the trigger event has a superior page; if so, render the superior page in the remote subroutine according to the trigger event ;Synchronize the rendered upper-level page to the terminal device.
  • the remote server will synchronize the exit notification for the local subprogram to the detection service of the program container to record the exit status of the local subprogram and determine the page Whether the stack data is empty; if not, query and read the access page of the previous local subroutine of the local subroutine according to the program access sequence recorded in the page stack data; synchronize the read access page to the terminal device; If it is empty, issue an exit instruction for the local subroutine to the terminal device, and release resources for the target virtual machine running the program container.
  • the remote server renders the access page in the remote subroutine based on the trigger event based on the program container; if the event type is a rollback event type, it determines whether the access page of the local subroutine corresponding to the trigger event has a superior page; if it exists, render the upper-level page in the remote subroutine according to the trigger event; if it does not exist, determine whether the page stack data is empty; if not, query and read the local page according to the program access sequence recorded in the page stack data The access page of the previous local subprogram of the subprogram; if it is empty, an exit command for the local subprogram is issued to the terminal device, and resources are released for the target virtual machine running the program container.
  • the remote server passes Execute the event response action corresponding to the event type in the following manner: if the event type is an exit event type, synchronize the exit notification for the local subprogram to the detection service of the program container to record the exit status of the local subprogram , and determine whether the page stack data is empty; if not, query and read the access page of the previous local subprogram of the local subprogram according to the program access sequence recorded in the page stack data.
  • the remote server can also perform event response actions corresponding to the event type in the following ways: if the event type is an exit event type, determine whether the page stack data is empty; if not, based on the program access sequence recorded in the page stack data, Query and read the access page of the previous local subroutine of the local subroutine.
  • the remote server performs the following operations: if the page stack data is empty, issues an exit instruction for the local subroutine to the terminal device, and performs resource processing for the target virtual machine running the program container. freed.
  • the remote server provides a specific implementation process for executing event response actions corresponding to the three event types, and issues an exit command for the local subroutine to the terminal device when the page stack data is empty. , if it is detected that the local subroutine jumps from the first accessed page to the second accessed page, and jumps back from the second accessed page to the first accessed page, delete the page record of the second accessed page in the page stack data.
  • the local subroutine jumps from the access page of A to the access page of B, and then returns from the access page of B to the access page of A.
  • the page record of the access page of B is deleted from the recorded page stack data to prevent the invalid page data from occupying storage resources. , improve storage resource utilization.
  • the collaborative state is the startup synchronization state
  • the remote server allocates the corresponding virtual machine to the terminal device, and on this basis runs the program container and the remote subroutine in the program container, and performs page rendering of the accessed page in the remote subroutine.
  • the remote server also performs the following operations: if the collaboration state is the startup synchronization state, allocate the corresponding target virtual machine to the terminal device in the virtual machine pool and perform binding processing; after the binding is completed, start all Describe the target virtual machine, and start the program container based on the target virtual machine; run the remote subprogram in the program container, render the page for the remote subprogram based on the program container to obtain the access page; synchronize the access page to the terminal device to access the page in the local subprogram Make a presentation.
  • the terminal device detects the start request event of the local subprogram submitted by the user triggering the access control of the local subprogram, intercepts the start request event and uploads it to the remote server.
  • the local subprogram displays the startup screen, and the startup screen can Contains startup animation.
  • the remote server obtains the startup request event of the local subprogram of the terminal, and requests the remote server to allocate the corresponding target virtual machine through the startup request event; detects the coordination status of the local subprogram and the corresponding remote subprogram in the program container.
  • the corresponding remote subroutine in the program container is empty, that is, it has not been started. In this case, the collaborative state is the started collaborative state.
  • the remote server binds the device ID of the terminal device to the virtual machine ID of the target virtual machine; in addition, the account ID of the local subroutine and the device ID of the terminal device can also be bound to the target virtual machine. Bind the virtual machine ID of the machine; you can also bind the account ID of the host application and/or the device ID of the terminal device to the virtual machine ID of the target virtual machine when the local subroutine is equipped with a host application running on the terminal device. Binding.
  • the remote server deploys a certain number of virtual machines.
  • the virtual machine pool refers to a virtual machine pool composed of virtual machines corresponding to virtual machine IDs that are not bound to the device ID of the terminal device, that is, idle and unused virtual machines.
  • the virtual machine corresponding to the virtual machine identifier only provides services to the terminal device corresponding to the device identifier; the virtual machine includes Virtual system; the access page refers to the first page displayed after starting the local subroutine.
  • the collaborative state is the startup synchronization state
  • the collaborative state can also be a local exit state, that is, when the local subprogram exits
  • the remote server also performs the following operations: If the collaborative state is a local exit state, in the program container Exit the running of the remote subprogram within the program container, and release resources for the target virtual machine running the program container; among them, the detection service of the program container sends detection messages to the terminal device according to the preset time period, and detects that the local subprogram is not responding. The number of detection messages exceeds the preset number, and the collaborative status is determined to be the local exit status.
  • the remote server when the local subprogram exits, the remote server promptly releases the virtual machine resources and improves the resource utilization of the remote server.
  • the remote server provides detection services based on the program container. Send detection messages to the terminal device according to a preset time period (such as 1ms) to determine whether the local subprogram exits the operation based on whether the local subprogram responds to the detection message. When it is detected that the number of detection messages that the local subprogram has not responded to exceeds When the number is preset, the collaboration status is determined to be the local exit status.
  • collaboration status is the local exit status, it means that the local subprogram has exited.
  • the virtual machine resources of the remote server are not released, causing resource waste, and even other users cannot request allocation from the remote server.
  • the remote server exits the running of the remote subroutine in the program container, and releases resources for the target virtual machine running the program container to improve resource utilization.
  • the user inputs the exit event through gesture exit, and the remote subprogram exits.
  • the local subprogram may not exit, the local subprogram displays a black screen, or the remote subprogram exits abnormally (such as crashing). Synchronize the exit message to the local subprogram, and the local subprogram displays a black screen, which reduces the user experience.
  • the remote server detects the exit event of the remote subprogram based on the detection service of the program container, and promptly synchronizes the exit of the local subprogram to the terminal device.
  • the specific implementation process is: the detection service based on the program container detects the exit event of the remote subprogram; if the exit event is an abnormal exit event, synchronizes the exit command for the local subprogram to the terminal device to exit the operation of the local subprogram; close program container, and release resources for the target virtual machine allocated to the terminal device.
  • the detection service of the program container detects the exit event of the remote subprogram, which means that the remote subprogram exits. If the exit event is a normal exit event, it means that when the local subprogram exits, the remote subprogram also exits.
  • the exit event of the program is a normal exit event, and no processing is required at this time; if the exit event is an abnormal exit event, it means that the remote subprogram has exited without the local subprogram exiting, and it is an abnormal exit. At this time, it reports to the terminal device Synchronize the exit instructions for the local subprogram.
  • the terminal device exits the running of the local subprogram, synchronizes the exit status of the local subprogram and the remote subprogram, closes the program container, and releases the target virtual machine resources in a timely manner to improve the cloud server Resource utilization for virtual machines.
  • Step S604 Receive the subroutine page synchronized by the remote server.
  • the subroutine page is obtained after executing an event response action corresponding to the event type of the triggering event based on a program container; the program container is installed in a virtual machine deployed by the remote server.
  • the above detects the triggering event of the local subprogram and uploads the triggering event to the remote server.
  • the remote server executes the event response action corresponding to the event type of the triggering event based on the program container and obtains the subprogram page.
  • this step Subroutine page that receives remote server synchronization.
  • the remote server executes event response actions corresponding to the three event types that trigger the event.
  • the event type is an interactive event type
  • the remote server renders the access page in the remote subroutine according to the trigger event; synchronizes the rendered access page to the terminal device; correspondingly, the terminal device receives the rendered access page synchronized by the remote server.
  • the access page here refers to the page generated based on the trigger event. For example, the user triggers a service in the local subroutine and jumps to Access page for this service.
  • the remote server renders the upper-level page in the remote subroutine according to the triggering event; the rendered upper-level page is synchronized to the terminal device, and the corresponding , the terminal device receives the rendered upper-level page synchronized by the remote server.
  • the remote server issues an exit command for the local subprogram to the terminal device, and for the running The target virtual machine of the program container releases resources.
  • the terminal device receives the exit instruction for the local subprogram issued by the remote server, and exits the operation of the local subprogram based on the exit instruction.
  • the remote server will query and read it according to the program access sequence recorded in the page stack data.
  • the access page of the previous local subroutine of the local subroutine synchronize the read access page to the terminal device; accordingly, the terminal device receives the query synchronized by the remote server and reads the access page of the previous local subroutine of the local subroutine. page.
  • Step S606 Execute page update processing for the local subprogram according to the subprogram page.
  • this step performs page update processing for the local subprogram according to the subprogram page; it should be noted that the page of the local subprogram here can be updated to the local subprogram page.
  • the terminal device performs the process of page update processing for the local subroutine according to the subroutine page. , perform the following operations: update the access page of the local subprogram according to the superior page of the access page of the local subprogram synchronized by the remote server.
  • the access page here updates the page originally displayed by the local subroutine based on the upper-level page.
  • the terminal device executes the local subroutine for the local subroutine according to the subroutine page.
  • the following operation is performed: updating the access page of the local subprogram according to the access page of the previous local subprogram of the local subprogram synchronized by the remote server.
  • the subprogram synchronization processing method first detects the triggering event of the local subprogram and uploads the triggering event to the remote server. Secondly, it receives the subprogram page synchronized by the remote server, and finally executes the subprogram page according to the subprogram page. For the page update processing of local subprograms, the page synchronization mechanism between local subprograms and remote subprograms is introduced to ensure that the display page of the local subprogram is synchronized with the display page of the remote subprogram, thereby improving the user experience.
  • Step S302 Detect interaction events of the local subprogram, intercept the interaction events, and upload them to the cloud server.
  • Step S318 Receive the access page of the previous local subprogram of the local subprogram synchronized by the cloud server.
  • Step S320 Update the access page of the local subprogram based on the access page of the previous local subprogram.
  • Step S324 Receive the exit instruction for the local subprogram synchronized by the cloud server, and exit the running of the local subprogram.
  • subroutine synchronization processing method provided in this embodiment in the startup synchronization scenario as an example to further explain the subroutine synchronization processing method provided in this embodiment.
  • the processing method specifically includes the following steps.
  • Step S402 Detect the startup request event of the local subprogram, and upload the startup request event to the cloud server.
  • Step S414 Receive the access page rendered synchronized by the cloud server and display it in the local subroutine.
  • the subprogram synchronization processing method provided in this embodiment and the subprogram synchronization processing device provided in this specification are as follows:
  • a subprogram synchronization processing applied to a remote server is provided.
  • a subroutine synchronization processing device running on a remote server is also provided, which will be described below with reference to the accompanying drawings.
  • FIG. 7 a schematic diagram of a subroutine synchronization processing device provided in this embodiment is shown.
  • the description is relatively simple. For relevant parts, please refer to the corresponding description of the method embodiment provided above.
  • the device embodiments described below are merely illustrative.
  • This embodiment provides a subprogram synchronization processing device, running on a remote server, including: a trigger event acquisition module 702, configured to obtain the trigger event of the local subprogram of the terminal device; a collaboration status detection module 704, configured to detect the The collaboration state of the local subprogram and the corresponding remote subprogram in the program container; the program container is installed in the virtual machine deployed by the remote server; if the collaboration state is an interactive synchronization state, the event type parsing module 706 is run, and the The event type parsing module 706 is configured to parse the trigger event to obtain the event type of the trigger event; the event response action execution module 708 is configured to execute the event response action corresponding to the event type based on the program container. and synchronize the subroutine page obtained after the action is executed to the terminal device.
  • a trigger event acquisition module 702 configured to obtain the trigger event of the local subprogram of the terminal device
  • a collaboration status detection module 704 configured to detect the The collaboration state of the local subprogram and the corresponding
  • subroutine synchronization processing device Another example of a subroutine synchronization processing device provided in this specification is as follows: In the above embodiment, a subroutine synchronization processing method applied to a terminal device is provided. Correspondingly, a subroutine synchronization processing method running on a terminal device is also provided. The subroutine synchronization processing device of the terminal equipment will be described below with reference to the accompanying drawings.
  • FIG. 8 a schematic diagram of a subroutine synchronization processing device provided in this embodiment is shown.
  • the description is relatively simple. For relevant parts, please refer to the corresponding description of the method embodiment provided above.
  • the device embodiments described below are merely illustrative.
  • This embodiment provides a subprogram synchronization processing device that runs on a terminal device and includes: a trigger event detection module 802 configured to detect trigger events of local subprograms and upload the trigger events to a remote server;
  • the subprogram page receiving module 804 is configured to receive the subprogram page synchronized by the remote server; the subprogram page is obtained after executing the event response action corresponding to the event type of the trigger event based on the program container;
  • the page update processing module 806 is configured to perform page update processing for the local subprogram according to the subprogram page; wherein the program container is installed in a virtual machine deployed by the remote server.
  • FIG. 9 is a schematic structural diagram of a subroutine synchronization processing device provided in an embodiment of this specification.
  • the subroutine synchronization processing device may have relatively large differences due to different configurations or performance, and may include one or more processors 901 and memories. 902.
  • One or more storage application programs or data may be stored in the memory 902.
  • memory 902 can be short-lived storage or persistent storage.
  • the application program stored in the memory 902 may include one or more modules (not shown), and each module may include a series of computer-executable instructions in a subroutine synchronization processing device.
  • the processor 901 may be configured to communicate with the memory 902 and execute a series of computer-executable instructions in the memory 902 on the subroutine synchronization processing device.
  • the subroutine synchronization processing device may also include one or more power supplies 903, one or more wired or wireless network interfaces 904, one or more input/output interfaces 905, one or more keyboards 906, etc.
  • the subroutine synchronization processing device includes a memory and one or more programs, wherein one or more programs are stored in the memory, and one or more programs may include one or more modules, And each module may include a series of computer-executable instructions in a subroutine synchronization processing device, and the one or more programs configured to be executed by one or more processors may include computer-executable instructions for: obtaining The triggering event of the local subprogram of the terminal device; detecting the collaboration state of the local subprogram and the corresponding remote subprogram in the program container; the program container is installed in a virtual machine deployed by the remote server; if the collaboration state is interactive synchronization status, parse the trigger event to obtain the event type of the trigger event; execute the event response action corresponding to the event type based on the program container, and synchronize the subroutine page obtained after the action execution to the terminal device .
  • FIG. 10 is a schematic structural diagram of a subroutine synchronization processing device provided by an embodiment of this specification.
  • the subroutine synchronization processing device may have relatively large differences due to different configurations or performance, and may include one or more processors 1001 and memories. 1002.
  • One or more storage application programs or data may be stored in the memory 1002.
  • the memory 1002 can be a short-term storage or a persistent storage.
  • the application program stored in the memory 1002 may include one or more modules (not shown), and each module may include a series of computer-executable instructions in a subroutine synchronization processing device.
  • the processor 1001 may be configured to communicate with the memory 1002 and execute a series of computer-executable instructions in the memory 1002 on the subroutine synchronization processing device.
  • the subroutine synchronization processing device may also include one or more power supplies 1003, one or more wired or wireless network interfaces 1004, one or more input/output interfaces 1005, one or more keyboards 1006, etc.
  • the subroutine synchronization processing device includes a memory and one or more programs, wherein one or more programs are stored in the memory, and one or more programs may include one or more modules, And each module may include a series of computer-executable instructions in a subroutine synchronization processing device, and the one or more programs configured to be executed by one or more processors may include computer-executable instructions for performing the following: detecting The trigger event of the local subprogram and upload the trigger event to the remote server; receive the subprogram page synchronized by the remote server; the subprogram page executes an event response corresponding to the event type of the trigger event based on the program container Obtained after the action; perform page update processing for the local subprogram according to the subprogram page; wherein the program container is installed in a virtual machine deployed by the remote server.
  • An example of a storage medium provided in this specification is as follows: Corresponding to the above-described subroutine synchronization processing method applied to a remote server, and based on the same technical concept, an embodiment of this specification also provides a storage medium.
  • the storage medium provided by this embodiment is used to store computer executable instructions.
  • the computer executable instructions When executed by the processor, the computer executable instructions implement the following processes: obtain the triggering event of the local subroutine of the terminal device; detect the relationship between the local subroutine and The collaboration state of the corresponding remote subroutine in the program container; the program container is installed on a virtual machine deployed on the remote server; if the collaboration state is an interactive synchronization state, parse the trigger event to obtain the event type of the trigger event ; Execute the event response action corresponding to the event type based on the program container, and synchronize the subroutine page obtained after the action is executed to the terminal device.
  • Another storage medium embodiment provided in this specification is as follows: Corresponding to the above-described subroutine synchronization processing method applied to terminal equipment, based on the same technical concept, an embodiment of this specification also provides a storage medium.
  • the storage medium provided by this embodiment is used to store computer-executable instructions.
  • the computer-executable instructions When executed by the processor, the computer-executable instructions implement the following process: detect the triggering event of the local subroutine, and upload the triggering event to the remote server. ; Receive the subprogram page synchronized by the remote server; the subprogram page is obtained after executing the event response action corresponding to the event type of the trigger event based on the program container; execute the local subprogram according to the subprogram page Page update processing; wherein, the program container is installed in a virtual machine deployed by the remote server.
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • the controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor. , logic gates, switches, Application Specific Integrated Circuit (ASIC), programmable logic controllers and embedded microcontrollers.
  • controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, For Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
  • the controller in addition to implementing the controller in the form of pure computer-readable program code, the controller can be completely programmed with logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded logic by logically programming the method steps. Microcontroller, etc. to achieve the same function. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as structures within hardware components as well as software modules implementing the methods.
  • a typical implementation device is a computer.
  • the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or A combination of any of these devices.
  • one or more embodiments of this specification may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present disclosure may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk memory, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including, but not limited to, disk memory, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
  • the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
  • Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information.
  • Information may be computer-readable instructions, data structures, modules of programs, 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), and read-only memory.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • read-only memory read-only memory
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • flash memory or other memory technology
  • compact disc read-only memory CD-ROM
  • DVD digital versatile disc
  • Magnetic tape cassettes disk storage or other magnetic storage devices, or any other non-transmission medium, can be used to store information that can be accessed by a computing device.
  • computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • One or more embodiments of this specification may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer.
  • program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types.
  • One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.

Abstract

本说明书实施例提供了子程序同步处理方法及装置。其中,一种子程序同步处理方法包括:获取终端设备的本地子程序的触发事件;检测所述本地子程序与程序容器内对应的远程子程序的协同状态;所述程序容器安装于所述远程服务器部署的虚拟机;若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。

Description

子程序同步处理 技术领域
本文件涉及数据处理技术领域,尤其涉及子程序同步处理的方法及装置。
背景技术
端云小程序是一种在云端进行小程序渲染,在终端设备上展示小程序页面的应用模式,包括云端小程序和本地小程序,让小程序不再受限于终端设备的硬件配置,为用户提供更好的性能体验。但是这种模式也将小程序的工作过程分成了本地和云端两个部分,分别运行在本地终端设备和云端虚拟系统内。
发明内容
本说明书一个或多个实施例提供了一种子程序同步处理方法,应用于远程服务器,包括:获取终端设备的本地子程序的触发事件;检测所述本地子程序与程序容器内对应的远程子程序的协同状态,所述程序容器安装于所述远程服务器部署的虚拟机;若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
本说明书实施例提供了另一种子程序同步处理方法,应用于终端设备,包括:检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;接收所述远程服务器同步的子程序页面,所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;根据所述子程序页面执行针对所述本地子程序的页面更新处理。其中,所述程序容器安装于所述远程服务器部署的虚拟机。
本说明书实施例提供了一种子程序同步处理装置,运行于远程服务器,包括:触发事件获取模块,被配置为获取终端设备的本地子程序的触发事件;协同状态检测模块,被配置为检测所述本地子程序与程序容器内对应的远程子程序的协同状态,所述程序容器安装于所述远程服务器部署的虚拟机,若所述协同状态为交互同步状态,运行事件类型解析模块,所述事件类型解析模块被配置为对所述触发事件进行解析获得所述触发事件的事件类型;事件响应动作执行模块,被配置为基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
本说明书一个或多个实施例提供了另一种子程序同步处理装置,运行于终端设备,包括:触发事件检测模块,被配置为检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;子程序页面接收模块,被配置为接收所述远程服务器同步的子程序页面;所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;页面更新处理模块,被配置为根据所述子程序页面执行针对所述本地子程序的页面更新处理。其中,所述程序容器安装于所述远程服务器部署的虚拟机。
本说明书一个或多个实施例提供了一种子程序同步处理设备,包括处理器及被配置为存储计算机可执行指令的存储器,所述计算机可执行指令在被执行时使所述处理器:获取终端设备的本地子程序的触发事件;检测所述本地子程序与程序容器内对应的远程子程序的协同状态,所述程序容器安装于远程服务器部署的虚拟机;若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
本说明书一个或多个实施例提供了另一种子程序同步处理设备,包括处理器及被配置为存储计算机可执行指令的存储器,所述计算机可执行指令在被执行时使所述处理器:检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;接收所述远程服务器同步的子程序页面,所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;根据所述子程序页面执行针对所述本地子程序的页面更新处理。其中,所述程序容器安装于所述远程服务器部署的虚拟机。
本说明书一个或多个实施例提供了一种存储介质,用于存储计算机可执行指令,所述计算机可执行指令在被处理器执行时实现以下流程:获取终端设备的本地子程序的触发事件;检测所述本地子程序与程序容器内对应的远程子程序的协同状态,所述程序容器安装于远程服务器部署的虚拟机;若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
本说明书一个或多个实施例提供了另一种存储介质,用于存储计算机可执行指令,所述计算机可执行指令在被处理器执行时实现以下流程:检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;接收所述远程服务器同步的子程序页面,所述子 程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;根据所述子程序页面执行针对所述本地子程序的页面更新处理。其中,所述程序容器安装于所述远程服务器部署的虚拟机。
附图说明
为了更清楚地说明本说明书一个或多个实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本说明书中记载的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图;
图1为本说明书实施例提供的一种子程序同步处理方法处理流程图;
图2为本说明书实施例提供的一种远程子程序与本地子程序系统框图的示意图;
图3为本说明书实施例提供的一种应用于交互同步场景的子程序同步处理方法处理时序图;
图4为本说明书实施例提供的一种应用于启动同步场景的子程序同步处理方法处理时序图;
图5为本说明书实施例提供的一种应用于本地退出场景的子程序同步处理方法处理流程图;
图6为本说明书实施例提供的另一种子程序同步处理方法处理流程图;
图7为本说明书实施例提供的一种子程序同步处理装置示意图;
图8为本说明书实施例提供的另一种子程序同步处理装置示意图;
图9为本说明书实施例提供的一种子程序同步处理设备的结构示意图;
图10为本说明书实施例提供的另一种子程序同步处理设备的结构示意图。
具体实施方式
为了使本技术领域的人员更好地理解本说明书实施例中的技术方案,下面将结合本说明书实施例中的附图,对本说明书实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本说明书的一部分实施例,而不是全部的实施例。基于本说明书实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本文件的保护范围。
本说明书提供的一种子程序同步处理方法实施例:参照图1,本实施例提供的子程序同步处理方法,应用于远程服务器,具体包括步骤S102至步骤S108。
步骤S102,获取终端设备的本地子程序的触发事件。
实际应用中,端云小程序在云端进行小程序页面渲染,在终端设备展示小程序页面的应用模式,将小程序的工作过程分成了本地和云端两个部分,分别运行在终端设备和云端虚拟系统内,若端云小程序未建立页面同步机制,则可能导致本地小程序和云端小程序的页面不同步的问题,降低用户体验。
针对于此,本实施例提供的子程序同步处理方法,通过与终端设备进行配合,建立远程子程序与本地子程序之间的页面同步机制,具体的,获取终端设备的本地子程序的触发事件,并检测本地子程序与程序容器内对应的远程子程序的协同状态,若协同状态为交互同步状态,根据对触发事件进行解析获得的触发事件的事件类型,确定并执行对应的事件响应动作,将动作执行后获得的子程序页面向终端设备进行同步,引入本地子程序与远程子程序的页面同步机制,保证本地子程序的显示页面与远程子程序的显示页面同步,提升用户的使用体验。
本实施例所述子程序,是指搭载于终端设备或者远程服务器的程序功能模块或者应用组件,或者,由终端设备或者远程服务器加载安装的程序功能模块或者应用组件,比如小程序。从服务的角度来讲,所述子程序具有独立提供自闭环服务的能力,比如具备服务预订、预订消息推送的自闭环能力的子程序。
所述本地子程序,是指搭载于终端设备的程序功能模块或者应用组件,或者,由终端设备加载安装的程序功能模块或者应用组件,比如本地小程序。所述远程服务器包括云端服务器。所述终端设备,配置有显示屏幕,包括不限于下述至少一项:用户终端、车辆安装的车机终端,车辆外接的IoT(Internet of Things)设备,智能音箱,无人售卖机,互动广告屏,POS(Point of sale)设备,以及智能电视、智能冰箱等智能家电产品,以及智能穿戴产品。
所述触发事件,包括下述至少一项:启动请求事件、交互事件、退出事件;可选的,所述触发事件包括所述终端设备拦截并上传的交互事件;所述终端设备在检测到用户触发所述本地子程序配置的交互接口提交的所述交互事件后,对所述交互事件进行拦截。
具体的,所述启动请求事件,是指终端设备针对本地子程序的启动以及访问页面的展示向远程服务器提交的事件;所述交互事件,是指用户触发本地子程序内的某个控件 提交的事件,比如用户通过本地子程序的当前访问页面配置的交互接口输入信息后生成的交互事件或者用户触发本地子程序的当前访问页面配置的交互接口后生成的页面跳转事件;所述退出事件,包括本地子程序的异常退出事件,比如本地子程序的闪退事件。
本实施例中,远程服务器与终端设备配合实现子程序同步处理,子程序分为本地子程序与远程子程序,采用在远程子程序内进行页面渲染,在本地子程序内进行渲染后的页面的展示,本地子程序运行于终端设备的操作系统,本地子程序的页面访问通过操作系统配置的访问接口进行,比如IoT终端的操作系统配置的访问接口,此外,本地子程序的页面访问也可通过远程与本地交互的访问接口进行,本地子程序的页面访问还可通过搭载本地子程序的应用程序内的访问接口或者该本地子应用程序内的访问接口进行;远程服务器部署有众多虚拟机(虚拟系统),程序容器运行于远程服务器的虚拟机,程序容器具有检测服务,检测服务用于检测本地子程序与远程子程序的退出与运行状态,以在本地子程序与远程子程序的退出状态不一致时,进行本地子程序与远程子程序的退出状态同步,程序容器内可运行多个子程序,也可仅运行1个子程序。
如图2所示,远程服务器为云端服务器,云端服务器与终端设备之间采用自定义的传输控制协议进行事件或者数据通信,本地子程序运行于终端设备的操作系统,云端服务器部署有众多虚拟系统,数量不定,程序容器运行于远程服务器的虚拟系统,程序容器具有检测服务,检测服务用于检测本地子程序与远程子程序的退出与运行状态,程序容器内可运行多个子程序,也可仅运行1个子程序。
具体实施时,获取终端设备的本地子程序的触发事件,在此之前,终端设备检测本地子程序的触发事件,并将触发事件向远程服务器上传。在终端设备检测本地子程序的触发事件,并将触发事件向远程服务器上传的具体执行过程中,获取用户触发本地子程序配置的交互接口提交的交互事件;将交互事件进行拦截,并向远程服务器上传。
步骤S104,检测所述本地子程序与程序容器内对应的远程子程序的协同状态。
其中,所述程序容器安装于所述远程服务器部署的虚拟机;需要说明的是,此处的虚拟机包括远程服务器部署的单个虚拟机或者远程服务器部署的虚拟机群。
本实施例所述程序容器,是指面向远程服务器提供的运行框架或者运行引擎,通过在远程服务器部署的虚拟机上安装该程序容器,能够在该程序容器内运行远程子程序。本实施例所述远程子程序搭载于所述远程服务器的虚拟机运行的所述程序容器。所述远程子程序,是指搭载于远程服务器的程序功能模块或者应用组件,或者,由远程服务器加载安装的程序功能模块或者应用组件,比如云端小程序。
所述协同状态,是指本地子程序与远程子程序配合进行页面渲染的状态。比如,终端设备将触发事件上传远程服务器,根据交互事件在远程子程序内渲染访问页面,以同步终端设备在本地子程序内进行展示的状态。所述协同状态,包括交互同步状态、启动同步状态和本地退出状态。其中,交互同步状态为本地子程序的交互事件对应的协同状态,启动同步状态为本地子程序的启动请求事件对应的协同状态,本地退出状态为本地子程序的退出事件对应的协同状态。
上述获取终端设备的本地子程序的触发事件,在此基础上,本步骤检测本地子程序与程序容器内对应的远程子程序的协同状态,以根据协同状态对本地子程序的触发事件进行响应。
如上所述,检测到的本地子程序与远程子程序的协同状态包括3种,分别为交互同步状态、启动同步状态、本地退出状态,下述分别针对这3种协同状态下的触发事件的响应过程进行具体说明。
具体的,交互同步状态下的触发事件的响应过程的具体说明参见步骤S106和S108,启动同步状态和本地退出状态下的触发事件的响应过程的具体说明参见步骤S108。
步骤S106,若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型。
上述检测本地子程序与程序容器内对应的远程子程序的协同状态,在检测出的协同状态为交互协同状态的情况下,对触发事件进行解析获得触发事件的事件类型,以确定事件类型对应的事件响应动作并执行。
如上所述,检测到的本地子程序与远程子程序的协同状态包括3种,分别为交互同步状态、启动同步状态、本地退出状态,若协同状态为交互同步状态,对触发事件进行解析获得触发事件的事件类型,具体可以运用事件解析模型,将触发事件输入事件解析模型进行事件类型解析,获得事件解析模型输出的该触发事件对应的事件类型。
本实施例解析获得的事件类型,包括交互事件类型、回退事件类型和/或退出事件类型;例如,交互事件为用户触发本地子程序配置的某个交互控件输入交互信息或者用户触发本地子程序中的某项服务请求跳转到该服务的服务页面或者用户触发本地子程序配置的某个交互控件请求显示弹框信息,回退事件为用户触发回退控件,退出事件为用户触发退出控件。
步骤S108,基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
本实施例所述事件响应动作,是指针对触发事件进行响应时所要执行的动作。
上述在协同状态为交互同步状态的情况下,对触发事件进行解析获得所述触发事件的事件类型,在此基础上,本步骤借助程序容器执行解析获得的事件类型对应的事件响应动作,并将动作执行获得的子程序页面向终端设备同步,以在终端设备的本地子程序进行子程序页面的展示,以此来确保本地子程序与远程子程序的页面同步,借助远程服务器庞大的数据支持,渲染远程子程序的子程序页面并向终端设备同步,以提升本地子程序的性能以及美观度,进一步提升用户的使用体验。
具体实施时,上述对触发事件进行解析获得触发事件的事件类型,针对不同的事件类型存在不同的解决方案,以针对性地执行事件响应动作,本实施例提供的一种可选实施方式中,通过如下方式执行事件类型对应的事件响应动作:若所述事件类型为交互事件类型,根据所述触发事件在所述远程子程序内渲染访问页面;将渲染后的访问页面同步至终端设备;若所述事件类型为回退事件类型,判断所述触发事件对应的本地子程序的访问页面是否存在上级页面;若存在,根据所述触发事件在所述远程子程序内渲染所述上级页面;将渲染后的上级页面向终端设备同步。
需要补充的是,若触发事件对应的本地子程序的访问页面不存在上级页面,向程序容器的检测服务同步针对本地子程序的退出通知,以记录本地子程序的退出状态,并判断页面栈数据是否为空;若不为空,根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面;将读取的访问页面向终端设备同步;
若为空,向所述终端设备下发针对所述本地子程序的退出指令,并针对运行所述程序容器的目标虚拟机进行资源释放。
相应的,若事件类型为交互事件类型,终端设备接收远程服务器同步的渲染后的访问页面,在本地子程序内展示访问页面,此处的访问页面,是指根据触发事件生成的页面,比如用户触发本地子程序内的某项服务,跳转到该项服务的访问页面。
若事件类型为回退事件类型,且触发事件对应的本地子程序的访问页面存在上级页面,终端设备接收远程服务器同步的在远程子程序内渲染的本地子程序的访问页面的上级页面,根据上级页面更新本地子程序的访问页面,即根据上级页面更新本地子程序原本展示的页面。
若事件类型为回退事件类型,且触发事件对应的本地子程序的访问页面不存在上级页面,且页面栈数据不为空,终端设备接收远程服务器同步的本地子程序的前一本地子程序的访问页面;根据前一本地子程序的访问页面更新本地子程序的访问页面。
若事件类型为回退事件类型,且触发事件对应的本地子程序的访问页面不存在上级页面,且页面栈数据为空,终端设备接收远程服务器下发的针对本地子程序的退出指令,退出本地子程序的运行。
另外,若事件类型为交互事件类型,根据触发事件在远程子程序内渲染访问页面;若事件类型为回退事件类型,判断触发事件对应的本地子程序的访问页面是否存在上级页面;若存在,根据触发事件在远程子程序内渲染上级页面;若不存在,判断页面栈数据是否为空;若不为空,根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面;若为空,向终端设备下发针对本地子程序的退出指令,并针对运行程序容器的目标虚拟机进行资源释放。
在此基础上,除上述提供的触发事件为交互事件类型与回退事件类型的情况下,执行对应的事件响应动作的具体实现过程之外,针对事件类型为退出事件类型的情况,本实施例提供的一种可选实施方式中,通过如下方式执行事件类型对应的事件响应动作:
若所述事件类型为退出事件类型,向所述程序容器的检测服务同步针对所述本地子程序的退出通知,以记录所述本地子程序的退出状态,并判断页面栈数据是否为空;
若不为空,根据所述页面栈数据中记录的程序访问顺序,查询并读取所述本地子程序的前一本地子程序的访问页面。
此外,还可通过如下方式执行事件类型对应的事件响应动作:若所述事件类型为退出事件类型,判断页面栈数据是否为空;若不为空,根据所述页面栈数据中记录的程序访问顺序,查询并读取所述本地子程序的前一本地子程序的访问页面。
进一步,在提供执行针对3种事件类型对应的事件响应动作的具体实现过程的基础上,若上述页面栈数据为空,代表退出当前本地子程序且当前本地子程序之前不存在其他被访问的本地子程序,本实施例提供的一种可选实施方式中,若所述页面栈数据为空,向所述终端设备下发针对所述本地子程序的退出指令,并针对运行所述程序容器的目标虚拟机进行资源释放。
再进一步,在提供执行针对3种事件类型对应的事件响应动作的具体实现过程,以及针对页面栈数据为空的情况,向终端设备下发针对本地子程序的退出指令的基础上, 可选的,若检测到所述本地子程序从第一访问页面跳转至第二访问页面,并从所述第二访问页面回跳至所述第一访问页面,在所述页面栈数据中删除所述第二访问页面的页面记录。
例如,本地子程序从A访问页面跳转至B访问页面,再从B访问页面回到A访问页面,在记录的页面栈数据中删除B访问页面的页面记录,以防止页面数据无效占用存储资源,提升存储资源利用率。
此外,若本地子程序与远程子程序的协同状态为启动同步状态,可向终端设备分配相应的虚拟机,并在此基础上运行程序容器以及在程序容器内运行远程子程序,并在远程子程序内进行访问页面的页面渲染,具体的,本实施例提供的一种可选实施方式中,还执行如下操作:若所述协同状态为启动同步状态,在虚拟机池中向所述终端设备分配对应的目标虚拟机并进行绑定处理;在绑定完成后启动所述目标虚拟机,并基于所述目标虚拟机启动所述程序容器;在所述程序容器内运行所述远程子程序,基于所述程序容器针对所述远程子程序进行页面渲染获得访问页面;向所述终端设备同步所述访问页面,以在所述本地子程序内进行展示。
在此之前,终端设备检测到用户触发本地子程序的访问控件提交的本地子程序的启动请求事件,将启动请求事件进行拦截向远程服务器上传,此时本地子程序显示启动画面,启动画面中可包含启动动画,相应的,远程服务器获取终端的本地子程序的启动请求事件,通过启动请求事件请求远程服务器分配相应的目标虚拟机;检测本地子程序与程序容器内对应的远程子程序的协同状态的过程中,程序容器内对应的远程子程序为空,即未启动,在此情况下的协同状态为启动协同状态。
在上述进行绑定处理的过程中,可选的,将所述终端设备的设备标识与所述目标虚拟机的虚拟机标识进行绑定;此外,也可将本地子程序的账户标识和终端设备的设备标识和目标虚拟机的虚拟机标识进行绑定;还可在本地子程序搭载运行在终端设备的宿主应用的情况下,将宿主应用的账户标识和/或终端设备的设备标识和目标虚拟机的虚拟机标识进行绑定。
需要说明的是,远程服务器部署有一定数量的虚拟机,其中,虚拟机池,是指由未与终端设备的设备标识绑定的虚拟机标识对应的虚拟机组成的虚拟机池,即闲置未工作的虚拟机群,在虚拟机的虚拟机标识与终端设备的设备标识绑定的过程中,该虚拟机标识对应的虚拟机仅为该设备标识对应的终端设备提供服务;所述虚拟机,包括虚拟系统;所述访问页面,是指启动本地子程序后展示的第一个页面。
再此外,除上述协同状态为交互同步状态以及启动同步状态之外,协同状态也可为本地退出状态,即检测到本地子程序出现退出状况,本实施例提供的一种可选实施方式中,还执行如下操作:若所述协同状态为本地退出状态,在所述程序容器内退出所述远程子程序的运行,并针对运行所述程序容器的目标虚拟机进行资源释放;其中,所述程序容器的检测服务按照预设时间周期向所述终端设备下发检测消息,并在检测到所述本地子程序未响应的检测消息的数目超出预设数目,确定所述协同状态为本地退出状态。
具体的,为了保证本地子程序与远程子程序的退出状态同步,在本地子程序退出的情况下,及时释放远程服务器的虚拟机资源,提高远程服务器的资源利用率,程序容器的检测服务按照预设时间周期(比如1ms)向终端设备下发检测消息,以通过本地子程序针对检测消息是否响应来确定本地子程序是否退出运行,在检测到本地子程序未响应的检测消息的数目超出预设数目时,确定协同状态为本地退出状态。
若协同状态为本地退出状态,即代表本地子程序已经退出运行,相应的,为了避免本地子程序退出的情况下,远程服务器的虚拟机资源未释放造成资源浪费,甚至其他用户无法请求远程服务器分配虚拟机资源,在程序容器内退出远程子程序的运行,并针对运行该程序容器的目标虚拟机进行资源释放,提升资源的利用率。
另外,实际应用中,用户通过手势退出的方式输入退出事件,远程子程序退出,本地子程序可能未退出,本地子程序显示黑屏,或者远程子程序异常退出(比如闪退)的情况下,无法向本地子程序同步退出消息,本地子程序显示黑屏,降低了用户体验,针对于此,本实施例提供的一种可选实施方式,程序容器的检测服务检测远程子程序的退出事件,及时向终端设备同步针对本地子程序的退出指令,具体的实现过程为:基于所述程序容器的检测服务检测所述远程子程序的退出事件;若所述退出事件为异常退出事件,向所述终端设备同步针对所述本地子程序的退出指令以退出所述本地子程序的运行;关闭所述程序容器,并针对向所述终端设备分配的目标虚拟机进行资源释放。
具体的,程序容器的检测服务检测远程子程序的退出事件,代表远程子程序退出运行,若退出事件为正常退出事件,说明在本地子程序退出的情况下,远程子程序也退出运行,远程子程序的退出事件属于正常退出事件,此时不作处理即可;若退出事件为异常退出事件,代表远程子程序在本地子程序未退出的情况下已经退出运行,属于异常退出,此时向终端设备同步针对本地子程序的退出指令,相应的,终端设备退出本地子程 序的运行,实现本地子程序与远程子程序的退出状态同步,并关闭程序容器,并及时释放目标虚拟机资源,提高云端服务器针对虚拟机的资源利用率。
综上所述,本实施例提供的子程序同步处理方法,首先获取终端设备的本地子程序的触发事件,检测本地子程序与程序容器内对应的远程子程序的协同状态,其次若协同状态为交互同步状态,对触发事件进行解析获得触发事件的事件类型;若事件类型为交互事件类型,根据触发事件在远程子程序内渲染访问页面;将渲染后的访问页面向终端设备同步;若事件类型为回退事件类型,判断触发事件对应的本地子程序的访问页面是否存在上级页面;若存在,根据触发事件在远程子程序内渲染上级页面,将渲染后的上级页面向终端设备同步,若不存在,向程序容器的检测服务同步针对本地子程序的退出通知,以记录本地子程序的退出状态,并判断页面栈数据是否为空;若不为空,根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面,并将读取的前一本地子程序的访问页面向终端设备同步,若为空,向终端设备下发针对本地子程序的退出指令,并针对运行程序容器的目标虚拟机进行资源释放;若事件类型为退出事件类型,向程序容器的检测服务同步针对本地子程序的退出通知,以记录本地子程序的退出状态,并判断页面栈数据是否为空;若不为空,根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面,并将读取的前一本地子程序的访问页面向终端设备同步,若为空,向终端设备下发针对本地子程序的退出指令,并针对运行程序容器的目标虚拟机进行资源释放;再次,若协同状态为启动同步状态,在虚拟机池中向终端设备分配对应的目标虚拟机并进行绑定处理;在绑定完成后启动目标虚拟机,并基于目标虚拟机启动程序容器;在程序容器内运行远程子程序,基于程序容器针对远程子程序进行页面渲染获得访问页面;向终端设备同步访问页面,以在本地子程序内进行展示;若协同状态为本地退出状态,在程序容器内退出远程子程序的运行,并针对运行程序容器的目标虚拟机进行资源释放;其中,程序容器的检测服务按照预设时间周期向终端设备下发检测消息,并在检测到本地子程序未响应的检测消息的数目超出预设数目,确定协同状态为本地退出状态。
此外,基于程序容器的检测服务检测远程子程序的退出事件;若退出事件为异常退出事件,向终端设备同步针对本地子程序的退出指令以退出本地子程序的运行;关闭程序容器,并针对向终端设备分配的目标虚拟机进行资源释放。
通过引入本地子程序与远程子程序的页面同步机制,保证本地子程序的显示页面与远程子程序的显示页面同步,提升用户的使用体验。
下述以本实施例提供的一种子程序同步处理方法在交互同步场景的应用为例,对本实施例提供的子程序同步处理方法进行进一步说明,参见图3,应用于交互同步场景的子程序同步处理方法,具体包括如下步骤。
步骤S304,检测本地子程序与程序容器内对应的云端子程序的协同状态。
其中,程序容器安装于云端服务器部署的虚拟机。
步骤S306,若协同状态为交互同步状态,对交互事件进行解析获得交互事件的事件类型。
步骤S308,若事件类型为回退事件类型,基于程序容器判断交互事件对应的本地子程序的访问页面是否存在上级页面;若存在,基于程序容器并根据交互事件在云端子程序内渲染上级页面,并将渲染后的上级页面向终端设备同步;若不存在,执行步骤S310至步骤S312。
此外,若事件类型为退出事件类型,向程序容器的检测服务同步针对本地子程序的退出通知,以记录本地子程序的退出状态,并判断页面栈数据是否为空;若不为空,根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面;若为空,向终端设备下发针对本地子程序的退出指令,并针对运行程序容器的目标虚拟机进行资源释放。
若事件类型为交互事件类型,根据交互事件在远程子程序内渲染访问页面。
步骤S310,向程序容器的检测服务同步针对本地子程序的退出通知,以记录本地子程序的退出状态。
步骤S312,判断页面栈数据是否为空;若不为空,执行步骤S314至步骤S316;
若为空,执行步骤S322。
步骤S314,根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面。
步骤S316,向终端设备同步读取到的本地子程序的前一本地子程序的访问页面。
步骤S322,向终端设备下发针对本地子程序的退出指令,并针对运行程序容器的目标虚拟机进行资源释放。
下述以本实施例提供的一种子程序同步处理方法在启动同步场景的应用为例,对本实施例提供的子程序同步处理方法进行进一步说明,参见图4,应用于启动同步场景的 子程序同步处理方法,具体包括如下步骤。
步骤S404,检测本地子程序与程序容器内对应的云端子程序的协同状态。
其中,程序容器安装于云端服务器部署的虚拟机。
步骤S406,在虚拟机池中向终端设备分配对应的目标虚拟机并进行绑定处理。
步骤S408,在绑定完成后启动目标虚拟机,并基于目标虚拟机启动程序容器。
步骤S410,在程序容器内运行云端子程序,基于程序容器针对云端子程序进行页面渲染获得访问页面。
步骤S412,向终端设备同步访问页面,以在本地子程序内进行展示。
下述以本实施例提供的一种子程序同步处理方法在本地退出场景的应用为例,对本实施例提供的子程序同步处理方法进行进一步说明,参见图5,应用于本地退出场景的子程序同步处理方法,具体包括如下步骤。
步骤S502,基于程序容器的检测服务按照预设时间周期向终端设备下发检测消息。
步骤S504,在检测到本地子程序未响应的检测消息的数目超出预设数目,确定协同状态为本地退出状态。
步骤S506,在程序容器内退出云端子程序的运行。
步骤S508,针对运行程序容器的目标虚拟机进行资源释放。
上述提供的交互同步场景与启动同步场景的子程序同步处理方法的实现过程,由远程服务器执行,下述方法实施例提供的应用于交互同步场景与启动同步场景的子程序同步处理方法的实现过程,由终端设备执行,二者在执行过程中相互配合,因此,阅读上述实现过程请参照下述方法实施例的对应内容。
本说明书提供的另一种子程序同步处理方法实施例:在上述的实施例中,提供了一种子程序同步处理方法,应用于远程服务器,与之相配合的,本实施例还提供了一种子程序同步处理方法,应用于终端设备,下面结合附图进行说明。
参照图6,本实施例提供的子程序同步处理方法,应用于终端设备,具体包括步骤S602至步骤S606。
步骤S602,检测本地子程序的触发事件,并将所述触发事件向远程服务器上传。
本实施例提供的子程序同步处理方法,通过与远程服务器进行配合,检测本地子程序的触发事件,并将检测到的触发事件向远程服务器上传,以在远程服务器进行页面渲染,并展示接收的远程服务器同步的子程序页面,引入本地子程序与远程子程序的页面同步机制,保证本地子程序显示的访问页面与远程子程序显示的访问页面同步,提升用户的使用体验。
本实施例所述子程序,是指搭载于终端设备或者远程服务器的程序功能模块或者应用组件,或者,由终端设备或者远程服务器加载安装的程序功能模块或者应用组件,比如小程序。从服务的角度来讲,所述子程序具有独立提供自闭环服务的能力,比如具备服务预订、预订消息推送的自闭环能力的子程序。
所述本地子程序,是指搭载于终端设备的程序功能模块或者应用组件,或者,由终端设备加载安装的程序功能模块或者应用组件,比如本地小程序。所述远程服务器包括云端服务器。所述终端设备,配置有显示屏幕,包括不限于下述至少一项:用户终端、车辆安装的车机终端,车辆外接的IoT(Internet of Things)设备,智能音箱,无人售卖机,互动广告屏,POS(Point of sale)设备,以及智能电视、智能冰箱等智能家电产品,以及智能穿戴产品。
所述触发事件,包括下述至少一项:启动请求事件、交互事件、退出事件;具体的,所述触发事件包括终端设备拦截并上传的交互事件;终端设备在检测到用户触发本地子程序配置的交互接口提交的交互事件后,对交互事件进行拦截。
具体的,所述启动请求事件,是指终端设备针对本地子程序的启动以及访问页面的展示向远程服务器提交的事件;所述交互事件,是指用户触发本地子程序内的某个控件提交的事件,比如用户通过本地子程序的当前访问页面配置的交互接口输入信息后生成的交互事件或者用户触发本地子程序的当前访问页面配置的交互接口后生成的页面跳转事件;所述退出事件,包括本地子程序的异常退出事件,比如本地子程序的闪退事件。
本实施例中,远程服务器与终端设备配合实现子程序同步处理,子程序分为本地子程序与远程子程序,采用在远程子程序内进行页面渲染,在本地子程序内进行渲染后的页面的展示,本地子程序运行于终端设备的操作系统,本地子程序的页面访问通过操作系统配置的访问接口进行,比如IoT终端的操作系统配置的访问接口,此外,本地子程序的页面访问也可通过远程与本地交互的访问接口进行,本地子程序的页面访问还可通过搭载本地子程序的应用程序内的访问接口或者该本地子应用程序内的访问接口进行;远程服务器部署有众多虚拟机(虚拟系统),程序容器运行于远程服务器的虚拟机,程序容器具有检测服务,检测服务用于检测本地子程序与远程子程序的退出与运行状态,以在本地子程序与远程子程序的退出状态不一致时,进行本地子程序与远程子程序的退 出状态同步,程序容器内可运行多个子程序,也可仅运行1个子程序。
其中,所述程序容器安装于远程服务器部署的虚拟机;需要说明的是,此处的虚拟机包括远程服务器部署的单虚拟机或者远程服务器部署的虚拟机群。
所述程序容器,是指面向远程服务器提供的运行框架或者运行引擎,通过在远程服务器部署的虚拟机上安装该程序容器,能够在该程序容器内运行远程子程序。本实施例所述远程子程序搭载于所述远程服务器的虚拟机运行的所述程序容器。所述远程子程序,是指搭载于远程服务器的程序功能模块或者应用组件,或者,由远程服务器加载安装的程序功能模块或者应用组件,比如云端小程序。
如图2所示,远程服务器为云端服务器,云端服务器与终端设备之间采用自定义的传输控制协议进行事件或者数据通信,本地子程序运行于终端设备的操作系统,云端服务器部署有众多虚拟系统,数量不定,程序容器运行于远程服务器的虚拟系统,程序容器具有检测服务,检测服务用于检测本地子程序与远程子程序的退出与运行状态,程序容器内可运行多个子程序,也可仅运行1个子程序。
具体实施时,检测本地子程序的触发事件,将检测到的触发事件向远程服务器上传,以在远程服务器进行事件响应,相应的,远程服务器获取终端设备的本地子程序的触发事件。
实际应用中,用户可通过本地子程序配置的接口输入交互事件,在此情况下,本地子程序对该交互事件不作响应,而是拦截该交互事件并上传远程服务器,以在远程服务器进行该交互事件的响应。本实施例提供的一种可选实施方式中,检测本地子程序的触发事件,并将触发事件向远程服务器的具体实现过程如下所述:获取用户触发所述本地子程序配置的交互接口提交的交互事件;将所述交互事件进行拦截,并向所述远程服务器上传。
在远程服务器获取本地子程序的触发事件之后,远程服务器检测本地子程序与程序容器内对应的远程子程序的协同状态;所述协同状态,是指本地子程序与远程子程序配合进行页面渲染的状态。比如,终端设备将触发事件上传远程服务器,根据交互事件在远程子程序内渲染访问页面,以同步终端设备在本地子程序进行展示的状态。所述协同状态,包括交互同步状态、启动同步状态和本地退出状态。其中,交互同步状态为本地子程序的交互事件对应的协同状态,启动同步状态为本地子程序的启动请求事件对应的协同状态,本地退出状态为本地子程序的退出事件对应的协同状态。
如上所述,检测到的本地子程序与远程子程序的协同状态包括3种,分别为交互同步状态、启动同步状态、本地退出状态,下述分别针对这3种协同状态下的触发事件的响应过程进行具体说明。
(1)协同状态为交互同步状态
若协同状态为交互同步状态,对触发事件进行解析获得触发事件的事件类型,基于程序容器执行事件类型对应的事件响应动作,具体可以运用事件解析模型,将触发事件输入事件解析模型进行事件类型解析,获得事件解析模型输出的该触发事件对应的事件类型。
其中,所述事件类型,包括交互事件类型、回退事件类型和/或退出事件类型;例如,交互事件为用户触发本地子程序配置的某个交互控件输入交互信息或者用户触发本地子程序中的某项服务请求跳转到该服务的服务页面或者用户触发本地子程序配置的某个交互控件请求显示弹框信息,回退事件为用户触发回退控件,退出事件为用户触发退出控件。
具体实施时,在对触发事件进行解析获得触发事件的事件类型的基础上,远程服务器基于程序容器执行事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向终端设备同步,以在终端设备的本地子程序进行子程序页面的展示,以此来确保本地子程序与远程子程序的页面同步,借助远程服务器庞大的数据支持,渲染远程子程序的子程序页面并向终端设备同步,以提升本地子程序的性能以及美观度,进一步提升用户的使用体验。
具体实施时,上述对触发事件进行解析获得触发事件的事件类型,针对不同的事件类型存在不同的解决方案,以针对性地执行事件响应动作,本实施例提供的一种可选实施方式中,远程服务器通过如下方式执行事件类型对应的事件响应动作:若所述事件类型为交互事件类型,根据所述触发事件在所述远程子程序内渲染访问页面;将渲染后的访问页面同步至终端设备;若所述事件类型为回退事件类型,判断所述触发事件对应的本地子程序的访问页面是否存在上级页面;若存在,根据所述触发事件在所述远程子程序内渲染所述上级页面;将渲染后的上级页面向终端设备同步。
需要补充的是,若触发事件对应的本地子程序的访问页面不存在上级页面,远程服务器向程序容器的检测服务同步针对本地子程序的退出通知,以记录本地子程序的退出状态,并判断页面栈数据是否为空;若不为空,根据页面栈数据中记录的程序访问顺序, 查询并读取本地子程序的前一本地子程序的访问页面;将读取的访问页面向终端设备同步;若为空,向所述终端设备下发针对所述本地子程序的退出指令,并针对运行所述程序容器的目标虚拟机进行资源释放。
另外,若事件类型为交互事件类型,远程服务器基于程序容器根据触发事件在远程子程序内渲染访问页面;若事件类型为回退事件类型,判断触发事件对应的本地子程序的访问页面是否存在上级页面;若存在,根据触发事件在远程子程序内渲染上级页面;若不存在,判断页面栈数据是否为空;若不为空,根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面;若为空,向终端设备下发针对本地子程序的退出指令,并针对运行程序容器的目标虚拟机进行资源释放。
在此基础上,除上述提供的触发事件为交互事件类型与回退事件类型的情况下,执行对应的事件响应动作的具体实现过程之外,针对事件类型为退出事件类型的情况,远程服务器通过如下方式执行事件类型对应的事件响应动作:若所述事件类型为退出事件类型,向所述程序容器的检测服务同步针对所述本地子程序的退出通知,以记录所述本地子程序的退出状态,并判断页面栈数据是否为空;若不为空,根据所述页面栈数据中记录的程序访问顺序,查询并读取所述本地子程序的前一本地子程序的访问页面。
此外,远程服务器还可通过如下方式执行事件类型对应的事件响应动作:若事件类型为退出事件类型,判断页面栈数据是否为空;若不为空,根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面。
进一步,在提供执行针对3个事件类型对应的事件响应动作的具体实现过程的基础上,若上述页面栈数据为空,代表退出当前本地子程序且当前本地子程序之前不存在其他访问的本地子程序,具体的,远程服务器执行如下操作:若所述页面栈数据为空,向所述终端设备下发针对所述本地子程序的退出指令,并针对运行所述程序容器的目标虚拟机进行资源释放。
再进一步,远程服务器在提供执行针对3个事件类型对应的事件响应动作的具体实现过程,以及针对页面栈数据为空的情况,向终端设备下发针对本地子程序的退出指令的基础上,具体的,若检测到本地子程序从第一访问页面跳转至第二访问页面,并从第二访问页面回跳至第一访问页面,在页面栈数据中删除第二访问页面的页面记录。
例如,本地子程序从A访问页面跳转至B访问页面,再从B访问页面回到A访问页面,在记录的页面栈数据中删除B访问页面的页面记录,以防止页面数据无效占用存储资源,提升存储资源利用率。
(2)协同状态为启动同步状态
远程服务器向终端设备分配相应的虚拟机,并在此基础上运行程序容器以及在程序容器内运行远程子程序,并在远程子程序内进行访问页面的页面渲染,具体的,本实施例提供的一种可选实施方式中,远程服务器还执行如下操作:若协同状态为启动同步状态,在虚拟机池中向终端设备分配对应的目标虚拟机并进行绑定处理;在绑定完成后启动所述目标虚拟机,并基于目标虚拟机启动程序容器;在程序容器内运行远程子程序,基于程序容器针对远程子程序进行页面渲染获得访问页面;向终端设备同步访问页面,以在本地子程序内进行展示。
在此之前,终端设备检测到用户触发本地子程序的访问控件提交的本地子程序的启动请求事件,将启动请求事件进行拦截向远程服务器上传,此时本地子程序显示启动画面,启动画面中可包含启动动画,相应的,远程服务器获取终端的本地子程序的启动请求事件,通过启动请求事件请求远程服务器分配相应的目标虚拟机;检测本地子程序与程序容器内对应的远程子程序的协同状态的过程中,程序容器内对应的远程子程序为空,即未启动,在此情况下的协同状态为启动协同状态。
在上述进行绑定处理的过程中,远程服务器将终端设备的设备标识与目标虚拟机的虚拟机标识进行绑定;此外,也可将本地子程序的账户标识和终端设备的设备标识和目标虚拟机的虚拟机标识进行绑定;还可在本地子程序搭载运行在终端设备的宿主应用的情况下,将宿主应用的账户标识和/或终端设备的设备标识和目标虚拟机的虚拟机标识进行绑定。
需要说明的是,远程服务器部署有一定数量的虚拟机,其中,虚拟机池,是指由未与终端设备的设备标识绑定的虚拟机标识对应的虚拟机组成的虚拟机池,即闲置未工作的虚拟机群,在虚拟机的虚拟机标识与终端设备的设备标识绑定的过程中,该虚拟机标识对应的虚拟机仅为该设备标识对应的终端设备提供服务;所述虚拟机,包括虚拟系统;所述访问页面,是指启动本地子程序后展示的第一个页面。
(3)协同状态为启动同步状态
此外,除上述协同状态为启动同步状态之外,协同状态也可为本地退出状态,即检测到本地子程序出现退出状况,远程服务器还执行如下操作:若协同状态为本地退出状态,在程序容器内退出远程子程序的运行,并针对运行程序容器的目标虚拟机进行资源 释放;其中,程序容器的检测服务按照预设时间周期向终端设备下发检测消息,并在检测到本地子程序未响应的检测消息的数目超出预设数目,确定协同状态为本地退出状态。
具体的,为了保证本地子程序与远程子程序的退出状态同步,在本地子程序退出的情况下,远程服务器及时释放虚拟机资源,提高远程服务器的资源利用率,远程服务器基于程序容器的检测服务按照预设时间周期(比如1ms)向终端设备下发检测消息,以通过本地子程序针对检测消息是否响应来确定本地子程序是否退出运行,在检测到本地子程序未响应的检测消息的数目超出预设数目时,确定协同状态为本地退出状态。
若协同状态为本地退出状态,即代表本地子程序已经退出运行,相应的,为了避免本地子程序退出的情况下,远程服务器的虚拟机资源未释放造成资源浪费,甚至其他用户无法请求远程服务器分配虚拟机资源,远程服务器在程序容器内退出远程子程序的运行,并针对运行该程序容器的目标虚拟机进行资源释放,提升资源的利用率。
另外,实际应用中,用户通过手势退出的方式输入退出事件,远程子程序退出,本地子程序可能未退出,本地子程序显示黑屏,或者远程子程序异常退出(比如闪退)的情况下,无法向本地子程序同步退出消息,本地子程序显示黑屏,降低了用户体验,针对于此,远程服务器基于程序容器的检测服务检测远程子程序的退出事件,及时向终端设备同步针对本地子程序的退出指令,具体的实现过程为:基于程序容器的检测服务检测远程子程序的退出事件;若退出事件为异常退出事件,向终端设备同步针对本地子程序的退出指令以退出本地子程序的运行;关闭程序容器,并针对向终端设备分配的目标虚拟机进行资源释放。
具体的,程序容器的检测服务检测远程子程序的退出事件,代表远程子程序退出运行,若退出事件为正常退出事件,说明在本地子程序退出的情况下,远程子程序也退出运行,远程子程序的退出事件属于正常退出事件,此时不作处理即可;若退出事件为异常退出事件,代表远程子程序在本地子程序未退出的情况下已经退出运行,属于异常退出,此时向终端设备同步针对本地子程序的退出指令,相应的,终端设备退出本地子程序的运行,实现本地子程序与远程子程序的退出状态同步,并关闭程序容器,并及时释放目标虚拟机资源,提高云端服务器针对虚拟机的资源利用率。
步骤S604,接收所述远程服务器同步的子程序页面。
其中,所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;所述程序容器安装于所述远程服务器部署的虚拟机。
上述检测本地子程序的触发事件,并将触发事件向远程服务器上传,相应的,远程服务器基于程序容器执行触发事件的事件类型对应的事件响应动作后获得子程序页面,在此基础上,本步骤接收远程服务器同步的子程序页面。
如上所述,远程服务器分别执行触发事件的3个事件类型对应的事件响应动作,若事件类型为交互事件类型,远程服务器根据触发事件在远程子程序内渲染访问页面;将渲染后的访问页面同步至终端设备;相应的,终端设备接收远程服务器同步的渲染后的访问页面,此处的访问页面,是指根据触发事件生成的页面,比如用户触发本地子程序内的某项服务,跳转到该项服务的访问页面。
若事件类型为回退事件类型,且触发事件对应的本地子程序的访问页面存在上级页面,远程服务器根据触发事件在远程子程序内渲染上级页面;将渲染后的上级页面向终端设备同步,相应的,终端设备接收远程服务器同步的渲染后的上级页面。
若事件类型为回退事件类型,且触发事件对应的本地子程序的访问页面不存在上级页面,且页面栈数据为空,远程服务器向终端设备下发针对本地子程序的退出指令,并针对运行程序容器的目标虚拟机进行资源释放,相应的,终端设备接收远程服务器下发的针对本地子程序的退出指令,基于退出指令退出本地子程序的运行。
若事件类型为回退事件类型,且触发事件对应的本地子程序的访问页面不存在上级页面,且页面栈数据不为空,远程服务器根据页面栈数据中记录的程序访问顺序,查询并读取本地子程序的前一本地子程序的访问页面;将读取的访问页面向终端设备同步;相应的,终端设备接收远程服务器同步的查询并读取的本地子程序的前一本地子程序的访问页面。
步骤S606,根据所述子程序页面执行针对所述本地子程序的页面更新处理。
在上述接收远程服务器同步的子程序页面的基础上,本步骤根据子程序页面执行针对本地子程序的页面更新处理;需要说明的是,此处本地子程序的页面可以被更新为本地子程序内的其他页面或者本地子程序的前一本地子程序的访问页面,或者其他页面。
具体实施时,针对上述终端设备接收远程服务器同步的渲染后的上级页面,本实施例提供的一种可选实施方式中,终端设备在根据子程序页面执行针对本地子程序的页面更新处理的过程中,执行如下操作:根据所述远程服务器同步的所述本地子程序的访问页面的上级页面更新所述本地子程序的访问页面。
此处的访问页面即根据上级页面更新本地子程序原本展示的页面。
针对上述终端设备接收远程服务器同步的查询并读取的本地子程序的前一本地子程序的访问页面,本实施例提供的一种可选实施方式中,终端设备在根据子程序页面执行针对本地子程序的页面更新处理的过程中,执行如下操作:根据所述远程服务器同步的所述本地子程序的前一本地子程序的访问页面更新所述本地子程序的访问页面。
综上所述,本实施例提供的子程序同步处理方法,首先检测本地子程序的触发事件,并将触发事件向远程服务器上传,其次接收远程服务器同步的子程序页面,最后根据子程序页面执行针对本地子程序的页面更新处理,通过引入本地子程序与远程子程序的页面同步机制,保证本地子程序的显示页面与远程子程序的显示页面同步,提升用户的使用体验。
下述以本实施例提供的一种子程序同步处理方法在交互同步场景的应用为例,对本实施例提供的子程序同步处理方法进行进一步说明,参见图3,应用于交互同步场景的子程序同步处理方法,具体包括如下步骤。
步骤S302,检测本地子程序的交互事件,拦截交互事件并向云端服务器上传。
步骤S318,接收云端服务器同步的本地子程序的前一本地子程序的访问页面。
步骤S320,根据前一本地子程序的访问页面更新本地子程序的访问页面。
步骤S324,接收云端服务器同步的针对本地子程序的退出指令,并退出本地子程序的运行。
下述以本实施例提供的一种子程序同步处理方法在启动同步场景的应用为例,对本实施例提供的子程序同步处理方法进行进一步说明,参见图4,应用于启动同步场景的子程序同步处理方法,具体包括如下步骤。
步骤S402,检测本地子程序的启动请求事件,并将启动请求事件向云端服务器上传。
步骤S414,接收云端服务器同步的渲染获得的访问页面,在本地子程序内进行展示。
综上所述,本实施例提供的子程序同步处理方法,本说明书提供的一种子程序同步处理装置实施例如下:在上述的实施例中,提供了一种应用于远程服务器的子程序同步处理方法,与之相对应的,还提供了一种运行于远程服务器的子程序同步处理装置,下面结合附图进行说明。
参照图7,其示出了本实施例提供的一种子程序同步处理装置示意图。
由于装置实施例对应于方法实施例,所以描述得比较简单,相关的部分请参见上述提供的方法实施例的对应说明即可。下述描述的装置实施例仅仅是示意性的。
本实施例提供一种子程序同步处理装置,运行于远程服务器,包括:触发事件获取模块702,被配置为获取终端设备的本地子程序的触发事件;协同状态检测模块704,被配置为检测所述本地子程序与程序容器内对应的远程子程序的协同状态;所述程序容器安装于所述远程服务器部署的虚拟机;若所述协同状态为交互同步状态,运行事件类型解析模块706,所述事件类型解析模块706,被配置为对所述触发事件进行解析获得所述触发事件的事件类型;事件响应动作执行模块708,被配置为基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
本说明书提供的另一种子程序同步处理装置实施例如下:在上述的实施例中,提供了一种应用于终端设备的子程序同步处理方法,与之相对应的,还提供了一种运行于终端设备的子程序同步处理装置,下面结合附图进行说明。
参照图8,其示出了本实施例提供的一种子程序同步处理装置示意图。
由于装置实施例对应于方法实施例,所以描述得比较简单,相关的部分请参见上述提供的方法实施例的对应说明即可。下述描述的装置实施例仅仅是示意性的。
本实施例提供一种子程序同步处理装置,运行于终端设备,包括:触发事件检测模块802,被配置为检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;
子程序页面接收模块804,被配置为接收所述远程服务器同步的子程序页面;所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;
页面更新处理模块806,被配置为根据所述子程序页面执行针对所述本地子程序的页面更新处理;其中,所述程序容器安装于所述远程服务器部署的虚拟机。
本说明书提供的一种子程序同步处理设备实施例如下:对应上述描述的一种应用于远程服务器的子程序同步处理方法,基于相同的技术构思,本说明书实施例还提供一种子程序同步处理设备,该子程序同步处理设备用于执行上述提供的子程序同步处理方法,图9为本说明书实施例提供的一种子程序同步处理设备的结构示意图。
本实施例提供的一种子程序同步处理设备,包括:如图9所示,子程序同步处理设备可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上的处理器901和存储器902,存储器902中可以存储有一个或一个以上存储应用程序或数据。其中,存 储器902可以是短暂存储或持久存储。存储在存储器902的应用程序可以包括一个或一个以上模块(图示未示出),每个模块可以包括子程序同步处理设备中的一系列计算机可执行指令。更进一步地,处理器901可以设置为与存储器902通信,在子程序同步处理设备上执行存储器902中的一系列计算机可执行指令。子程序同步处理设备还可以包括一个或一个以上电源903,一个或一个以上有线或无线网络接口904,一个或一个以上输入/输出接口905,一个或一个以上键盘906等。
在一个具体的实施例中,子程序同步处理设备包括有存储器,以及一个或一个以上的程序,其中一个或者一个以上程序存储于存储器中,且一个或者一个以上程序可以包括一个或一个以上模块,且每个模块可以包括对子程序同步处理设备中的一系列计算机可执行指令,且经配置以由一个或者一个以上处理器执行该一个或者一个以上程序包含用于进行以下计算机可执行指令:获取终端设备的本地子程序的触发事件;检测所述本地子程序与程序容器内对应的远程子程序的协同状态;所述程序容器安装于远程服务器部署的虚拟机;若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
本说明书提供的另一种子程序同步处理设备实施例如下:对应上述描述的一种应用于终端设备的子程序同步处理方法,基于相同的技术构思,本说明书实施例还提供一种子程序同步处理设备,该子程序同步处理设备用于执行上述提供的子程序同步处理方法,图10为本说明书实施例提供的一种子程序同步处理设备的结构示意图。
本实施例提供的一种子程序同步处理设备,包括:如图10所示,子程序同步处理设备可因配置或性能不同而产生比较大的差异,可以包括一个或一个以上的处理器1001和存储器1002,存储器1002中可以存储有一个或一个以上存储应用程序或数据。其中,存储器1002可以是短暂存储或持久存储。存储在存储器1002的应用程序可以包括一个或一个以上模块(图示未示出),每个模块可以包括子程序同步处理设备中的一系列计算机可执行指令。更进一步地,处理器1001可以设置为与存储器1002通信,在子程序同步处理设备上执行存储器1002中的一系列计算机可执行指令。子程序同步处理设备还可以包括一个或一个以上电源1003,一个或一个以上有线或无线网络接口1004,一个或一个以上输入/输出接口1005,一个或一个以上键盘1006等。
在一个具体的实施例中,子程序同步处理设备包括有存储器,以及一个或一个以上的程序,其中一个或者一个以上程序存储于存储器中,且一个或者一个以上程序可以包括一个或一个以上模块,且每个模块可以包括对子程序同步处理设备中的一系列计算机可执行指令,且经配置以由一个或者一个以上处理器执行该一个或者一个以上程序包含用于进行以下计算机可执行指令:检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;接收所述远程服务器同步的子程序页面;所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;根据所述子程序页面执行针对所述本地子程序的页面更新处理;其中,所述程序容器安装于所述远程服务器部署的虚拟机。
本说明书提供的一种存储介质实施例如下:对应上述描述的一种应用于远程服务器的子程序同步处理方法,基于相同的技术构思,本说明书实施例还提供一种存储介质。
本实施例提供的存储介质,用于存储计算机可执行指令,所述计算机可执行指令在被处理器执行时实现以下流程:获取终端设备的本地子程序的触发事件;检测所述本地子程序与程序容器内对应的远程子程序的协同状态;所述程序容器安装于远程服务器部署的虚拟机;若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
需要说明的是,本说明书中关于存储介质的实施例与本说明书中关于子程序同步处理方法的实施例基于同一发明构思,因此该实施例的具体实施可以参见前述对应方法的实施,重复之处不再赘述。
本说明书提供的另一种存储介质实施例如下:对应上述描述的一种应用于终端设备的子程序同步处理方法,基于相同的技术构思,本说明书实施例还提供一种存储介质。
本实施例提供的存储介质,用于存储计算机可执行指令,所述计算机可执行指令在被处理器执行时实现以下流程:检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;接收所述远程服务器同步的子程序页面;所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;根据所述子程序页面执行针对所述本地子程序的页面更新处理;其中,所述程序容器安装于所述远程服务器部署的虚拟机。
需要说明的是,本说明书中关于存储介质的实施例与本说明书中关于子程序同步处理方法的实施例基于同一发明构思,因此该实施例的具体实施可以参见前述对应方法的 实施,重复之处不再赘述。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
在20世纪30年代,对于一个技术的改进可以很明显地区分是硬件上的改进(例如,对二极管、晶体管、开关等电路结构的改进)还是软件上的改进(对于方法流程的改进)。然而,随着技术的发展,当今的很多方法流程的改进已经可以视为硬件电路结构的直接改进。设计人员几乎都通过将改进的方法流程编程到硬件电路中来得到相应的硬件电路结构。因此,不能说一个方法流程的改进就不能用硬件实体模块来实现。例如,可编程逻辑器件(Programmable Logic Device,PLD)(例如现场可编程门阵列(Field Programmable Gate Array,FPGA))就是这样一种集成电路,其逻辑功能由用户对器件编程来确定。由设计人员自行编程来把一个数字系统“集成”在一片PLD上,而不需要请芯片制造厂商来设计和制作专用的集成电路芯片。而且,如今,取代手工地制作集成电路芯片,这种编程也多半改用“逻辑编译器(logic compiler)”软件来实现,它与程序开发撰写时所用的软件编译器相类似,而要编译之前的原始代码也得用特定的编程语言来撰写,此称之为硬件描述语言(Hardware Description Language,HDL),而HDL也并非仅有一种,而是有许多种,如ABEL(Advanced Boolean Expression Language)、AHDL(Altera Hardware Description Language)、Confluence、CUPL(Cornell University Programming Language)、HDCal、JHDL(Java Hardware Description Language)、Lava、Lola、MyHDL、PALASM、RHDL(Ruby Hardware Description Language)等,目前最普遍使用的是VHDL(Very-High-Speed Integrated Circuit Hardware Description Language)与Verilog。本领域技术人员也应该清楚,只需要将方法流程用上述几种硬件描述语言稍作逻辑编程并编程到集成电路中,就可以很容易得到实现该逻辑方法流程的硬件电路。
控制器可以按任何适当的方式实现,例如,控制器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式,控制器的例子包括但不限于以下微控制器:ARC 625D、Atmel AT91SAM、Microchip PIC18F26K20以及Silicone Labs C8051F320,存储器控制器还可以被实现为存储器的控制逻辑的一部分。本领域技术人员也知道,除了以纯计算机可读程序代码方式实现控制器以外,完全可以通过将方法步骤进行逻辑编程来使得控制器以逻辑门、开关、专用集成电路、可编程逻辑控制器和嵌入微控制器等的形式来实现相同功能。因此这种控制器可以被认为是一种硬件部件,而对其内包括的用于实现各种功能的装置也可以视为硬件部件内的结构。或者甚至,可以将用于实现各种功能的装置视为既可以是实现方法的软件模块又可以是硬件部件内的结构。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机。具体的,计算机例如可以为个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任何设备的组合。
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本说明书实施例时可以把各单元的功能在同一个或多个软件和/或硬件中实现。
本领域内的技术人员应明白,本说明书一个或多个实施例可提供为方法、系统或计算机程序产品。因此,本说明书一个或多个实施例可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本说明书可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。
本说明书是参照根据本说明书实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框 或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个......”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
本说明书一个或多个实施例可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本说明书的一个或多个实施例,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
以上所述仅为本文件的实施例而已,并不用于限制本文件。对于本领域技术人员来说,本文件可以有各种更改和变化。凡在本文件的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本文件的权利要求范围之内。

Claims (23)

  1. 一种子程序同步处理方法,应用于远程服务器,包括:
    获取终端设备的本地子程序的触发事件;
    检测所述本地子程序与程序容器内对应的远程子程序的协同状态;所述程序容器安装于所述远程服务器部署的虚拟机;
    若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;
    基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
  2. 根据权利要求1所述的子程序同步处理方法,所述执行所述事件类型对应的事件响应动作,包括:
    若所述事件类型为交互事件类型,根据所述触发事件在所述远程子程序内渲染访问页面;
    若所述事件类型为回退事件类型,判断所述触发事件对应的本地子程序的访问页面是否存在上级页面;
    若存在,根据所述触发事件在所述远程子程序内渲染所述上级页面。
  3. 根据权利要求2所述的子程序同步处理方法,所述执行所述事件类型对应的事件响应动作,还包括:
    若所述事件类型为退出事件类型,向所述程序容器的检测服务同步针对所述本地子程序的退出通知,以记录所述本地子程序的退出状态,并判断页面栈数据是否为空;
    若不为空,根据所述页面栈数据中记录的程序访问顺序,查询并读取所述本地子程序的前一本地子程序的访问页面。
  4. 根据权利要求3所述的子程序同步处理方法,还包括:
    若所述页面栈数据为空,向所述终端设备下发针对所述本地子程序的退出指令,并针对运行所述程序容器的目标虚拟机进行资源释放。
  5. 根据权利要求4所述的子程序同步处理方法,还包括:
    若检测到所述本地子程序从第一访问页面跳转至第二访问页面,并从所述第二访问页面回跳至所述第一访问页面,在所述页面栈数据中删除所述第二访问页面的页面记录。
  6. 根据权利要求1所述的子程序同步处理方法,还包括:
    若所述协同状态为启动同步状态,在虚拟机池中向所述终端设备分配对应的目标虚拟机并进行绑定处理;
    在绑定完成后启动所述目标虚拟机,并基于所述目标虚拟机启动所述程序容器;
    在所述程序容器内运行所述远程子程序,基于所述程序容器针对所述远程子程序进行页面渲染获得访问页面;
    向所述终端设备同步所述访问页面,以在所述本地子程序内进行展示。
  7. 根据权利要求6所述的子程序同步处理方法,所述进行绑定处理,包括:
    将所述终端设备的设备标识与所述目标虚拟机的虚拟机标识进行绑定。
  8. 根据权利要求1所述的子程序同步处理方法,还包括:
    若所述协同状态为本地退出状态,在所述程序容器内退出所述远程子程序的运行,并针对运行所述程序容器的目标虚拟机进行资源释放;
    其中,所述程序容器的检测服务按照预设时间周期向所述终端设备下发检测消息,并在检测到所述本地子程序未响应的检测消息的数目超出预设数目,确定所述协同状态为本地退出状态。
  9. 根据权利要求1所述的子程序同步处理方法,所述触发事件包括所述终端设备拦截并上传的交互事件;所述终端设备在检测到用户触发所述本地子程序配置的交互接口提交的所述交互事件后,对所述交互事件进行拦截。
  10. 根据权利要求1所述的子程序同步处理方法,还包括:
    基于所述程序容器的检测服务检测所述远程子程序的退出事件;
    若所述退出事件为异常退出事件,向所述终端设备同步针对所述本地子程序的退出指令以退出所述本地子程序的运行;
    关闭所述程序容器,并针对向所述终端设备分配的目标虚拟机进行资源释放。
  11. 一种子程序同步处理方法,应用于终端设备,包括:
    检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;
    接收所述远程服务器同步的子程序页面;所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;
    根据所述子程序页面执行针对所述本地子程序的页面更新处理;
    其中,所述程序容器安装于所述远程服务器部署的虚拟机。
  12. 根据权利要求11所述的子程序同步处理方法,所述执行所述触发事件的事件 类型对应的事件响应动作,包括:
    若所述事件类型为交互事件类型,根据所述触发事件在远程子程序内渲染访问页面;
    若所述事件类型为回退事件类型,判断所述触发事件对应的本地子程序的访问页面是否存在上级页面;
    若存在,根据所述触发事件在所述远程子程序内渲染所述上级页面。
  13. 根据权利要求12所述的子程序同步处理方法,所述执行所述触发事件的事件类型对应的事件响应动作,还包括:
    若所述事件类型为退出事件类型,向所述程序容器的检测服务同步针对所述本地子程序的退出通知,以记录所述本地子程序的退出状态,并判断页面栈数据是否为空;
    若不为空,根据所述页面栈数据中记录的程序访问顺序,查询并读取所述本地子程序的前一本地子程序的访问页面。
  14. 根据权利要求11所述的子程序同步处理方法,所述根据所述子程序页面执行针对所述本地子程序的页面更新处理,包括:
    根据所述远程服务器同步的所述本地子程序的访问页面的上级页面更新所述本地子程序的访问页面。
  15. 根据权利要求11所述的子程序同步处理方法,所述根据所述子程序页面执行针对所述本地子程序的页面更新处理,包括:
    根据所述远程服务器同步的所述本地子程序的前一本地子程序的访问页面更新所述本地子程序的访问页面。
  16. 根据权利要求13所述的子程序同步处理方法,还包括:
    若所述页面栈数据为空,接收所述远程服务器下发的针对所述本地子程序的退出指令,并基于所述退出指令退出所述本地子程序的运行。
  17. 根据权利要求11所述的子程序同步处理方法,所述检测本地子程序的触发事件,并将所述触发事件向远程服务器上传,包括:
    获取用户触发所述本地子程序配置的交互接口提交的交互事件;
    将所述交互事件进行拦截,并向所述远程服务器上传。
  18. 一种子程序同步处理装置,运行于远程服务器,包括:
    触发事件获取模块,被配置为获取终端设备的本地子程序的触发事件;
    协同状态检测模块,被配置为检测所述本地子程序与程序容器内对应的远程子程序的协同状态;所述程序容器安装于所述远程服务器部署的虚拟机;
    若所述协同状态为交互同步状态,运行事件类型解析模块,所述事件类型解析模块,被配置为对所述触发事件进行解析获得所述触发事件的事件类型;
    事件响应动作执行模块,被配置为基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
  19. 一种子程序同步处理装置,运行于终端设备,包括:
    触发事件检测模块,被配置为检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;
    子程序页面接收模块,被配置为接收所述远程服务器同步的子程序页面;所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;
    页面更新处理模块,被配置为根据所述子程序页面执行针对所述本地子程序的页面更新处理;其中,所述程序容器安装于所述远程服务器部署的虚拟机。
  20. 一种子程序同步处理设备,包括处理器以及被配置为存储计算机可执行指令的存储器,所述计算机可执行指令在被执行时使所述处理器:
    获取终端设备的本地子程序的触发事件;
    检测所述本地子程序与程序容器内对应的远程子程序的协同状态;所述程序容器安装于远程服务器部署的虚拟机;
    若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;
    基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
  21. 一种子程序同步处理设备,包括处理器以及被配置为存储计算机可执行指令的存储器,所述计算机可执行指令在被执行时使所述处理器:
    检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;
    接收所述远程服务器同步的子程序页面;所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;
    根据所述子程序页面执行针对所述本地子程序的页面更新处理;
    其中,所述程序容器安装于所述远程服务器部署的虚拟机。
  22. 一种存储介质,用于存储计算机可执行指令,所述计算机可执行指令在被处理 器执行时实现以下流程:
    获取终端设备的本地子程序的触发事件;
    检测所述本地子程序与程序容器内对应的远程子程序的协同状态;所述程序容器安装于远程服务器部署的虚拟机;
    若所述协同状态为交互同步状态,对所述触发事件进行解析获得所述触发事件的事件类型;
    基于所述程序容器执行所述事件类型对应的事件响应动作,并将动作执行后获得的子程序页面向所述终端设备同步。
  23. 一种存储介质,用于存储计算机可执行指令,所述计算机可执行指令在被处理器执行时实现以下流程:
    检测本地子程序的触发事件,并将所述触发事件向远程服务器上传;
    接收所述远程服务器同步的子程序页面;所述子程序页面在基于程序容器执行所述触发事件的事件类型对应的事件响应动作后获得;
    根据所述子程序页面执行针对所述本地子程序的页面更新处理;
    其中,所述程序容器安装于所述远程服务器部署的虚拟机。
PCT/CN2023/071370 2022-03-23 2023-01-09 子程序同步处理 WO2023179183A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210287184.9A CN114661483A (zh) 2022-03-23 2022-03-23 子程序同步处理方法及装置
CN202210287184.9 2022-03-23

Publications (1)

Publication Number Publication Date
WO2023179183A1 true WO2023179183A1 (zh) 2023-09-28

Family

ID=82030974

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/071370 WO2023179183A1 (zh) 2022-03-23 2023-01-09 子程序同步处理

Country Status (2)

Country Link
CN (1) CN114661483A (zh)
WO (1) WO2023179183A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114661483A (zh) * 2022-03-23 2022-06-24 支付宝(杭州)信息技术有限公司 子程序同步处理方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2945066A2 (en) * 2014-05-16 2015-11-18 Vodafone IP Licensing limited Controlling a server
CN105827683A (zh) * 2015-09-29 2016-08-03 维沃移动通信有限公司 一种数据同步的方法、服务器及电子设备
CN109857486A (zh) * 2019-02-02 2019-06-07 北京字节跳动网络技术有限公司 一种程序页面数据的处理方法、装置、设备和介质
CN112882709A (zh) * 2021-03-10 2021-06-01 百度在线网络技术(北京)有限公司 基于容器引擎系统的渲染方法、装置、设备以及存储介质
CN113971251A (zh) * 2021-10-28 2022-01-25 深圳市倍思奇创新科技有限公司 网页输出方法、系统及计算机可读存储介质
CN114661483A (zh) * 2022-03-23 2022-06-24 支付宝(杭州)信息技术有限公司 子程序同步处理方法及装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8020177B2 (en) * 2007-07-27 2011-09-13 Composite Ideas, Llc Contained command invocation middleware framework
CN101702766B (zh) * 2009-11-11 2012-05-23 中兴通讯股份有限公司 一种管理视频节目的透明文本框业务的方法及系统
CN110928706B (zh) * 2019-10-30 2023-01-10 北京奇艺世纪科技有限公司 小程序交互方法、装置、电子设备及存储介质
CN111796819A (zh) * 2020-05-19 2020-10-20 北京三快在线科技有限公司 小程序界面生成方法、装置、电子设备及可读存储介质
CN111610978B (zh) * 2020-05-19 2023-06-20 建信金融科技有限责任公司 一种小程序转换方法、装置、设备及存储介质
CN111552945B (zh) * 2020-05-27 2021-12-07 支付宝(杭州)信息技术有限公司 一种资源处理方法、装置及设备

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2945066A2 (en) * 2014-05-16 2015-11-18 Vodafone IP Licensing limited Controlling a server
CN105827683A (zh) * 2015-09-29 2016-08-03 维沃移动通信有限公司 一种数据同步的方法、服务器及电子设备
CN109857486A (zh) * 2019-02-02 2019-06-07 北京字节跳动网络技术有限公司 一种程序页面数据的处理方法、装置、设备和介质
CN112882709A (zh) * 2021-03-10 2021-06-01 百度在线网络技术(北京)有限公司 基于容器引擎系统的渲染方法、装置、设备以及存储介质
CN113971251A (zh) * 2021-10-28 2022-01-25 深圳市倍思奇创新科技有限公司 网页输出方法、系统及计算机可读存储介质
CN114661483A (zh) * 2022-03-23 2022-06-24 支付宝(杭州)信息技术有限公司 子程序同步处理方法及装置

Also Published As

Publication number Publication date
CN114661483A (zh) 2022-06-24

Similar Documents

Publication Publication Date Title
CN108491275B (zh) 程序优化方法、装置、终端及存储介质
US11803451B2 (en) Application exception recovery
EP3567476B1 (en) Application data processing method and apparatus, and storage medium
US20150333971A1 (en) Method and device for managing processes of application program
TW201814510A (zh) 介面移動方法、裝置、智慧型終端機、伺服器和操作系統
CN108932087B (zh) 用于移动设备的桌面分屏系统及其实现方法
CN110300328B (zh) 一种视频播放控制方法、装置及可读存储介质
WO2019100985A1 (zh) 页面处理方法及移动终端
KR102566622B1 (ko) 멀티코어 통신방법, 장치, 전자기기 및 저장매체
US11455075B2 (en) Display method when application is exited and terminal
US11314391B2 (en) Navigation bar controlling method and terminal
CN110019464B (zh) 页面处理方法及装置
CN111597000A (zh) 一种小窗口管理方法及终端
WO2015176352A1 (zh) 一种基于安卓系统的应用间信息交互方法及装置
US20240086231A1 (en) Task migration system and method
CN113268212A (zh) 投屏方法、装置、存储介质及电子设备
WO2023179183A1 (zh) 子程序同步处理
WO2019015491A1 (zh) 应用程序的分身方法、装置、设备和介质
CN113835571A (zh) 一种终端设备、信息展示方法和存储介质
CN114721761A (zh) 一种终端设备、应用图标管理方法和存储介质
US11194598B2 (en) Information display method, terminal and storage medium
CN111324398A (zh) 最近内容的处理方法、装置、终端及存储介质
CN112114804A (zh) 应用程序的生成方法、装置及系统
CN114675786A (zh) 一种大容量存储挂载方法、装置、终端及介质
CN109669764B (zh) 处理方法、装置、设备和机器可读介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 23773435

Country of ref document: EP

Kind code of ref document: A1