CN107766101B - Method, device and equipment for processing App starting event - Google Patents

Method, device and equipment for processing App starting event Download PDF

Info

Publication number
CN107766101B
CN107766101B CN201710938915.0A CN201710938915A CN107766101B CN 107766101 B CN107766101 B CN 107766101B CN 201710938915 A CN201710938915 A CN 201710938915A CN 107766101 B CN107766101 B CN 107766101B
Authority
CN
China
Prior art keywords
description file
event
starting
thread
app
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710938915.0A
Other languages
Chinese (zh)
Other versions
CN107766101A (en
Inventor
彭飞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuba Co Ltd
Original Assignee
Wuba Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN201710938915.0A priority Critical patent/CN107766101B/en
Publication of CN107766101A publication Critical patent/CN107766101A/en
Application granted granted Critical
Publication of CN107766101B publication Critical patent/CN107766101B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • 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/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention provides a method, a device and equipment for processing an App starting event, wherein the method comprises the following steps: the method comprises the steps of loading a description file of a starting event, wherein the description file is obtained from a server when an application program (App) is started, the description file is used for identifying the execution sequence of each starting event, and calling each starting event according to the execution sequence indicated by the description file, so that serious online problems of the App can be effectively avoided, and the execution speed is higher than that of a conventional method.

Description

Method, device and equipment for processing App starting event
Technical Field
The embodiment of the invention relates to a communication technology, in particular to a method, a device and equipment for processing an App starting event.
Background
With the widespread use of devices such as mobile phones and computers, Application programs (apps) with various functions have appeared. Each App needs to execute multiple boot events at boot, such as: the start events that the App may need to execute when starting include, but are not limited to, the following tasks: (1) starting or shielding advertisements, (2) starting positioning information, (3) initializing an App User Interface (UI) framework, (4) initializing a database, (5) guiding an App page, (6) loading a third-party Software Development Kit (SDK), (7) preloading data of certain modules in the App, (8) pushing and calling external functions to enter a certain fixed page, (9) entering a home page, … …, and part or all of the start events can be executed by the App.
At present, all the starting events are put into the main thread to be executed, and the execution sequence of the starting events is written to be dead at the App end. During the starting process of the App, a part of starting events need to be offline, for example, App boot pages only appear when the App has new functions and are only displayed within a fixed time period, after the time period, the starting events need to be offline, or newly-accessed third-party SDKs may need to be urgently removed when a major error (bug) occurs or the running environment of the App crashes, and other advertisements such as opening or shielding advertisements are not displayed at any time and need to be online under certain conditions.
Because all the starting events are put in the main thread to be executed, the execution efficiency is low, and moreover, because the execution sequence of the starting events is written to the App end, serious loss is easily caused when some serious online problems are met.
Disclosure of Invention
The embodiment of the invention provides a method, a device and equipment for processing an App starting event, which can effectively solve the problems that all starting events are put in a main thread to be executed and the execution sequence of the starting events is written to be dead at an App end.
In a first aspect, an embodiment of the present invention provides a method for processing an App start event, where the method includes:
loading a description file of a starting event, wherein the description file is obtained from a server when an application program (App) is started, and the description file is used for identifying the execution sequence of each starting event;
and calling each starting event according to the execution sequence indicated by the description file.
In an embodiment of the present invention, the description file includes an identifier of each of the start events and attribute information of the corresponding start event, where the attribute information at least includes a priority and a task dependency;
then, the invoking each of the start events according to the execution sequence indicated by the description file includes:
determining the execution sequence of each starting event according to the priority and the task dependence;
determining a thread task corresponding to each starting event according to the mapping relation between the identifier of the starting event and the thread task class name;
and calling the thread task corresponding to each starting event according to the execution sequence of the starting events.
In an embodiment of the present invention, the attribute information further includes thread indication information, where the thread indication information is used to indicate whether the start event is executed in a main thread;
the invoking of the thread task corresponding to each of the start events according to the execution sequence of the start events includes:
judging whether a first starting event is executed in a main thread or not according to the thread indication information;
if yes, calling a thread task corresponding to the first starting event in the main thread according to the execution sequence of the starting events;
if not, calling the thread task corresponding to the first starting event in the sub-thread according to the execution sequence of the starting events.
In an embodiment of the present invention, the determining, according to the mapping relationship between the identifier of the start event and the thread task class name, the thread task corresponding to each start event includes:
determining the thread task class name corresponding to each starting event according to the mapping relation between the identifier of the starting event and the thread task class name;
and determining the thread task corresponding to each starting event from the instance of the class created by the application programming interface API during the operation of the system according to the thread task class name.
In an embodiment of the present invention, the loading a description file of a start event includes:
analyzing the description file and establishing a data structure corresponding to the description file;
the data structure is an array, the array includes a plurality of elements, each element corresponds to a start event, and the elements include the identifier of the start event and the attribute information.
In an embodiment of the present invention, before the loading the description file of the start event, the method further includes:
when the App is started, sending a request message to a server, wherein the request message comprises a version number of a first description file and the version number of the App, and the first description file is a description file stored in the App;
and receiving a response message sent by the server according to the request message, wherein the response message comprises a second description file and the version number of the second description file, and the second description file is a description file generated after the server updates the first description file.
In an embodiment of the present invention, the loading a description file of a start event includes:
loading the first description file;
and after the first description file is loaded successfully, replacing the first description file with the second description file so as to load the second description file when the App is started next time.
In a second aspect, an embodiment of the present invention provides an apparatus for processing an App start event, including:
the device comprises a loading module, a starting module and a processing module, wherein the loading module is used for loading a description file of a starting event, the description file is obtained from a server when an application program (App) is started, and the description file is used for identifying the execution sequence of each starting event;
and the calling module is used for calling each starting event according to the execution sequence indicated by the description file.
In an embodiment of the present invention, the description file includes an identifier of each of the start events and attribute information of the corresponding start event, where the attribute information at least includes a priority and a task dependency;
the calling module is specifically configured to determine an execution sequence of each of the start events according to the priority and the task dependency; determining a thread task corresponding to each starting event according to the mapping relation between the identifier of the starting event and the thread task class name; and calling the thread task corresponding to each starting event according to the execution sequence of the starting events.
In an embodiment of the present invention, the attribute information further includes thread indication information, where the thread indication information is used to indicate whether the start event is executed in a main thread;
the invoking module invokes the thread task corresponding to each initiating event according to the execution sequence of the initiating events, including:
the calling module judges whether a first starting event is executed in a main thread according to the thread indication information; if yes, calling a thread task corresponding to the first starting event in the main thread according to the execution sequence of the starting events; if not, calling the thread task corresponding to the first starting event in the sub-thread according to the execution sequence of the starting events.
In an embodiment of the present invention, the determining, by the call module, the thread task corresponding to each start event according to a mapping relationship between the identifier of the start event and the thread task class name includes:
the calling module determines the thread task class name corresponding to each starting event according to the mapping relation between the identification of the starting event and the thread task class name; and determining the thread task corresponding to each starting event from the instance of the class created by the application programming interface API during the operation of the system according to the thread task class name.
In an embodiment of the present invention, the load module is specifically configured to parse the description file, and establish a data structure corresponding to the description file;
the data structure is an array, the array includes a plurality of elements, each element corresponds to a start event, and the elements include the identifier of the start event and the attribute information.
In an embodiment of the present invention, the apparatus further includes:
the device comprises a sending module and a receiving module, wherein the sending module is used for sending a request message to a server when the App is started, the request message comprises a version number of a first description file and the version number of the App, and the first description file is a description file stored in the App;
a receiving module, configured to receive a response message sent by the server according to the request message, where the response message includes a second description file and a version number of the second description file, and the second description file is a description file generated after the server updates the first description file.
In an embodiment of the present invention, the loading module is specifically configured to load the first description file; and after the first description file is loaded successfully, replacing the first description file with the second description file so as to load the second description file when the App is started next time.
In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement steps in the method for processing an App start event according to any embodiment of the first aspect.
In a fourth aspect, an embodiment of the present invention provides a terminal device, including: memory, a processor and a computer program, the processor running the computer program to perform the method according to any of the embodiments of the first aspect.
According to the processing method, device and equipment for the App starting event, when the App is started, the terminal loads the description file of the starting event, and calls each starting event according to the execution sequence indicated by the description file.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is an application scenario diagram of a processing method for an App start event according to an embodiment of the present invention;
fig. 2 is a flowchart of a method for processing an App start event according to an embodiment of the present invention;
fig. 3 is a flowchart of a method for processing an App start event according to another embodiment of the present invention;
fig. 4 is a flowchart of a method for processing an App start event according to another embodiment of the present invention;
fig. 5 is a flowchart of a method for processing an App start event according to another embodiment of the present invention;
fig. 6 is a flowchart of a method for processing an App start event according to another embodiment of the present invention;
fig. 7 is a block diagram of a device for processing an App start event according to an embodiment of the present invention;
fig. 8 is a block diagram of a device for processing an App start event according to another embodiment of the present invention;
fig. 9 is a block diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Some terms related to the embodiments of the present invention are explained first:
a start event: events which need to be processed when the App is started through various interfaces, such as starting or shielding advertisements, starting positioning information, initializing a database, initializing an App UI framework, pushing (push) and external calling, guiding evaluation and the like. In the present invention, the start event is in one-to-one correspondence with the thread task as referred to hereinafter.
NSOpreproduction: the method is a set of multi-thread solution provided by apple corporation, and can provide useful and thread-safe operations such as establishment state, priority, task dependence and cancellation for subclasses. The NSoperation is an abstract base class, representing an independent computing unit. In the invention, the independent task started by the App is encapsulated by the subclass of NSoperation.
Task dependence: meaning that in multi-threaded operation, the execution of one thread task depends on the execution results of other thread tasks. In the present invention, the task-dependent program processing can be implemented by the addDependency method encapsulated in the NSOperation. Such as [ operationA addDependency: operationB ] indicates that operationA depends on operationB. Wherein operationA and operationB are instance objects of NSoperation.
Priority: priority (priority) is a parameter that determines the priority of each operating program to receive system resources when the computer time-sharing operating system processes a plurality of operating programs. In the present invention, priority refers to the priority level of thread execution. Priority is distinguished from task dependence in that priority is not necessarily dependent, and thread tasks of high priority can be executed after thread tasks of low priority without generating errors. Task dependency is a necessary relationship that can generate an error if the thread task is executed before the dependent thread task is executed.
NSOperationQueue: is an API for simplified threading provided by apple inc. The NSOperationQueue may be considered a thread pool to which operations (NSOperations) may be added to the queue. The threads in the thread pool may be treated as consumers, take the operation from the queue, and execute it. The NSOperationQueue is divided into a concurrent queue and a serial queue.
Fig. 1 is a schematic view of an application scenario of an App start event processing method provided by an embodiment of the present invention, and as shown in fig. 1, the scenario includes a terminal device, a server 1, and a server 2, where the terminal device includes an App1 and an App2, the App1 is provided by the server 1, and the App2 is provided by the server 2. When the App is started, a plurality of starting events need to be called, and when the App is started each time, the terminal equipment acquires the latest description file for the App from the server, so that the execution sequence of the starting events of the App can be dynamically configured. It should be noted that the terminal device in this scenario may further include more apps with different functions, each App corresponds to one server, different apps may correspond to different servers, or different apps may correspond to the same server, which is not limited in the present invention.
Fig. 2 is a flowchart of a method for processing an App start event according to an embodiment of the present invention. The execution main body of the method is terminal equipment which can be a mobile phone, a computer, an ipad, an intelligent television, a game machine and the like. As shown in fig. 2, the method may include the steps of:
step 101, loading a description file of the starting event, wherein the description file is obtained from a server when the App is started, and the description file is used for identifying the execution sequence of each starting event.
In this embodiment, the server dynamically configures a description file for each App in advance, where one description file is built in the App when the App is packaged, and the description file may be dynamically updated by accessing a server interface, and when the App is started each time, the terminal may load the description file corresponding to the App first, where the description file may be a description file stored in a local cache and acquired by the terminal from the server when the App is started last time, or a description file acquired by the terminal from the server in real time when the App is started this time.
The description file may include attribute information of multiple start events corresponding to the App, where the attribute information may be information of priorities of the start events, task dependencies, indications of whether execution is required on the main thread, execution order, and the like.
And 102, calling each starting event according to the execution sequence indicated by the description file.
In this embodiment, after the terminal loads the description file, the execution sequence of each start event is determined according to the description file, and the start events are sequentially or concurrently invoked according to the execution sequence.
For example: the start events that the App may need to execute when starting include, but are not limited to, the following tasks: (1) the method comprises the steps of (1) starting or shielding advertisements, (2) starting positioning information, (3) initializing an App User Interface (UI) frame, (4) initializing a database, (5) guiding an APP page, (6) loading a third-party Software Development Kit (SDK), (7) preloading data of certain modules in the App, (8) pushing and calling external functions to enter a certain fixed page, and (9) entering a home page. As can be known from the description file, some of the above listed start events need to be executed in the main thread, such as: the starting events (1), (3), (5), (8) and (9) need to be executed in the main thread, and then the terminal calls the starting events (1), (3), (5), (8) and (9) in the main thread; some of the sub-threads can be executed without being executed in the main thread, for example, if the start events (2), (4), (6) and (7) can be executed in the sub-threads, the terminal calls the start events (2), (4), (6) and (7) in the corresponding sub-threads. In the starting event executed by the main thread, a corresponding priority order can be set for each starting event according to the service scene, for example, if the opening or shielding advertisement must be executed before initializing the App UI framework, the priority of the starting event (1) is higher than that of the starting event (3). In addition, the execution of the start event in the main thread may also depend on the execution result of the start event in the sub-thread, such as: the start event (9) must be executed depending on the execution results of the start events (4) and (7), and the execution order can be known from the description file.
According to the processing method of the App starting event, when the App is started, the terminal loads the description file of the starting event, and calls each starting event according to the execution sequence indicated by the description file, because the description file is loaded once when the App is started every time, when an online problem is encountered, the execution sequence of the starting event can be changed by dynamically updating the description file, some loss is avoided, in addition, the execution process capable of describing the starting event in the description file can be used for executing a part of the starting event in the main thread, and a part of the starting event is used for executing in the sub-process, so that the execution efficiency is improved.
Fig. 3 is a flowchart of a method for processing an App start event according to another embodiment of the present invention, and based on the embodiment shown in fig. 2, as shown in fig. 3, an implementation method of step 102 "call each start event according to an execution sequence indicated by a description file" may include the following steps:
step 201, determining the execution sequence of each starting event through the priority and the task dependence.
The description file comprises the identification of each starting event and the attribute information of the corresponding starting event, wherein the attribute information at least comprises priority and task dependence.
In this embodiment, the identifier of each start event is a unique identifier, and the attribute information of each start event at least includes a priority and a task dependency.
When setting the priority, the processing may be performed according to the situations of the protocol version before the ios8.0 system and the protocol version after the ios8.0 system, for example, part of variables of the protocol version before the ios8.0 system and the protocol version after the ios8.0 system are set as follows:
iOS8.0 protocol version before system:
NSOperationQueuePriorityVeryLow=-8L,
NSOperationQueuePriorityLow=-4L,
NSOperationQueuePriorityNormal=0,
NSOperationQueuePriorityHigh=4,
NSOperationQueuePriorityVeryHigh=8
the iOS8.0 system and later protocol versions, by setting quality of service replacement, include:
NSQualityOfServiceUserInteractive=0x21,
NSQualityOfServiceUserInitiated=0x19,
NSQualityOfServiceUtility=0x11,
NSQualityOfServiceBackground=0x09,
NSQualityOfServiceDefault=-1
when the task dependency is set, searching in the allocatedtask dictionary corresponding to the created thread task is needed, and if the thread task on which the first thread task depends is found, setting the task dependency for the first thread task through addDependency. For example, in the sample of the description file, < string > </string > indicates that the start event has no task dependency, and < string > task1</string > indicates that the start event depends on thread task 1.
For example, the description file may be described in the form of code, as follows:
Figure BDA0001426667710000091
Figure BDA0001426667710000101
the above code is a sample description file including attribute information of the start event, and exists in the form of a file. When the App is started, the application program loads the description file first, and establishes a corresponding data structure in the memory for subsequent program call.
It should be emphasized that, in order to reduce the complexity of processing events by the terminal device, the server may put the start event without task dependency in front and the start event with task dependency in back when generating the description file, that is, the start event without task dependency may be set to a lower priority and the start event with task dependency may be set to a higher priority, so that setting task dependency when the terminal device traverses may effectively reduce the complexity of processing.
Step 202, determining the thread task corresponding to each starting event according to the mapping relation between the identification of the starting event and the thread task class name.
In this embodiment, a concurrent task queue may be established according to the execution sequence of the start event, the thread task of the start event is determined according to the mapping relationship between the identifier of the start event and the thread task class name, and the thread task is added to the concurrent task queue. For example, in an iOS operating system, this concurrent task queue is an NSOperationQueue object. And newly establishing a dictionary AllocatedTaskDict, and storing the created thread task in a key-value form, wherein the key is the identifier of the starting event, and the value is the thread task, namely an NSOperation instance.
For another example, in an iOS operating system, each boot event corresponds to a subclass of NSOperation. The terminal device will use a dictionary data structure (taskmappingDict) to store the mapping relationship between the identifier of each start event and the corresponding thread task class name. When running (runtime), the App of the terminal device can find the corresponding thread task class name according to the identifier of the start event in the description file issued by the server, and instantiate the object of the corresponding class according to the thread task class name.
And step 203, calling thread tasks corresponding to the starting events according to the execution sequence of the starting events.
In this embodiment, since each thread task in the concurrent task queue sets attributes that can be relied on by priority and tasks, the terminal device can automatically invoke the thread task in the concurrent task queue according to the attributes of each start event.
For example, in an iOS operating system, thread tasks may be added to a concurrent task queue by executing the add operation method of the NSOperationQueue. Once NSOperation is added to NSOperationQueue, the corresponding thread task is automatically and immediately executed.
According to the processing method of the App start event, the execution sequence of each start event is determined by the priority and the task dependency of each start event in the description file, the thread task corresponding to each start event is determined according to the mapping relation between the identifier of the start event and the thread task class name, and the thread task corresponding to each start event is called according to the execution sequence of the start event. The priority and the task dependence of each starting event are described in the description file, and the terminal can determine the execution sequence of each starting event according to the priority and the task dependence, so that the starting events are called more orderly and reasonably, and the user experience is improved.
Fig. 4 is a flowchart of a method for processing an App start event according to another embodiment of the present invention. On the basis of the embodiment shown in fig. 3, as shown in fig. 4, the implementation manner of "invoking the thread task corresponding to each start event according to the execution sequence of the start event" in step 203 may include the following steps:
step 301, judging whether a first starting event is executed in a main thread or not according to the thread indication information, if so, executing step 302; if not, go to step 303.
In this embodiment, the attribute information further includes thread indication information, and the thread indication information is used to indicate whether the start event is executed in the main thread.
In this embodiment, whether the thread task of each start event is executed by the main thread is determined according to the indication of whether execution in the main thread is required or not, which is described in the description file, for example, in the above-mentioned sample of the description file, < true/>/true indicates that the start event needs to be executed in the main thread, and when the start event is executed, the corresponding thread task is allocated to the main thread for execution; < false/>/false indicates that the corresponding thread task is assigned to the child thread to be executed when the start event is executed, since the execution is not required in the main thread.
Step 302, invoking a thread task corresponding to the first start event in the main thread according to the execution sequence of the start events.
In this embodiment, if it is determined that the first start event is executed in the main thread according to the description file, the thread task corresponding to the first start event is called in the main thread according to the execution sequence of the start events.
And 303, calling a thread task corresponding to the first starting event in the sub-thread according to the execution sequence of the starting events.
In this embodiment, if it is determined that the first start event is not executed in the main thread according to the description file, the thread task corresponding to the first start event is called in the corresponding sub-thread according to the execution order of the start events.
According to the processing method of the App start event provided by the embodiment, whether a first start event is executed in a main thread is judged according to thread indication information, if yes, a thread task corresponding to the first start event is called in the main thread according to the execution sequence of the start event; if not, calling the thread task corresponding to the first starting event in the sub-thread according to the execution sequence of the starting events, so that a plurality of starting events can be executed in parallel in the main thread and the sub-thread, and the execution efficiency is improved.
Fig. 5 is a flowchart of a method for processing an App start event according to another embodiment of the present invention. On the basis of the embodiment shown in fig. 3 or fig. 4, as shown in fig. 5, the implementation manner of the step 202 "determining the thread task corresponding to each start event according to the mapping relationship between the identifier of the start event and the thread task class name" may include the following steps:
step 401, determining a thread task class name corresponding to each start event according to a mapping relationship between the start event identifier and the thread task class name.
In this embodiment, a mapping relationship between the identifier of the start event and the thread task class name may be created in advance, for example, the mapping relationship is stored in the form of the taskmappingditct, and the corresponding thread task class name may be found in the taskmappingditct according to the identifier of the start event.
Step 402, determining a thread task corresponding to each start event from an instance of a class created by an Application Programming Interface (API) during system runtime according to a thread task class name.
In this embodiment, a corresponding thread task class name is found in the taskmapping dit according to the identifier of the start event, and a runtime API provided by the system is called to create an instance of the corresponding class, where the instance is a thread task corresponding to the start event, all start events of the App are traversed, a thread task is determined for each start event, and the thread task is added to the allocatedtask array.
According to the processing method of the App start event provided by the embodiment, the thread task class name corresponding to each start event is determined according to the mapping relation between the identifier of the start event and the thread task class name, the thread task corresponding to each start event is determined from the instance of the class created by the AP during the system operation according to the thread task class name, the thread task of each start event can be determined quickly and conveniently, and the App start is accelerated.
Optionally, on the basis of any of the foregoing embodiments, the step 101 "loading a description file of the start event" includes: analyzing the description file and establishing a data structure corresponding to the description file; the data structure is an array, the array comprises a plurality of elements, each element corresponds to a starting event, and the elements comprise the identification and attribute information of the starting event.
In this embodiment, after the App parses and loads the description file of the start event into the memory, the description file is stored in the memory in a corresponding data structure. The outermost layer of the data structure is an array (TaskArray), each element in the array is a dictionary (TaskInfoDict), each element is of a Map type, namely, the elements correspond to the starting events one by one; the attribute information of the elements in the dictionary corresponding to each starting event comprises priority, task dependence and whether the elements need to be executed in the main thread. The data structure is beneficial to conveniently managing the description file and is beneficial to quickly and efficiently establishing the concurrent task queue.
Fig. 6 is a flowchart of a method for processing an App start event according to another embodiment of the present invention. On the basis of the above embodiment, as shown in fig. 6, before the step 101 "loading the description file of the start event", the method may further include the following steps:
step 501, when the App is started, sending a request message to a server, where the request message includes a version number of a first description file and a version number of the App, and the first description file is a description file stored in the App.
In this embodiment, when App starts, the terminal device requests the server for a description file of the App start event. The parameters to be carried in the request message sent by the terminal device are as follows: version number of the first description file, version number of App. The first description file is a description file stored in a local cache corresponding to an App, the version number of the App refers to the version number of the App in an application store, the version number of one App may correspond to the version numbers of a plurality of description files, that is, when the version of the App is not updated, the description files may be updated.
Step 502, receiving a response message sent by the server according to the request message, where the response message includes a second description file and a version number of the second description file, and the second description file is a description file generated after the server updates the first description file.
In this embodiment, when the server receives the request message, the server compares the version number of the first description file in the request message with the version number of the second description file cached in the server, and if the version number of the second description file is greater than the version number of the first description file, it indicates that the description file is updated, and the server feeds back the updated second description file and the corresponding version number to the terminal device.
The version number of the description file is related to the data of the description file, and if the data content in the description file is updated, the corresponding version number must be updated.
According to the processing method of the App start event, when the App is started, the request message is sent to the server, the response message which is sent by the server according to the request message and comprises the updated description file is received, the description file can be dynamically updated, the online and offline of the App start event are not controlled by the release version, the serious online problem of the App can be avoided, and the safety and reliability of the App start are guaranteed.
Optionally, in this embodiment, as shown in fig. 6, an implementation manner of "loading a description file of a start event" in step 101 may include the following steps:
step 503, loading the first description file.
And step 504, after the first description file is loaded successfully, replacing the first description file with a second description file so that the second description file is loaded when the App is started next time.
In this embodiment, the App may preferentially load the first description file of the start event built in the local cache, the newly updated second description file may be stored in the App first, the old version of the first description file is replaced with the updated second description file, and the second description file is loaded after the App is started next time, so that the start of the App may be effectively prevented from being blocked, and the start speed of the App is increased.
Fig. 7 is a block diagram of an apparatus for processing an App start event according to an embodiment of the present invention, as shown in fig. 5, the apparatus includes:
the loading module 11 is configured to load a description file of the start event, where the description file is a file acquired from a server when an application App is started, and the description file is used to identify an execution sequence of each start event;
the calling module 12 is configured to call each start event according to the execution sequence indicated by the description file.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 2, and the implementation principle and the technical effect are similar, which are not described herein again.
Optionally, on the basis of the embodiment shown in fig. 7, the description file includes an identifier of each start event and attribute information of a corresponding start event, where the attribute information at least includes a priority and a task dependency; the calling module 12 is specifically configured to determine an execution sequence of each start event through priority and task dependency; determining a thread task corresponding to each starting event according to the mapping relation between the identifier of the starting event and the thread task class name; and calling the thread tasks corresponding to the starting events according to the execution sequence of the starting events.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 3, and the implementation principle and the technical effect are similar, which are not described herein again.
Optionally, the attribute information further includes thread indication information, where the thread indication information is used to indicate whether the start event is executed in the main thread; the invoking module 12 invokes the thread task corresponding to each initiating event according to the execution sequence of the initiating events, including:
the calling module 12 judges whether the first starting event is executed in the main thread according to the thread indication information; if so, calling a thread task corresponding to the first starting event in the main thread according to the execution sequence of the starting events; if not, calling the thread task corresponding to the first starting event in the sub-thread according to the execution sequence of the starting events.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 4, and the implementation principle and the technical effect are similar, which are not described herein again.
Optionally, the invoking module 12 determines, according to the mapping relationship between the identifier of the start event and the thread task class name, a thread task corresponding to each start event, including:
the calling module 12 determines the thread task class name corresponding to each starting event according to the mapping relationship between the identifier of the starting event and the thread task class name; and determining the thread task corresponding to each starting event from the instance of the class created by the system runtime API according to the thread task class name.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 5, and the implementation principle and the technical effect are similar, which are not described herein again.
Optionally, the loading module 11 is specifically configured to parse the description file, and establish a data structure corresponding to the description file; the data structure is an array, the array comprises a plurality of elements, each element corresponds to a starting event, and the elements comprise the identification and attribute information of the starting event.
Fig. 8 is a block diagram of an apparatus for processing an App start event according to another embodiment of the present invention, as shown in fig. 8, the apparatus further includes:
the sending module 13 is configured to send a request message to the server when the App is started, where the request message includes a version number of a first description file and a version number of the App, and the first description file is a description file stored in the App;
the receiving module 14 is configured to receive a response message sent by the server according to the request message, where the response message includes a second description file and a version number of the second description file, and the second description file is a description file generated after the server updates the first description file.
Optionally, the loading module 11 is specifically configured to load the first description file; and after the first description file is loaded successfully, replacing the first description file with a second description file so that the second description file is loaded when the App is started next time.
The apparatus of this embodiment may be used to implement the technical solution of the method embodiment shown in fig. 6, and the implementation principle and the technical effect are similar, which are not described herein again.
An embodiment of the present invention further provides a computer-readable storage medium, where one or more programs are stored, and the one or more programs are executable by one or more processors to implement steps in a method for processing an App start event according to any one of fig. 2 to 6.
Fig. 9 is a block diagram of a terminal device according to an embodiment of the present invention, as shown in fig. 9, the terminal device includes a memory 21, a processor 22, and a computer program 23, where the processor runs the computer program to execute the steps in the data information obtaining method according to any one of fig. 2 to fig. 6.
In a Specific implementation of the terminal, it is understood that the Processor may be a Central Processing Unit (CPU), other general purpose processors, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
Those of ordinary skill in the art will understand that: all or a portion of the steps of implementing the above-described method embodiments may be performed by hardware associated with program instructions. The program may be stored in a computer-readable storage medium. When executed, the program performs steps comprising the method embodiments described above; and the aforementioned storage medium includes: various media capable of storing program codes, such as Read-Only Memory (ROM), Random Access Memory (RAM), magnetic disk, or optical disk.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (9)

1. A processing method for an App starting event is characterized by comprising the following steps:
loading a description file of a starting event, wherein the description file is obtained from a server when an application program (App) is started, and the description file is used for identifying the execution sequence of each starting event;
calling each starting event according to the execution sequence indicated by the description file;
the description file comprises the identification of each starting event and the corresponding attribute information of the starting event, wherein the attribute information at least comprises priority and task dependence;
then, the invoking each of the start events according to the execution sequence indicated by the description file includes:
determining the execution sequence of each starting event according to the priority and the task dependence;
determining a thread task corresponding to each starting event according to the mapping relation between the identifier of the starting event and the thread task class name;
and calling the thread task corresponding to each starting event according to the execution sequence of the starting events.
2. The method of claim 1, wherein the attribute information further comprises thread indication information, the thread indication information indicating whether the start event is executed in a main thread;
the invoking of the thread task corresponding to each of the start events according to the execution sequence of the start events includes:
judging whether a first starting event is executed in a main thread or not according to the thread indication information;
if yes, calling a thread task corresponding to the first starting event in the main thread according to the execution sequence of the starting events;
if not, calling the thread task corresponding to the first starting event in the sub-thread according to the execution sequence of the starting events.
3. The method according to claim 1 or 2, wherein the determining, according to the mapping relationship between the identifier of the start event and the thread task class name, the thread task corresponding to each start event comprises:
determining the thread task class name corresponding to each starting event according to the mapping relation between the identifier of the starting event and the thread task class name;
and determining the thread task corresponding to each starting event from the instance of the class created by the application programming interface API during the operation of the system according to the thread task class name.
4. The method of claim 1 or 2, wherein the loading a description file of the start event comprises:
analyzing the description file and establishing a data structure corresponding to the description file;
the data structure is an array, the array includes a plurality of elements, each element corresponds to a start event, and the elements include the identifier of the start event and the attribute information.
5. The method of claim 1 or 2, wherein prior to said loading the description file of the start event, the method further comprises:
when the App is started, sending a request message to a server, wherein the request message comprises a version number of a first description file and the version number of the App, and the first description file is a description file stored in the App;
and receiving a response message sent by the server according to the request message, wherein the response message comprises a second description file and the version number of the second description file, and the second description file is a description file generated after the server updates the first description file.
6. The method of claim 5, wherein loading the description file of the start event comprises:
loading the first description file;
and after the first description file is loaded successfully, replacing the first description file with the second description file so as to load the second description file when the App is started next time.
7. An apparatus for processing App start event, comprising:
the device comprises a loading module, a starting module and a processing module, wherein the loading module is used for loading a description file of a starting event, the description file is obtained from a server when an application program (App) is started, and the description file is used for identifying the execution sequence of each starting event;
the calling module is used for calling each starting event according to the execution sequence indicated by the description file;
the calling module is specifically used for determining the execution sequence of each starting event through priority and task dependence; determining a thread task corresponding to each starting event according to the mapping relation between the identifier of the starting event and the thread task class name; and calling the thread task corresponding to each starting event according to the execution sequence of the starting events.
8. A computer readable storage medium storing one or more programs which are executable by one or more processors to implement the steps in the method for processing App launch events according to any one of claims 1 to 6.
9. A terminal device, comprising: memory, a processor and a computer program, the processor running the computer program to perform the method of any of claims 1-6.
CN201710938915.0A 2017-09-30 2017-09-30 Method, device and equipment for processing App starting event Active CN107766101B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710938915.0A CN107766101B (en) 2017-09-30 2017-09-30 Method, device and equipment for processing App starting event

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710938915.0A CN107766101B (en) 2017-09-30 2017-09-30 Method, device and equipment for processing App starting event

Publications (2)

Publication Number Publication Date
CN107766101A CN107766101A (en) 2018-03-06
CN107766101B true CN107766101B (en) 2021-02-19

Family

ID=61268016

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710938915.0A Active CN107766101B (en) 2017-09-30 2017-09-30 Method, device and equipment for processing App starting event

Country Status (1)

Country Link
CN (1) CN107766101B (en)

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522128B (en) * 2018-11-21 2020-11-13 北京像素软件科技股份有限公司 Segmented multithreading task execution method and device
CN109783158A (en) * 2019-01-14 2019-05-21 深圳市脸萌科技有限公司 Using starting task processing method and device
CN110262847B (en) * 2019-05-14 2022-05-20 百度(中国)有限公司 Application program starting acceleration method and device and machine-readable storage medium
CN110377408B (en) * 2019-07-02 2022-04-12 上海上湖信息技术有限公司 Application program starting method, device, terminal and medium
CN110531985A (en) * 2019-08-09 2019-12-03 浙江大搜车软件技术有限公司 SDK initial method and system, electronic equipment, storage medium
CN112748961A (en) * 2019-10-30 2021-05-04 腾讯科技(深圳)有限公司 Method and device for executing starting task
CN111198725B (en) * 2019-12-30 2023-02-28 掌阅科技股份有限公司 Application starting processing method, computing equipment and computer storage medium
CN111190654B (en) * 2019-12-30 2022-05-03 网易(杭州)网络有限公司 Loading method and device of functional module, storage medium and electronic device
CN111857865A (en) * 2020-06-28 2020-10-30 珠海豹趣科技有限公司 Event type task processing method and device, electronic equipment and storage medium
CN114745272B (en) * 2020-12-23 2023-09-15 武汉斗鱼网络科技有限公司 Method, server, medium and device for improving starting speed of application program
CN112988281B (en) * 2021-04-25 2021-08-03 浙江口碑网络技术有限公司 Application starting method and device
CN113326082A (en) * 2021-07-30 2021-08-31 北京达佳互联信息技术有限公司 Application program starting method, electronic equipment and storage medium
CN114327685B (en) * 2022-01-04 2023-08-11 北京百度网讯科技有限公司 Method and device for optimizing running speed of applet
CN114647460A (en) * 2022-04-18 2022-06-21 中国工商银行股份有限公司 Application program starting method and device
CN115080151B (en) * 2022-07-22 2023-07-14 平安银行股份有限公司 APP starting flow control method, computer readable storage medium and terminal
CN115658185B (en) * 2022-12-29 2023-03-28 北京海誉动想科技股份有限公司 Method and device for quickly starting cloud application, storage medium and electronic equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101296199A (en) * 2008-06-27 2008-10-29 腾讯科技(深圳)有限公司 Method for instant communication tool scheduling task, and instant communication tool
CN105701113B (en) * 2014-11-27 2019-04-09 国际商业机器公司 Method and apparatus for optimizing webpage preloading
CN106339312B (en) * 2015-07-17 2021-01-12 腾讯科技(深圳)有限公司 API test method and system
CN105912455B (en) * 2016-04-27 2018-11-02 努比亚技术有限公司 Business executes method and server

Also Published As

Publication number Publication date
CN107766101A (en) 2018-03-06

Similar Documents

Publication Publication Date Title
CN107766101B (en) Method, device and equipment for processing App starting event
CA2962633C (en) Programmatic event detection and message generation for requests to execute program code
CN108804215B (en) Task processing method and device and electronic equipment
WO2016177341A1 (en) Interface calling method and device, and terminal
CN110659131B (en) Task processing method, electronic device, computer equipment and storage medium
CN105653934B (en) Mobile terminal and application protection method thereof
CN110888658B (en) Method and device for dynamically changing function modules in application program and storage medium
CN107748689B (en) Webpage display method and device
CN112256421A (en) Communication processing method, communication processing device, storage medium and electronic equipment
US8190710B2 (en) System and method for providing user context support in a native transaction platform
CN110324722B (en) Method, device, equipment and storage medium for acquiring data in live broadcast room
US10761863B2 (en) Mobile application management by run-time insertion of a replacement instrumentation object into a mobile application process
CN109408256B (en) Application calling method and device
CN114385351A (en) Cloud management platform load balancing performance optimization method, device, equipment and medium
CN117555570A (en) Service management method and device, electronic equipment and storage medium
US8365194B2 (en) Creating and processing dynamic proxy actions for actions that are not yet registered with a client side broker
US10303523B2 (en) Method and apparatus to migrate stacks for thread execution
US20180373512A1 (en) Method and device for simulating synchronous blocking in asynchronous environment, storage medium, server and terminal
CN110262841B (en) Method and device for enhancing byte codes
CN114721740B (en) Message triggering method, device, equipment and storage medium
CN106708737B (en) Test method and device
CN114237755A (en) Application running method and device, electronic equipment and storage medium
CN114510334A (en) Class instance calling method and device, electronic equipment and automatic driving vehicle
CN114296865A (en) Scheduling method and device of virtual machine thread, electronic equipment and storage medium
CN113064601B (en) Method, device, terminal and storage medium for determining dynamic loading file

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant