CN106776947A - Resource acquiring method, device and terminal - Google Patents

Resource acquiring method, device and terminal Download PDF

Info

Publication number
CN106776947A
CN106776947A CN201611096423.3A CN201611096423A CN106776947A CN 106776947 A CN106776947 A CN 106776947A CN 201611096423 A CN201611096423 A CN 201611096423A CN 106776947 A CN106776947 A CN 106776947A
Authority
CN
China
Prior art keywords
resource
request
data resource
data
network request
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.)
Pending
Application number
CN201611096423.3A
Other languages
Chinese (zh)
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.)
LeTV Holding Beijing Co Ltd
LeTV Information Technology Beijing Co Ltd
Original Assignee
LeTV Holding Beijing Co Ltd
LeTV Information Technology Beijing 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 LeTV Holding Beijing Co Ltd, LeTV Information Technology Beijing Co Ltd filed Critical LeTV Holding Beijing Co Ltd
Priority to CN201611096423.3A priority Critical patent/CN106776947A/en
Publication of CN106776947A publication Critical patent/CN106776947A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/972Access to data in other repository systems, e.g. legacy data or dynamic Web page generation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

A kind of resource acquiring method, device and terminal are the embodiment of the invention provides, methods described includes:Network request according to receiving determines the destination number of data resource to be obtained;Multiple resource acquisition processes are created, data resource to be obtained is obtained using multiple resource acquisition processes;Data resource, the current quantity of the data resource that statistics has got are got if there is at least one resource acquisition process;If the current quantity is identical with the destination number, the data resource that will currently get is sent to the sender of the network request.The present invention can utilize multiple resource acquisition processes based on message queue to obtain data resource using asynchronous system, any resource acquisition process occur it is unexpected exit wait abnormal when, other resource acquisition processes acquisition data resource is not influenceed, it is ensured that resource acquisition efficiency.

Description

Resource acquiring method, device and terminal
Technical field
The present invention relates to field of computer technology, more particularly to a kind of resource acquiring method, device and terminal.
Background technology
In the prior art, client need from server obtain data resource when, can to server send network request, clothes Business device can obtain corresponding at least one data resource according to network request after network request is received from database, often obtain A data resource is got, the data resource that server will can get returns to client, until the data of client request Resource is all returned.
However, inventor realize it is of the invention during find, this scheme in correlation technique at least exists as follows Shortcoming.When the mode of server by utilizing one process multi-process obtains data resource from database, once occur arbitrary one Or multiple data resources obtain abnormal, may result in program and surprisingly exit, all data resources of network request acquisition request Client will cannot be all returned to, it is low that data resource obtains efficiency.
The content of the invention
To overcome problem present in correlation technique, the present invention to provide a kind of resource acquiring method, device and terminal.
A kind of first aspect according to embodiments of the present invention, there is provided resource acquiring method, including:
Network request according to receiving determines the destination number of data resource to be obtained;
Multiple resource acquisition processes are created, data resource to be obtained is obtained using multiple resource acquisition processes;
Data resource is got if there is at least one resource acquisition process, the data resource that statistics has got is worked as Preceding quantity;
If the current quantity is identical with the destination number, the data resource that will currently get is sent to the net The sender of network request.
Alternatively, methods described also includes:
The request mark of network request according to the network request is generated for unique mark;
The network request is instantiated as to ask object;
The corresponding relation between the request mark and the request object is stored in default object storage region.
The method provided in an embodiment of the present invention, can be according to network request generation request mark, and storage please by network The corresponding relation between the request object and request mark that instantiation is obtained is sought, it is right according to asking in returned data resource to be easy to As determining the attribute informations such as network request interface during returned data, and it is easy to determine corresponding net for the data resource for returning Network is asked.
Alternatively, the data resource for getting carries the request mark of the network request;Methods described also includes:
Data resource is obtained if there is any resource acquisition process to finish, it is determined that the corresponding request of data resource for obtaining Mark;
Using default resources-type generation resource object;
Default resource object array corresponding with the request mark is arrived into resource object storage.
The method provided in an embodiment of the present invention, the data resource that will can be got is instantiated as resource object, and By in each resource object storage to corresponding resource object array, it is easy to count the current quantity of the data resource for getting, And, it is easy to the data resource that will be got together to return to the sender of network request.
Alternatively, the data resource that will currently get is sent to the sender of the network request, including:
Determine the corresponding request mark of network request of data resource to be returned;
Obtain request object corresponding with the request mark and default resource object number corresponding with the request mark Multiple resource objects in group;
Extract the attribute information of the request object;
Multiple resource objects in default resource object array are sent to by the network request according to the attribute information Sender.
The method provided in an embodiment of the present invention, can together be sent to net by the data resource that each network request is asked The sender of network request, it is to avoid take transmission interface for a long time, saves system resource.
Alternatively, methods described also includes:
It is determined that obtaining the initial time of data resource to the resource acquisition duration between current time;
If the resource acquisition duration reaches preset duration, with the presence or absence of not in multiple data resources that judgement gets Complete data resource;
If there is incomplete data resource in the multiple data resources for getting, incomplete data resource is determined Resource identification, the network request is sent to by the resource identification and complete data resource of the incomplete data resource Sender, so that the sender of the network request obtains incomplete data resource again according to the resource identification;
If each data resource for getting is complete, the complete data resource that will currently get is sent to described The sender of network request.
The method provided in an embodiment of the present invention, can be when resource acquisition duration reaches preset duration, what is got When there is incomplete data resource in data resource, the money of the complete data resource of auto-returned and incomplete data resource Source identifies, and when the data resource for getting is all complete, returns to whole complete data resources, can avoid due to network The sender of the situation without normal direction network request of the response timeout such as abnormal sends the situation of the data resource for obtaining, and improves resource and obtains Take efficiency.
A kind of second aspect according to embodiments of the present invention, there is provided resource acquisition device, including:
First determining module, the destination number for determining data resource to be obtained according to the network request for receiving;
Acquisition module is created, for creating multiple resource acquisition processes, obtains to be obtained using multiple resource acquisition processes Data resource;
Statistical module, for getting data resource if there is at least one resource acquisition process, statistics has got Data resource current quantity;
Sending module, if identical with the destination number for the current quantity, the data money that will currently get Source is sent to the sender of the network request.
Alternatively, described device also includes:
First generation module, for the request mark of the network request according to the network request is generated for unique mark Know;
Instantiation module, for being instantiated as the network request to ask object;
First memory module, for stored in default object storage region it is described request mark and it is described request object it Between corresponding relation.
Alternatively, the data resource for getting carries the request mark of the network request;Described device also includes:
Second determining module, finishes for obtaining data resource if there is any resource acquisition process, it is determined that obtain The corresponding request mark of data resource;
Second generation module, for using default resources-type generation resource object;
Second memory module, for resource object storage to be arrived into default resource object corresponding with the request mark Array.
Alternatively, the sending module includes:
Determination sub-module, the corresponding request mark of network request for determining data resource to be returned;
Acquisition submodule, for obtaining request object corresponding with the request mark and asking mark corresponding with described Multiple resource objects in default resource object array;
Extracting sub-module, the attribute information for extracting the request object;
Sending submodule, for being sent the multiple resource objects in default resource object array according to the attribute information To the sender of the network request.
Alternatively, described device also includes:
3rd determining module, during for determining to obtain the initial time of data resource to resource acquisition between current time It is long;
Judge module, if reaching preset duration for the resource acquisition duration, multiple data money that judgement gets Whether there is incomplete data resource in source;
4th determining module, if for there is incomplete data resource in multiple data resources for getting, it is determined that The resource identification of incomplete data resource, by the resource identification of the incomplete data resource and complete data resource hair The sender of the network request is given, so that the sender of the network request cannot not obtain completely again according to the resource identification Whole data resource;
The sending module, if each data resource for being additionally operable to get is complete, the data that will currently get Resource is sent to the sender of the network request.
The third aspect according to embodiments of the present invention, there is provided a kind of terminal, the terminal includes:
Processor;
Memory for storing processor-executable instruction;
Wherein, the processor is configured as:
Network request according to receiving determines the destination number of data resource to be obtained;
Multiple resource acquisition processes are created, data resource to be obtained is obtained using multiple resource acquisition processes;
Data resource is got if there is at least one resource acquisition process, the data resource that statistics has got is worked as Preceding quantity;
If the current quantity is identical with the destination number, the data resource that will currently get is sent to the net The sender of network request.
Fourth aspect according to embodiments of the present invention, the embodiment of the present invention additionally provides that a kind of non-transient computer is readable to deposit Storage media, the non-transient computer readable storage medium storing program for executing stores computer instruction, the computer instruction by make it is described based on Calculation machine performs the resource acquiring method that above-mentioned any one embodiment of first aspect is provided.
5th aspect according to embodiments of the present invention, the embodiment of the present invention additionally provides a kind of computer program product, institute Stating computer program product includes calculation procedure of the storage on non-transient computer readable storage medium storing program for executing, the computer program Including programmed instruction, when described program instruction is computer-executed, the computer is set to perform above-mentioned first aspect any one The resource acquiring method that individual embodiment is provided.
The technical scheme that embodiments of the invention are provided can include the following benefits:
The embodiment of the present invention determines the number of targets of data resource to be obtained by the network request that basis is received first Amount, then creates multiple resource acquisition processes, and data resource to be obtained is obtained using multiple resource acquisition processes, if there is At least one resource acquisition process gets data resource, then counts the current quantity of the data resource for having got, if institute State that current quantity is identical with the destination number, the data resource that will can currently get is sent to the hair of the network request The side of sending.
The method provided in an embodiment of the present invention, can utilize multiple resource acquisition processes to obtain many of network request request Individual data resource, and after all data resources for getting network request acquisition request, the multiple data money that will be got Source is sent to the sender of network request simultaneously, is obtained using asynchronous system using resource acquisition process of the multiple based on message queue Take data resource, any resource acquisition process occur it is unexpected exit wait abnormal when, the acquisition of other resource acquisition processes is not influenceed Data resource, it is ensured that resource acquisition efficiency.
It should be appreciated that the general description of the above and detailed description hereinafter are only exemplary and explanatory, not Can the limitation present invention.
Brief description of the drawings
Accompanying drawing herein is merged in specification and constitutes the part of this specification, shows and meets implementation of the invention Example, and be used to explain principle of the invention together with specification.
Fig. 1 is a kind of flow chart of the resource acquiring method according to an exemplary embodiment;
Fig. 2 is the flow chart of another resource acquiring method according to an exemplary embodiment;
Fig. 3 is the flow chart of another resource acquiring method according to an exemplary embodiment;
Fig. 4 is the flow chart of step S104 in Fig. 1 according to an exemplary embodiment;
Fig. 5 is the flow chart of another resource acquiring method according to an exemplary embodiment;
Fig. 6 is a kind of structure chart of the resource acquisition device according to an exemplary embodiment;
Fig. 7 is a kind of block diagram of the terminal according to an exemplary embodiment.
Specific embodiment
Here exemplary embodiment will be illustrated in detail, its example is illustrated in the accompanying drawings.Following description is related to During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represent same or analogous key element.Following exemplary embodiment Described in implementation method do not represent and the consistent all implementation methods of the present invention.Conversely, they be only with it is such as appended The example of the consistent apparatus and method of some aspects being described in detail in claims, of the invention.
Can be brought together for each scattered functional module in web system by message queue.Architecturally, based on message In the web system of queue, fully decoupled between each functional module, be mutually independent of, that is to say, that the presence of any functional module Other functional modules in web system are not relied on not only, do not know the presence of other functional modules inside each functional module. For example, when some changes are there occurs inside any functional module, such as certain critical data changes, the functional module can be by The message that the critical data changes is sent in message queue, and other are concerned about that the functional module that this critical data changes only is needed Subscribe to this notification message.Because the reason for module is decoupled, other are concerned about the functional module that this critical data changes Can know that the critical data changes by way of waiting notification message, so often asynchronous in code embodiment.
As shown in figure 1, in one embodiment of the invention, there is provided a kind of resource acquiring method, it is applied to based on message In the server of queue, the described method comprises the following steps.
In step S101, the destination number of data resource to be obtained is determined according to the network request for receiving.
In embodiments of the present invention, the network request is used for the data resource of acquisition request at least two.
In this step, server can first receive the network request of client transmission, and net is determined according to network request Network asks corresponding application scenarios, determining corresponding data resource to be obtained according to application scenarios, then counts to be obtained The destination number of data resource, in embodiments of the present invention, each application scenarios corresponding destination number user can match somebody with somebody in advance Put.
In step s 102, multiple resource acquisition processes are created, number to be obtained is obtained using multiple resource acquisition processes According to resource.
In embodiments of the present invention, each resource acquisition process is used in different resource processing subsystems from server Data resource is obtained, is communicated by message queue between multiple resource acquisition processes, be between each resource acquisition process Asynchronous.
In this step, multiple resource acquisition processes can be created after network request is received, it is also possible in system Created at the beginning of foundation, the multiple resource acquisition processes for creating then can be utilized to obtain the data money of network request acquisition request Source, each resource acquisition process can obtain at least one data resource.
In step s 103, data resource is got if there is at least one resource acquisition process, statistics has got Data resource current quantity.
In this step, can first detect whether that resource acquisition process returns to the data resource for getting, if Resource acquisition process returned data resource, can be kept in the data resource that at least one resource acquisition process is returned, example Can such as store in default storage region, then the current quantity of statistics resource.One of ordinary skill in the art can manage Solution, in actual applications, because constantly there is resource acquisition process returned data resource in the guild of persistently entering of program, therefore It is usually different in the current quantity in the same time, not got.
In step S104, if the current quantity is identical with the destination number, the data money that will currently get Source is sent to the sender of the network request.
In this step, the destination number that the current quantity that obtains obtains with step S101 can will be counted first to compare, If current quantity is identical with destination number, the data resource that will can currently get is sent to client.
The embodiment of the present invention determines the number of targets of data resource to be obtained by the network request that basis is received first Amount, then creates multiple resource acquisition processes, and data resource to be obtained is obtained using multiple resource acquisition processes, if there is At least one resource acquisition process gets data resource, then counts the current quantity of the data resource for having got, if institute State that current quantity is identical with the destination number, the data resource that will can currently get is sent to the hair of the network request The side of sending.
The method provided in an embodiment of the present invention, can utilize multiple resource acquisition processes to obtain many of network request request Individual data resource, and after all data resources for getting network request acquisition request, the multiple data money that will be got Source is sent to the sender of network request simultaneously, is obtained using asynchronous system using resource acquisition process of the multiple based on message queue Take data resource, any resource acquisition process occur it is unexpected exit wait abnormal when, the acquisition of other resource acquisition processes is not influenceed Data resource, it is ensured that resource acquisition efficiency.
As shown in Fig. 2 in another embodiment of the present invention, methods described is further comprising the steps of.
In step s 201, according to the network request is generated for unique mark network request request mark.
In this step, because server may simultaneously receive multiple network requests, it is possible to connect for each The network request for receiving generates unique request mark respectively, for example:Req001 or req00A etc., specifically can be according to reality Border situation is set, and the embodiment of the present invention is not limited.
In step S202, the network request is instantiated as to ask object.
In this step, it is possible to use be instantiated as network request to ask object by default class.
In step S203, stored in default object storage region between the request mark and the request object Corresponding relation.
In this step, can store right between multigroup request object and request mark in default object storage region Should be related to, it is also possible to store request object and/or each corresponding request of request object that the instantiation of each network request is obtained Mark and.
The request mark that the embodiment of the present invention passes through the network request according to the network request is generated for unique mark Know, the network request can be instantiated as asking object, and then described asking can be stored in default object storage region Seek the corresponding relation between mark and the request object.
The method provided in an embodiment of the present invention, can be according to network request generation request mark, and storage please by network The corresponding relation between the request object and request mark that instantiation is obtained is sought, it is right according to asking in returned data resource to be easy to As determining the attribute informations such as network request interface during returned data, and it is easy to determine corresponding net for the data resource for returning Network is asked.
As shown in figure 3, in another embodiment of the present invention, methods described is further comprising the steps of.
In step S301, obtain data resource if there is any resource acquisition process and finish, it is determined that the data for obtaining The corresponding request mark of resource.
In embodiments of the present invention, request mark can together return to server with data resource, in order to server Determine the corresponding network request of each data resource, or resource acquisition process sets corresponding request mark, in resource During acquisition process returned data resource, the corresponding request mark of data resource for returning can be both determined.
In step s 302, using default resources-type generation resource object.
In this step, can detect each returned data resource resource acquisition process its return data resource whether Completely, if the data resource of resource acquisition process return is complete, can be using default resources-type establishment data resource correspondence Resource object.
In step S303, default resource object number corresponding with the request mark is arrived into resource object storage Group.
In this step, the resource object that can be obtained by instantiation is stored in default resource object array, In the embodiment of the present invention, presetting the corresponding storage location of resource object array can be and the request corresponding storage region of mark.
The embodiment of the present invention determines the corresponding request mark of data resource for obtaining, if there is any resource acquisition process When acquisition data resource is finished, it is possible to use preset resources-type generation resource object, then can store the resource object To default resource object array corresponding with the request mark.
The method provided in an embodiment of the present invention, the data resource that will can be got is instantiated as resource object, and By in each resource object storage to corresponding resource object array, it is easy to count the current quantity of the data resource for getting, And, it is easy to the data resource that will be got together to return to the sender of network request.
As shown in figure 4, in another embodiment of the present invention, the step S104 is comprised the following steps.
In step S401, the corresponding request mark of network request of data resource to be returned is determined.
In embodiments of the present invention, when it is determined that the data resource obtained required by any network request is all obtained after finishing (the current quantity that namely the corresponding data resource of any network request is obtained is equal to destination number), it may be determined that whole numbers The corresponding request mark of network request finished according to resource acquisition.
In step S402, obtain request object corresponding with the request mark and ask mark corresponding pre- with described If the multiple resource objects in resource object array.
In this step, can be obtained in default object storage region with the request corresponding request object of mark, with Multiple resource objects are obtained in the corresponding default resource object array of request mark.
In step S403, the attribute information of the request object is extracted.
In embodiments of the present invention, attribute information can be including the transmission interface of network request etc..
In this step, because when receiving network request and obtaining the data resource of request, network request is related Contextual information may delete, it is possible to extract attribute in the request object stored in default object storage region Information.
In step s 404, the multiple resource objects in default resource object array are sent to according to the attribute information The sender of the network request.
In this step, it is possible to use the transmission interface of network request provides the multiple in default resource object resource array Source object is sent to client.
The embodiment of the present invention passes through to determine the corresponding request mark of network request of data resource to be returned first, then obtains Take the multiple in request object corresponding with the request mark and default resource object array corresponding with the request mark Resource object, then the attribute information of the request object is extracted, finally can be according to the attribute information by default resource object Multiple resource objects in array are sent to the sender of the network request.
The method provided in an embodiment of the present invention, can together be sent to net by the data resource that each network request is asked The sender of network request, it is to avoid take transmission interface for a long time, saves system resource.
As shown in figure 5, in another embodiment of the present invention, methods described is further comprising the steps of.
In step S501, it is determined that obtaining the initial time of data resource to the resource acquisition duration between current time.
In embodiments of the present invention, obtain data resource initial time can refer to server receive network request when Carve etc., the embodiment of the present invention is not limited.
In this step, server can record the time of reception of network request, Ran Houji when network request is received Record gets current time during data resource, then calculates the time difference between initial time and current time, obtains resource and obtains Take duration.
In step S502, if the resource acquisition duration reaches preset duration, multiple data money that judgement gets Whether there is incomplete data resource in source.
In this step, resource acquisition duration and preset duration can be compared, if resource acquisition duration reaches Preset duration, it may be determined that data acquisition time-out, at this moment may determine that the data resource that multiple resource acquisition processes get With the presence or absence of incomplete data resource, in embodiments of the present invention, whether data resource completely can be by end mark position Judge, it is also possible to judged by the size of data resource etc., do not limited in the embodiment of the present invention.
In step S503, if there is incomplete data resource in the multiple data resources for getting, it is determined that not complete The resource identification of whole data resource, the resource identification and complete data resource of the incomplete data resource are sent to The sender of the network request.
In this step, it is determined that exist in the multiple data resources for getting it is incomplete become estranged resource after, Ke Yisheng Into the resource identification of incomplete data resource, in embodiments of the present invention, resource identification can be with the storage address pair of resource Should, then resource identification is together sent to the sender of network request with the complete data resource for getting.
By step S503, can cannot not obtained completely again according to the resource identification in order to the sender of the network request Whole data resource.
In step S504, if each data resource for getting is complete, the data resource hair that will currently get Give the sender of the network request.
In this step, if all of data resource for getting is complete data resource, can own The data resource for getting is sent to the sender of network request.
When the embodiment of the present invention is by determining to obtain the initial time of data resource to resource acquisition between current time It is long, if the resource acquisition duration reaches preset duration, with the presence or absence of imperfect in multiple data resources that judgement gets Data resource, if there is incomplete data resource in the multiple data resources for getting, determine incomplete data money The resource identification in source, the resource identification and complete data resource of the incomplete data resource are sent into the network please The sender for asking, if each data resource for getting is complete, the complete data resource that will currently get is sent to The sender of the network request.
The method provided in an embodiment of the present invention, can be when resource acquisition duration reaches preset duration, what is got When there is incomplete data resource in data resource, the money of the complete data resource of auto-returned and incomplete data resource Source identifies, and when the data resource for getting is all complete, returns to whole complete data resources, can avoid due to network The sender of the situation without normal direction network request of the response timeout such as abnormal sends the situation of the data resource for obtaining, and improves resource and obtains Take efficiency.
As shown in fig. 6, in another embodiment of the present invention, there is provided a kind of resource acquisition device, including:First determines mould Block 11, establishment acquisition module 12, statistical module 13 and sending module 14.
First determining module 11, the number of targets for determining data resource to be obtained according to the network request for receiving Amount;
Acquisition module 12 is created, for creating multiple resource acquisition processes, is obtained using multiple resource acquisition processes and is waited to obtain The data resource for taking;
Statistical module 13, for getting data resource if there is at least one resource acquisition process, statistics has been obtained The current quantity of the data resource for arriving;
Sending module 14, if identical with the destination number for the current quantity, the data that will currently get Resource is sent to the sender of the network request.
The device provided in an embodiment of the present invention, can utilize multiple resource acquisition processes to obtain many of network request request Individual data resource, and after all data resources for getting network request acquisition request, the multiple data money that will be got Source is sent to the sender of network request simultaneously, is obtained using asynchronous system using resource acquisition process of the multiple based on message queue Take data resource, any resource acquisition process occur it is unexpected exit wait abnormal when, the acquisition of other resource acquisition processes is not influenceed Data resource, it is ensured that resource acquisition efficiency.
In another embodiment of the present invention, described device also includes:
First generation module, for the request mark of the network request according to the network request is generated for unique mark Know;
Instantiation module, for being instantiated as the network request to ask object;
First memory module, for stored in default object storage region it is described request mark and it is described request object it Between corresponding relation.
The device provided in an embodiment of the present invention, can be according to network request generation request mark, and storage please by network The corresponding relation between the request object and request mark that instantiation is obtained is sought, it is right according to asking in returned data resource to be easy to As determining the attribute informations such as network request interface during returned data, and it is easy to determine corresponding net for the data resource for returning Network is asked.
In another embodiment of the present invention, the data resource for getting carries the request mark of the network request;Institute Stating device also includes:
Second determining module, finishes for obtaining data resource if there is any resource acquisition process, it is determined that obtain The corresponding request mark of data resource;
Second generation module, for using default resources-type generation resource object;
Second memory module, for resource object storage to be arrived into default resource object corresponding with the request mark Array.
The device provided in an embodiment of the present invention, the data resource that will can be got is instantiated as resource object, and By in each resource object storage to corresponding resource object array, it is easy to count the current quantity of the data resource for getting, And, it is easy to the data resource that will be got together to return to the sender of network request.
In another embodiment of the present invention, the sending module includes:
Determination sub-module, the corresponding request mark of network request for determining data resource to be returned;
Acquisition submodule, for obtaining request object corresponding with the request mark and asking mark corresponding with described Multiple resource objects in default resource object array;
Extracting sub-module, the attribute information for extracting the request object;
Sending submodule, for being sent the multiple resource objects in default resource object array according to the attribute information To the sender of the network request.
The device provided in an embodiment of the present invention, can together be sent to net by the data resource that each network request is asked The sender of network request, it is to avoid take transmission interface for a long time, saves system resource.
In another embodiment of the present invention, described device also includes:
3rd determining module, during for determining to obtain the initial time of data resource to resource acquisition between current time It is long;
Judge module, if reaching preset duration for the resource acquisition duration, multiple data money that judgement gets Whether there is incomplete data resource in source;
4th determining module, if for there is incomplete data resource in multiple data resources for getting, it is determined that The resource identification of incomplete data resource, by the resource identification of the incomplete data resource and complete data resource hair The sender of the network request is given, so that the sender of the network request cannot not obtain completely again according to the resource identification Whole data resource;
The sending module, if each data resource for being additionally operable to get is complete, the data that will currently get Resource is sent to the sender of the network request.
The device provided in an embodiment of the present invention, can be when resource acquisition duration reaches preset duration, what is got When there is incomplete data resource in data resource, the money of the complete data resource of auto-returned and incomplete data resource Source identifies, and when the data resource for getting is all complete, returns to whole complete data resources, can avoid due to network The sender of the situation without normal direction network request of the response timeout such as abnormal sends the situation of the data resource for obtaining, and improves resource and obtains Take efficiency.
A kind of non-transient computer storage medium is provided in another embodiment of the present invention, the Computer Storage is situated between Matter is stored with computer executable instructions, and the resource that the computer executable instructions can perform in above-mentioned any means embodiment is obtained Take method.
One of ordinary skill in the art will appreciate that all or part of flow in realizing above-described embodiment method, can be The hardware of correlation is instructed to complete by computer program, described program can be stored in a computer read/write memory medium In, the program is upon execution, it may include such as the flow of the embodiment of above-mentioned each method.Wherein, described storage medium can be magnetic Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random AccessMemory, RAM) etc..
Fig. 7 is that the hardware configuration of the electronic equipment of the execution resource acquiring method that the another embodiment of the application is provided is illustrated Figure, as shown in fig. 7, the equipment includes:
One or more processors 710 and memory 720, in Fig. 7 by taking a processor 710 as an example.
The equipment for performing resource acquiring method can also include:Input unit 730 and output device 740.
Processor 710, memory 720, input unit 730 and output device 740 can be by bus or other modes Connection, in Fig. 7 as a example by being connected by bus.
Memory 720 can be used to store non-volatile software journey as a kind of non-volatile computer readable storage medium storing program for executing Sequence, non-volatile computer executable program and module, such as corresponding program of the resource acquiring method in the embodiment of the present application Instruction/module is (for example, the first determining module 11, establishment acquisition module 12, statistical module 13 and sending module shown in accompanying drawing 6 14).Processor 70 is by running the non-volatile software program stored in memory 720, instructing and module, so as to perform The various function application of server and data processing, that is, realize above method embodiment resource acquiring method.
Memory 720 can include storing program area and storage data field, wherein, storing program area can store operation system Application program required for system, at least one function;Storage data field can be stored and created according to using for resource acquisition device Data etc..Additionally, memory 720 can include high-speed random access memory, nonvolatile memory, example can also be included Such as at least one disk memory, flush memory device or other non-volatile solid state memory parts.In certain embodiments, deposit Reservoir 720 is optional including the memory remotely located relative to processor 710, and these remote memories can be by network connection To the processing unit of list items operation.The example of above-mentioned network includes but is not limited to internet, intranet, LAN, shifting Dynamic communication network and combinations thereof.
Input unit 730 can receive the numeral or character information of input, and generation sets with the user of resource acquisition device Put and the input of key signals that function control is relevant.Output device 740 may include the display devices such as display screen.
One or more of modules are stored in the memory 720, when by one or more of processors During 710 execution, the resource acquiring method in above-mentioned any means embodiment is performed.
The method that the executable the embodiment of the present application of the said goods is provided, possesses the corresponding functional module of execution method and has Beneficial effect.Not ins and outs of detailed description in the present embodiment, reference can be made to the method that the embodiment of the present application is provided.
The electronic equipment of the embodiment of the present application exists in a variety of forms, including but not limited to:
(1) mobile communication equipment:The characteristics of this kind equipment is that possess mobile communication function, and to provide speech, data It is main target to communicate.This Terminal Type includes:Smart mobile phone (such as iPhone), multimedia handset, feature mobile phone, and it is low End mobile phone etc..
(2) super mobile personal computer equipment:This kind equipment belongs to the category of personal computer, there is calculating and treatment work( Can, typically also possess mobile Internet access characteristic.This Terminal Type includes:PDA, MID and UMPC equipment etc., such as iPad.
(3) portable entertainment device:This kind equipment can show and play content of multimedia.The kind equipment includes:Audio, Video player (such as iPod), handheld device, e-book, and intelligent toy and portable car-mounted navigation equipment.
(4) server:The equipment for providing the service of calculating, the composition of server includes that processor, hard disk, internal memory, system are total Line etc., server is similar with general computer architecture, but due to needing to provide highly reliable service, therefore in treatment energy The requirement of the aspects such as power, stability, reliability, security, scalability, manageability is higher.
(5) other have the electronic installation of data interaction function.
Device embodiment described above is only schematical, wherein the unit illustrated as separating component can To be or may not be physically separate, the part shown as unit can be or may not be physics list Unit, you can with positioned at a place, or can also be distributed on multiple NEs.It can according to the actual needs be selected In some or all of module realize the purpose of this embodiment scheme.
Through the above description of the embodiments, those skilled in the art can be understood that each implementation method can Realized by the mode of software plus general hardware platform, naturally it is also possible to by hardware.Based on such understanding, above-mentioned technology The part that scheme substantially contributes to correlation technique in other words can be embodied in the form of software product, the computer Software product can be stored in a computer-readable storage medium, and such as ROM/RAM, magnetic disc, CD, including some instructions are used to So that computer equipment (can be personal computer, server, or network equipment etc.) perform each embodiment or Method described in some parts of embodiment.
Finally it should be noted that:Above example is only used to illustrate the technical scheme of the application, rather than its limitations;Although The application has been described in detail with reference to the foregoing embodiments, it will be understood by those within the art that:It still may be used Modified with to the technical scheme described in foregoing embodiments, or equivalent is carried out to which part technical characteristic; And these modification or replace, do not make appropriate technical solution essence depart from each embodiment technical scheme of the application spirit and Scope.

Claims (11)

1. a kind of resource acquiring method, it is characterised in that including:
Network request according to receiving determines the destination number of data resource to be obtained;
Multiple resource acquisition processes are created, data resource to be obtained is obtained using multiple resource acquisition processes;
Data resource, the current number of the data resource that statistics has got are got if there is at least one resource acquisition process Amount;
If the current quantity is identical with the destination number, the data resource that will currently get is sent to the network please The sender for asking.
2. method according to claim 1, it is characterised in that methods described also includes:
The request mark of network request according to the network request is generated for unique mark;
The network request is instantiated as to ask object;
The corresponding relation between the request mark and the request object is stored in default object storage region.
3. method according to claim 2, it is characterised in that what the data resource for getting carried the network request please Seek mark;Methods described also includes:
Data resource is obtained if there is any resource acquisition process to finish, it is determined that the corresponding request mark of the data resource for obtaining Know;
Using default resources-type generation resource object;
Default resource object array corresponding with the request mark is arrived into resource object storage.
4. method according to claim 3, it is characterised in that the data resource that will currently get is sent to described The sender of network request, including:
Determine the corresponding request mark of network request of data resource to be returned;
In acquisition request object corresponding with the request mark and default resource object array corresponding with the request mark Multiple resource objects;
Extract the attribute information of the request object;
Multiple resource objects in default resource object array are sent to the hair of the network request according to the attribute information The side of sending.
5. method according to claim 1, it is characterised in that methods described also includes:
It is determined that obtaining the initial time of data resource to the resource acquisition duration between current time;
If the resource acquisition duration reaches preset duration, with the presence or absence of imperfect in multiple data resources that judgement gets Data resource;
If there is incomplete data resource in the multiple data resources for getting, the resource of incomplete data resource is determined Mark, the transmission of the network request is sent to by the resource identification and complete data resource of the incomplete data resource Side, so that the sender of the network request obtains incomplete data resource again according to the resource identification;
If each data resource for getting is complete, the complete data resource that will currently get is sent to the network The sender of request.
6. a kind of resource acquisition device, it is characterised in that including:
First determining module, the destination number for determining data resource to be obtained according to the network request for receiving;
Acquisition module is created, for creating multiple resource acquisition processes, number to be obtained is obtained using multiple resource acquisition processes According to resource;
Statistical module, for getting data resource, the number that statistics has got if there is at least one resource acquisition process According to the current quantity of resource;
Sending module, if identical with the destination number for the current quantity, the data resource hair that will currently get Give the sender of the network request.
7. device according to claim 6, it is characterised in that described device also includes:
First generation module, for the request mark of the network request according to the network request is generated for unique mark;
Instantiation module, for being instantiated as the network request to ask object;
First memory module, for being stored in default object storage region between the request mark and the request object Corresponding relation.
8. device according to claim 7, it is characterised in that what the data resource for getting carried the network request please Seek mark;Described device also includes:
Second determining module, finishes, it is determined that the data for obtaining for obtaining data resource if there is any resource acquisition process The corresponding request mark of resource;
Second generation module, for using default resources-type generation resource object;
Second memory module, for resource object storage to be arrived into default resource object number corresponding with the request mark Group.
9. device according to claim 8, it is characterised in that the sending module includes:
Determination sub-module, the corresponding request mark of network request for determining data resource to be returned;
Acquisition submodule, for obtaining request object corresponding with the request mark and asking mark corresponding default with described Multiple resource objects in resource object array;
Extracting sub-module, the attribute information for extracting the request object;
Sending submodule, for the multiple resource objects in default resource object array to be sent into institute according to the attribute information State the sender of network request.
10. device according to claim 6, it is characterised in that described device also includes:
3rd determining module, for the initial time that determines to obtain data resource to the resource acquisition duration between current time;
Judge module, if reaching preset duration for the resource acquisition duration, in multiple data resources that judgement gets With the presence or absence of incomplete data resource;
4th determining module, if for there is incomplete data resource in multiple data resources for getting, it is determined that not complete The resource identification of whole data resource, the resource identification and complete data resource of the incomplete data resource are sent to The sender of the network request, so that the sender of the network request obtains incomplete again according to the resource identification Data resource;
The sending module, if each data resource for being additionally operable to get is complete, the data resource that will currently get It is sent to the sender of the network request.
11. a kind of terminals, it is characterised in that the terminal includes:
Processor;
Memory for storing processor-executable instruction;
Wherein, the processor is configured as:
Network request according to receiving determines the destination number of data resource to be obtained;
Multiple resource acquisition processes are created, data resource to be obtained is obtained using multiple resource acquisition processes;
Data resource, the current number of the data resource that statistics has got are got if there is at least one resource acquisition process Amount;
If the current quantity is identical with the destination number, the data resource that will currently get is sent to the network please The sender for asking.
CN201611096423.3A 2016-12-02 2016-12-02 Resource acquiring method, device and terminal Pending CN106776947A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611096423.3A CN106776947A (en) 2016-12-02 2016-12-02 Resource acquiring method, device and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611096423.3A CN106776947A (en) 2016-12-02 2016-12-02 Resource acquiring method, device and terminal

Publications (1)

Publication Number Publication Date
CN106776947A true CN106776947A (en) 2017-05-31

Family

ID=58883011

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611096423.3A Pending CN106776947A (en) 2016-12-02 2016-12-02 Resource acquiring method, device and terminal

Country Status (1)

Country Link
CN (1) CN106776947A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110391927A (en) * 2018-04-20 2019-10-29 华为技术有限公司 A kind of synchronous method of equipment state and public capability component
CN115396681A (en) * 2022-07-06 2022-11-25 苏州达家迎信息技术有限公司 Account management method and device, storage medium and electronic equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2390448A (en) * 2002-07-04 2004-01-07 Dealing Technologies Ltd Locating Resources in a Data Network
CN102710748A (en) * 2012-05-02 2012-10-03 华为技术有限公司 Data acquisition method, system and equipment
CN103488706A (en) * 2013-09-06 2014-01-01 北京东方艾迪普科技发展有限公司 Processing method and device for mass data base
CN104915227A (en) * 2015-05-25 2015-09-16 努比亚技术有限公司 Multi-source and multithread software upgrading method and system
CN105516226A (en) * 2014-09-26 2016-04-20 酷派软件技术(深圳)有限公司 Data download method, data download device, and terminal
CN105847320A (en) * 2016-03-02 2016-08-10 乐视致新电子科技(天津)有限公司 Resource obtaining method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2390448A (en) * 2002-07-04 2004-01-07 Dealing Technologies Ltd Locating Resources in a Data Network
CN102710748A (en) * 2012-05-02 2012-10-03 华为技术有限公司 Data acquisition method, system and equipment
CN103488706A (en) * 2013-09-06 2014-01-01 北京东方艾迪普科技发展有限公司 Processing method and device for mass data base
CN105516226A (en) * 2014-09-26 2016-04-20 酷派软件技术(深圳)有限公司 Data download method, data download device, and terminal
CN104915227A (en) * 2015-05-25 2015-09-16 努比亚技术有限公司 Multi-source and multithread software upgrading method and system
CN105847320A (en) * 2016-03-02 2016-08-10 乐视致新电子科技(天津)有限公司 Resource obtaining method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110391927A (en) * 2018-04-20 2019-10-29 华为技术有限公司 A kind of synchronous method of equipment state and public capability component
US11496564B2 (en) 2018-04-20 2022-11-08 Huawei Cloud Computing Technologies Co., Ltd. Device state synchronization method and common capability component
CN115396681A (en) * 2022-07-06 2022-11-25 苏州达家迎信息技术有限公司 Account management method and device, storage medium and electronic equipment
CN115396681B (en) * 2022-07-06 2024-03-15 苏州达家迎信息技术有限公司 Account management method and device, storage medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN109951547B (en) Transaction request parallel processing method, device, equipment and medium
CN112784989B (en) Inference system, inference method, electronic device, and computer storage medium
US9378437B2 (en) Sending print jobs using trigger distances
CN109636514B (en) Business data processing method and device, computing equipment and storage medium
CN110738479B (en) Order management method and system based on multi-person ordering
CN106470110B (en) Method and device for sending messages to multiple users in user list in group mode
CN109714241A (en) The task processing method of group and the Task Processing Unit of group
CN110007936B (en) Data processing method and device
US20170277526A1 (en) Software categorization method and electronic device
CN108140176A (en) Search result is concurrently identified from the local search and long-range search to communication
CN111858083A (en) Remote service calling method and device, electronic equipment and storage medium
CN106776947A (en) Resource acquiring method, device and terminal
CN104317473A (en) Interface display method and client
CN106708583A (en) Application loading method and device
CN105099727B (en) Add the method and device of group member
CN112187624B (en) Message reply method and device and electronic equipment
US20200326996A1 (en) Method, system, and non-transitory computer-readable record medium for managing event messages and system for presenting conversation thread
CN114520830A (en) Message pushing method, device and system
CN114721755A (en) To-do transaction message processing method and device and storage medium
CN105610698B (en) The treating method and apparatus of event result
CN110909072B (en) Data table establishment method, device and equipment
CN111191143A (en) Application recommendation method and device
CN106469166A (en) A kind of information processing method and device
CN116028696A (en) Resource information acquisition method and device, electronic equipment and storage medium
US11258838B2 (en) Method, system, and non-transitory computer readable record medium for processing chatroom based on usage

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170531

WD01 Invention patent application deemed withdrawn after publication