CN107104999A - The treating method and apparatus of service interface call request - Google Patents

The treating method and apparatus of service interface call request Download PDF

Info

Publication number
CN107104999A
CN107104999A CN201610099097.5A CN201610099097A CN107104999A CN 107104999 A CN107104999 A CN 107104999A CN 201610099097 A CN201610099097 A CN 201610099097A CN 107104999 A CN107104999 A CN 107104999A
Authority
CN
China
Prior art keywords
service interface
count value
state
fail count
call 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.)
Granted
Application number
CN201610099097.5A
Other languages
Chinese (zh)
Other versions
CN107104999B (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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201610099097.5A priority Critical patent/CN107104999B/en
Publication of CN107104999A publication Critical patent/CN107104999A/en
Application granted granted Critical
Publication of CN107104999B publication Critical patent/CN107104999B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)
  • Telephonic Communication Services (AREA)

Abstract

This application discloses the treating method and apparatus of service interface call request.One embodiment of the processing method of the service interface call request includes:Receiving state that the service interface is obtained when service interface calls instruction;If the state is normal, service interface call request is then sent to the offer end of the service interface by connection pool, and implementing result is waited, wherein, the implementing result includes the response results for providing the service interface call request that end is sent of the service interface;After scheduled time length is waited, if there is no the implementing result, the fail count value of the service interface prestored is updated;If the fail count value after updating is more than predetermined threshold value, the state of the service interface is set to abnormal.This embodiment avoids when service interface is abnormal, the thread for request call service interface takes the connection in connection pool for a long time, and then avoids the occurrence of the seemingly-dead phenomenon of system.

Description

The treating method and apparatus of service interface call request
Technical field
The application is related to field of computer technology, and in particular to technical field of information interaction, especially It is related to the treating method and apparatus of service interface call request.
Background technology
At present, the information exchange between different system is realized typically by service interface is called. Prior art, when calling service interface, is typically that connection is obtained first from connection pool, then Service interface call request is sent to the offer end of service interface by the connection that gets, and waited The response results that return service interface in end is provided of interface to be serviced.
However, when abnormal conditions occurs in the service interface of request call, if using existing skill Art, the thread for request call service interface can take the connection in connection pool for a long time, only In the connection could be returned to connection pool when predetermined time-out time.So as to the relatively company of being easily caused The connection connect in pond is depleted so that other a large amount of threads are waited for, so that occur The seemingly-dead phenomenon of system.
The content of the invention
The purpose of the application is the processing method and dress for proposing a kind of service interface call request Put, to solve the technical problem that background section above is mentioned.
In a first aspect, this application provides a kind of processing method of service interface call request, institute The method of stating includes:Receiving state that the service interface is obtained when service interface calls instruction; If the state is normal, is sent and taken to the offer end of the service interface by connection pool Business interface interchange request, and implementing result is waited, wherein, the implementing result includes the clothes The response results that the service interface call request that end is sent is provided of business interface;It is pre- waiting After length of fixing time, if there is no the implementing result, the service prestored is updated The fail count value of interface;, will if the fail count value after updating is more than predetermined threshold value The state of the service interface is set to abnormal.
In certain embodiments, it is described to be sent by connection pool to the offer end of the service interface Service interface call request, including:Connection is obtained in the connection pool;If pre- first Connection is got in length of fixing time, then provides end hair by described connect to the service interface Take business interface interchange request.
In certain embodiments, the implementing result is additionally included in the company that the connection pool is got Connect;And it is described after scheduled time length is waited, if there is no the implementing result, The fail count value of the service interface prestored is then updated, including:If in the first pre- timing Between do not get connection in length, then update the fail count value of the service interface prestored; Or if the offer end hair of the service interface is not got in the second scheduled time length The response results sent, then update the fail count value of the service interface prestored.
In certain embodiments, methods described also includes:The service interface that need to be called in acquisition After state, if the state is abnormal, unexpected message is sent.
In certain embodiments, it is described after scheduled time length is waited, if there is no institute Implementing result is stated, then updates the fail count value of the service interface prestored, in addition to: Wait after scheduled time length, if there is no the implementing result, send unexpected message.
In certain embodiments, methods described also includes:It is spaced at every predetermined time, by institute The fail count value for stating service interface is reset, and by the state initialization of the service interface for just Often.
Second aspect, this application provides a kind of processing unit of service interface call request, institute Stating device includes:State acquiring unit, for obtaining receiving when service interface calls instruction The state of the service interface;Service interface call request transmitting element, in the state For it is normal when, by offer end from connection pool to the service interface send service interface call please Ask, and wait implementing result, wherein, the implementing result includes the offer of the service interface Hold the response results of the service interface call request sent;Fail count value updating block, For after scheduled time length is waited, if there is no the implementing result, update pre- The fail count value for the service interface deposited;State updating unit, for mistake in the updated When losing count value more than predetermined threshold value, the state of the service interface is set to abnormal.
In certain embodiments, the service interface call request transmitting element, including:Connection Subelement is obtained, for obtaining connection in the connection pool;Service interface call request is sent Subelement, during for getting connection in the first scheduled time length, by it is described connect to The service interface provides end and sends service interface call request.
In certain embodiments, the implementing result is additionally included in the company that the connection pool is got Connect;And the fail count value updating block includes:First fail count value updates subelement, During for not getting connection in the first scheduled time length, the service prestored is updated The fail count value of interface;Second fail count value updates subelement, in the second pre- timing Between when the response results that end is sent are provided of the service interface is not got in length, Update the fail count value of the service interface prestored.
In certain embodiments, described device also includes:Unexpected message transmitting element, for After the state for obtaining the service interface that need to be called, if the state is abnormal, send different Normal message.
In certain embodiments, the fail count value updating block is additionally operable to when waiting scheduled Between after length, if there is no the implementing result, send unexpected message.
In certain embodiments, described device also includes:Initialization unit, for every predetermined Time interval, the fail count value of the service interface is reset, and by the service interface State initialization be normal.
The treating method and apparatus for the service interface call request that the application is provided, by sending After service interface call request, if there is no described hold after the scheduled time length of wait Row result, then update the fail count value of the service interface prestored, and according to renewal after Whether fail count value is more than predetermined threshold value, to update the state of service interface, realizes pair The real-time accurate renewal of service interface state.Meanwhile, by calling finger receiving service interface The state of the service interface is first obtained when showing, if the state is normal, just passes through connection Pond sends service interface call request to the offer end of the service interface, so as to avoid in clothes During interface exception of being engaged in, the thread for request call service interface takes the company in connection pool for a long time Connect, and then avoid the occurrence of the seemingly-dead phenomenon of system.
Brief description of the drawings
Retouched by reading with reference to the detailed of being made to non-limiting example of being made of the following drawings State, other features, objects and advantages will become more apparent upon:
Fig. 1 is that the application can apply to exemplary system architecture figure therein;
Fig. 2 is one embodiment of the processing method of the service interface call request according to the application Flow chart;
Fig. 3 is another implementation of the processing method of the service interface call request according to the application The flow chart of example;
Fig. 4 is one embodiment of the processing unit of the service interface call request according to the application Flow chart;
Fig. 5 is adapted for the department of computer science of the service interface request end for realizing the embodiment of the present application The structural representation of system.
Embodiment
The application is described in further detail with reference to the accompanying drawings and examples.It is appreciated that , specific embodiment described herein is used only for explaining related invention, rather than to the hair Bright restriction.It also should be noted that, illustrate only for the ease of description, in accompanying drawing with About the related part of invention.
It should be noted that in the case where not conflicting, embodiment and embodiment in the application In feature can be mutually combined.Describe this in detail below with reference to the accompanying drawings and in conjunction with the embodiments Application.
Fig. 1, which is shown, can apply the processing method or clothes of the service interface call request of the application The exemplary system architecture 100 of the embodiment of the processing unit of business interface interchange request.
As shown in figure 1, system architecture 100 can include terminal device 101,102,103, Network 104 and server 105.Network 104 is used in the and of terminal device 101,102,103 The medium of communication link is provided between server 105.Network 104 can include various connection classes Type, such as wired, wireless communication link or fiber optic cables etc..
User can pass through network 104 and server 105 with using terminal equipment 101,102,103 Interaction, to receive or send message etc..It can be provided with terminal device 101,102,103 Various client applications, such as browser application, read class application, music class using.
Terminal device 101,102,103 can be the various electronic equipments for supporting information communication, Including but not limited to smart mobile phone, tablet personal computer, notebook computer and desktop computer etc..
Server 105 can be to provide the server of various services, for example terminal device 101, 102nd, on 103 browser application, when reading class application etc. and sending service interface call request, The database server or Cloud Server of service interface are provided above-mentioned application.Server can root The method in service interface is performed according to the service interface call request received, to be stored, The processing such as analysis, and result is fed back into terminal device.
It should be noted that the processing for the service interface call request that the embodiment of the present application is provided Method can be performed by terminal device 101,102,103.Correspondingly, service interface, which is called, asks The processing unit asked can be arranged in terminal device 101,102,103.
It should be understood that the number of the terminal device, network and server in Fig. 1 is only signal Property.According to needs are realized, can have any number of terminal device, network and server.
With continued reference to Fig. 2, Fig. 2 shows the place of the service interface call request according to the application The flow 200 of one embodiment of reason method.
As shown in Fig. 2 the processing method of the service interface call request of the present embodiment is including following Step:
Step 201, shape that above-mentioned service interface is obtained when service interface calls instruction is being received State.
In the present embodiment, the service of the processing method operation of service interface call request thereon Interface requests end (such as the terminal device shown in Fig. 1) can be by from embodied on computer readable The mark that the state for representing above-mentioned service interface is read in storage medium (such as internal memory) comes Obtain the state of above-mentioned service interface.Wherein, service interface is a system and another system Or the Border between people, it is on internet by using a series of standard criterion Different application is supported there is provided grammer interoperability.The system interacted using service interface Corresponding service interface need to be deferred to, without considering respective internal realization, so as to greatly reduce The degree of coupling between interactive system, adds the flexibility of enterprise's application.Service interface for example may be used Think HTTP (Hyper Text Transfer Protocol, HTTP) interface etc..
Step 202, if above-mentioned state is normal, by connection pool to above-mentioned service interface Offer end send service interface call request, and wait implementing result.
Wherein, above-mentioned implementing result includes the above-mentioned service that end is sent that provides of above-mentioned service interface The response results of interface interchange request.In the present embodiment, service interface request end can be first Connection is obtained in above-mentioned connection pool, is then carried by the connection got to above-mentioned service interface Service interface call request is sent for end, implementing result is then waited.Wherein, connection pool is wound Build and manage the technology of the buffer pool of connection, the connection in connection pool be ready to by it is any required it Thread use.When a thread needs transmission service interface to ask and receives response results, It can ask a connection from connection pool, and when this thread, using being over, this is connected (for example Receive response results), the connection will be returned in connection pool, so connection just can be with Its thread is needed to use to use by other.
Step 203, after scheduled time length is waited, if there is no above-mentioned implementing result, Then update the fail count value of the above-mentioned service interface prestored.
In the present embodiment, service interface request end is after scheduled time length is waited, if do not had There is the above-mentioned implementing result of acquisition, it is possible to pass through the storage medium from predetermined embodied on computer readable The primary failure count value of above-mentioned service interface is read in (such as internal memory), then by primary failure meter Numerical value adds 1, and the fail count value after will adding 1 afterwards is write in above-mentioned storage medium.
Step 204, will be above-mentioned if the fail count value after updating is more than predetermined threshold value The state of service interface is set to abnormal.
In the present embodiment, service interface request end can first determine whether the fail count after updating Whether value is more than predetermined threshold value, if it is, by the storage medium of above-mentioned storage state flags In Status Flag be changed to exception.During so as to need to subsequently call above-mentioned service interface, pass through step Rapid 201 can get the abnormal state information of above-mentioned service interface.
In some optional implementations of the present embodiment, the service interface of the present embodiment is called The processing method of request can also include:After step 201, if above-mentioned state is abnormal, Then send unexpected message (for example throwing abnormal).So that service interface calls instruction side to obtain To the message that service interface is abnormal.
In some optional implementations of the present embodiment, step 204 can also include: Wait after scheduled time length, if there is no above-mentioned implementing result, send unexpected message. So that service interface calls instruction side to get corresponding unexpected message.
In some optional implementations of the present embodiment, the service interface of the present embodiment is called The processing method of request can also include:It is spaced at every predetermined time, by above-mentioned service interface Fail count value reset, and be normal by the state initialization of above-mentioned service interface.By this Implementation, solves the problem of state is inaccurate caused by being added up by fail count value is long-term, So that the state of the service interface got is more accurate.
The processing method for the service interface call request that the present embodiment is provided, by sending service After interface interchange request, if there is no above-mentioned execution knot after the scheduled time length of wait Really, then the fail count value of the above-mentioned service interface prestored is updated, and according to the failure after renewal Whether count value is more than predetermined threshold value, to update the state of service interface, realizes to service The real-time accurate renewal of Interface status.Meanwhile, by when receiving service interface and calling instruction First obtain the state of above-mentioned service interface, if above-mentioned state is normal, just by connection pool to The offer end of above-mentioned service interface sends service interface call request, is connect so as to avoid in service When mouth is abnormal, the thread for request call service interface takes the connection in connection pool for a long time, And then avoid the occurrence of the seemingly-dead phenomenon of system.
With further reference to Fig. 3, Fig. 3 is shown according to the service interface call request of the application The flow 300 of another embodiment of processing method.
As shown in figure 3, the processing method of the service interface call request of the present embodiment is including following Step:
Step 301, shape that above-mentioned service interface is obtained when service interface calls instruction is being received State.
In the present embodiment, the specific processing of step 301 refers to walk in Fig. 2 correspondence embodiments Rapid 201 associated description, will not be repeated here.
Step 302, if above-mentioned state is normal, connection is obtained in connection pool, and wait Stay in the connection that above-mentioned connection pool is got.
In the present embodiment, service interface request end obtains the specific processing of connection in connection pool The explanation of the relevant portion of step 202 in Fig. 2 correspondence embodiments is referred to, be will not be repeated here.
Step 303, judge whether to get connection in the first scheduled time length.
In the present embodiment, if getting connection in the first scheduled time length, perform Step 304, step 306 is otherwise performed.
Step 304, service interface is sent to the offer end of above-mentioned service interface by above-mentioned connection Call request, and the above-mentioned service interface for waiting the offer end of above-mentioned service interface to send call please The response results asked.
In the present embodiment, service interface request end by above-mentioned connection to above-mentioned service interface The specific processing for providing end transmission service interface call request refers to walk in Fig. 2 correspondence embodiments The explanation of rapid 202 relevant portion, will not be repeated here.By above-mentioned connection to above-mentioned clothes It is engaged in after the offer end transmission service interface call request of interface, performs step 305.
Step 305, judge whether to get above-mentioned service interface in the second scheduled time length Provide end send response results.
In the present embodiment, if not getting above-mentioned service in the second scheduled time length The above-mentioned response results for providing end transmission of interface, then perform step 306.
Step 306, the fail count value of the above-mentioned service interface prestored is updated, if after updating Fail count value be more than predetermined threshold value, then the state of above-mentioned service interface is set to abnormal.
In the present embodiment, service interface request end can be first by can from predetermined computer The primary failure count value of above-mentioned service interface is read in the storage medium (such as internal memory) of reading, Then primary failure count value is added 1, the fail count value after will adding 1 afterwards writes above-mentioned storage In medium.If the fail count value after plus 1 is more than predetermined threshold value, by above-mentioned storage shape Status Flag in the storage medium of state mark is changed to exception.
From figure 3, it can be seen that compared with the corresponding embodiments of Fig. 2, the clothes in the present embodiment The flow 300 of the processing method of business interface interchange request is not obtained in the first scheduled time length When getting connection, the fail count value of service interface is also updated, and according to the failure meter after renewal The state of numerical value relative set service interface.Thus, the scheme of the present embodiment description can be directed to Obtain and set different respectively less than the response results for connecting and not receiving service interface offer end Time-out time length, so as to more accurately set the state of service interface.
Below with reference to Fig. 4, as the realization to method shown in above-mentioned each figure, this application provides A kind of one embodiment of the processing unit of service interface call request, the device embodiment and figure Embodiment of the method shown in 2 is corresponding, and the device specifically can apply to service interface request end In.
As shown in figure 4, the processing unit 400 for the service interface call request that the present embodiment is provided Including:State acquiring unit 401, service interface call request transmitting element 402, fail count It is worth updating block 403 and state updating unit 404.Wherein, state acquiring unit 401 is used In receiving state that above-mentioned service interface is obtained when service interface calls instruction;Service interface Call request transmitting element 402 be used for above-mentioned state for it is normal when, by connection pool to above-mentioned The offer end of service interface sends service interface call request, and waits implementing result, wherein, The above-mentioned service interface that the offer end that above-mentioned implementing result includes above-mentioned service interface is sent is called please The response results asked;Fail count value updating block 403 is used for after scheduled time length is waited, If there is no above-mentioned implementing result, the fail count of the above-mentioned service interface prestored is updated Value;When the fail count value that state updating unit 404 is used in the updated is more than predetermined threshold value, The state of above-mentioned service interface is set to abnormal.
In the present embodiment, state acquiring unit 401, service interface call request transmitting element 402nd, the specific processing of fail count value updating block 403 and state updating unit 404 can divide Not Can Kao Fig. 2 correspondence embodiment in step 201, step 202, step 203 and step 204 Related description, will not be repeated here.
In some optional implementations of the present embodiment, service interface call request sends single Member 402 can include:Connection obtains subelement 4021, for the company of acquisition in above-mentioned connection pool Connect;Service interface call request transmission sub-unit 4022, in the first scheduled time length When getting connection, provide end to above-mentioned service interface by above-mentioned connection and send service interface tune With request.
In some optional implementations of the present embodiment, above-mentioned implementing result can also include The connection got in above-mentioned connection pool.And, above-mentioned fail count value updating block 203 can With including:First fail count value updates subelement 2031, in the first scheduled time length When inside not getting connection, the fail count value of the above-mentioned service interface prestored is updated;Second Fail count value updates subelement 2032, for not got in the second scheduled time length When providing the above-mentioned response results that end is sent of above-mentioned service interface, updates the above-mentioned service prestored The fail count value of interface.
In some optional implementations of the present embodiment, the service interface of the present embodiment is called The processing unit of request can also include:Unexpected message transmitting element 405, for being needed in acquisition After the state of the service interface called, if above-mentioned state is abnormal, unexpected message is sent. The specific processing of unexpected message transmitting element 405 refers to accordingly realize in Fig. 2 correspondence embodiments The related description of mode, will not be repeated here.
In some optional implementations of the present embodiment, fail count value updating block 403 It can be also used for after scheduled time length is waited, if there is no above-mentioned implementing result, Send unexpected message.The specific processing of the implementation refers to corresponding in Fig. 2 correspondence embodiments The related description of implementation, will not be repeated here.
In some optional implementations of the present embodiment, the service interface of the present embodiment is called The processing unit of request can also include:Initialization unit (not shown), for every pre- Fixed time interval, the fail count value of above-mentioned service interface is reset, and above-mentioned service is connect The state initialization of mouth is normal.The specific processing of initialization unit 406 refers to Fig. 2 correspondences The related description of corresponding implementation, will not be repeated here in embodiment.
The processing unit for the service interface call request that the present embodiment is provided, passes through fail count value Updating block 403 is after service interface call request is sent, if the scheduled time in wait is long There is no above-mentioned implementing result after degree, then update the fail count of the above-mentioned service interface prestored Value, and made a reservation for by state updating unit 404 according to whether the fail count value after renewal is more than Threshold value, to update the state of service interface, realize to the real-time accurate of service interface state Update.Meanwhile, elder generation when service interface calls instruction is being received by state acquiring unit 401 The state of above-mentioned service interface is obtained, and when above-mentioned state is normal, just passes through service interface Call request transmitting element 402 is sent to the offer end of above-mentioned service interface by connection pool and serviced Interface interchange is asked, so as to avoid when service interface is abnormal, is connect for request call service The thread of mouth takes the connection in connection pool for a long time, and then avoids the occurrence of the seemingly-dead phenomenon of system.
Below with reference to Fig. 5, it illustrates suitable for for realizing the service interface of the embodiment of the present application The structural representation of the computer system 500 at demand end.
As shown in figure 5, computer system 500 includes CPU (CPU) 501, its Can according to the program being stored in read-only storage (ROM) 502 or from storage part 508 The program that is loaded into random access storage device (RAM) 503 and perform various appropriate actions And processing.In RAM 503, the system that is also stored with 500 operates required various program sums According to.CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input / output (I/O) interface 505 is also connected to bus 504.
I/O interfaces 505 are connected to lower component:Importation 506 including keyboard, mouse etc.; Including cathode-ray tube (CRT), liquid crystal display (LCD) etc. and loudspeaker etc. Output par, c 507;Storage part 508 including hard disk etc.;And including such as LAN card, The communications portion 509 of the NIC of modem etc..Communications portion 509 is via such as The network of internet performs communication process.Driver 510 is also according to needing to be connected to I/O interfaces 505.Detachable media 511, such as disk, CD, magneto-optic disk, semiconductor memory etc., Be arranged on as needed on driver 510, in order to the computer program that reads from it according to Need to be mounted into storage part 508.
Especially, in accordance with an embodiment of the present disclosure, the process described above with reference to flow chart can be with It is implemented as computer software programs.For example, embodiment of the disclosure includes a kind of computer journey Sequence product, it includes being tangibly embodied in the computer program on machine readable media, above-mentioned meter Calculation machine program bag, which contains, is used for the program code of the method shown in execution flow chart.Implement such In example, the computer program can be downloaded and installed by communications portion 509 from network, And/or be mounted from detachable media 511.In the computer program by CPU (CPU) during 501 execution, the above-mentioned functions limited in the present processes are performed.
Flow chart and block diagram in accompanying drawing, it is illustrated that according to the system of the various embodiments of the application, Architectural framework in the cards, function and the operation of method and computer program product.This point On, each square frame in flow chart or block diagram can represent a module, program segment or code A part, the part of above-mentioned module, program segment or code is used for comprising one or more The executable instruction of logic function as defined in realizing.It should also be noted that being used as replacement at some In realization, the function of being marked in square frame can also be with different from the order marked in accompanying drawing hair It is raw.For example, two square frames succeedingly represented can essentially be performed substantially in parallel, they Sometimes it can also perform in the opposite order, this is depending on involved function.It is also noted that It is, each square frame in block diagram and/or flow chart and the square frame in block diagram and/or flow chart Combination, can be realized with the special hardware based system of defined function or operation is performed, Or can be realized with the combination of specialized hardware and computer instruction.
Being described in unit involved in the embodiment of the present application can be real by way of software It is existing, it can also be realized by way of hardware.Described unit can also be arranged on processing In device, for example, can be described as:A kind of processor includes state acquiring unit, service interface Call request transmitting element, fail count value updating block and state updating unit.Wherein, The title of these units does not constitute the restriction to the unit in itself under certain conditions, for example, State acquiring unit is also described as " obtaining when service interface calls instruction receiving State the unit of the state of service interface ".
As on the other hand, present invention also provides a kind of nonvolatile computer storage media, The nonvolatile computer storage media can be described in above-described embodiment included in device Nonvolatile computer storage media;Can also be individualism, without non-in supplying terminal Volatile computer storage medium.Above-mentioned nonvolatile computer storage media be stored with one or The multiple programs of person, when one or more of programs are performed by an equipment so that described Equipment:Receiving state that the service interface is obtained when service interface calls instruction;If The state is normal, then sends service to the offer end of the service interface by connection pool and connect Mouth call request, and implementing result is waited, wherein, the implementing result connects including the service The response results that the service interface call request that end is sent is provided of mouth;When waiting scheduled Between after length, if there is no the implementing result, update the service interface prestored Fail count value;, will be described if the fail count value after updating is more than predetermined threshold value The state of service interface is set to abnormal.
Above description is only the preferred embodiment of the application and saying to institute's application technology principle It is bright.It will be appreciated by those skilled in the art that invention scope involved in the application, is not limited In the technical scheme of the particular combination of above-mentioned technical characteristic, do not departed from while should cover yet In the case of the inventive concept, it is combined by above-mentioned technical characteristic or its equivalent feature Formed by other technical schemes.Such as features described above and (but not limited to) disclosed herein Technical characteristic with similar functions carries out technical scheme formed by replacement mutually.

Claims (12)

1. a kind of processing method of service interface call request, it is characterised in that methods described bag Include:
Receiving state that the service interface is obtained when service interface calls instruction;
If the state is normal, sent out by connection pool to the offer end of the service interface Business interface interchange request is taken, and waits implementing result, wherein, the implementing result includes institute State the response results that the service interface call request that end is sent is provided of service interface;
After scheduled time length is waited, if there is no the implementing result, update pre- The fail count value for the service interface deposited;
If the fail count value after updating is more than predetermined threshold value, by the service interface State is set to abnormal.
2. according to the method described in claim 1, it is characterised in that it is described by connection pool to The offer end of the service interface sends service interface call request, including:
Connection is obtained in the connection pool;
If getting connection in the first scheduled time length, connected by described to described Service interface provides end and sends service interface call request.
3. method according to claim 2, it is characterised in that the implementing result is also wrapped Include the connection got in the connection pool;And
It is described wait scheduled time length after, if there is no the implementing result, more The fail count value of the service interface newly prestored, including:
If not getting connection in the first scheduled time length, prestore described is updated The fail count value of service interface;Or
If not getting the offer end hair of the service interface in the second scheduled time length The response results sent, then update the fail count value of the service interface prestored.
4. according to any described methods of claim 1-3, it is characterised in that methods described is also Including:
After the state for the service interface that need to be called is obtained, if the state is abnormal, Send unexpected message.
5. according to any described methods of claim 1-3, it is characterised in that described to wait After scheduled time length, if there is no the implementing result, the clothes prestored are updated The fail count value of business interface, in addition to:
After scheduled time length is waited, if there is no the implementing result, send different Normal message.
6. according to any described methods of claim 1-3, it is characterised in that methods described is also Including:
It is spaced at every predetermined time, the fail count value of the service interface is reset, and will The state initialization of the service interface is normal.
7. a kind of processing unit of service interface call request, it is characterised in that described device bag Include:
State acquiring unit, for obtaining the service when service interface calls instruction receiving The state of interface;
Service interface call request transmitting element, for when the state is normal, by even Connect pond and send service interface call request to the offer end of the service interface, and wait pending knot Really, wherein, the implementing result include the service interface provide end send the service The response results of interface interchange request;
Fail count value updating block, for after scheduled time length is waited, if do not obtained The implementing result is obtained, then updates the fail count value of the service interface prestored;
State updating unit, when being more than predetermined threshold value for fail count value in the updated, The state of the service interface is set to abnormal.
8. device according to claim 7, it is characterised in that the service interface is called Request transmitting unit, including:
Connection obtains subelement, for obtaining connection in the connection pool;
Service interface call request transmission sub-unit, for being obtained in the first scheduled time length To connection when, by it is described connect to the service interface provide end send service interface call please Ask.
9. device according to claim 8, it is characterised in that the implementing result is also wrapped Include the connection got in the connection pool;And
The fail count value updating block includes:
First fail count value updates subelement, for not obtained in the first scheduled time length When getting connection, the fail count value of the service interface prestored is updated;
Second fail count value updates subelement, for not obtained in the second scheduled time length When the response results that end is sent are provided of the service interface is got, it is described that renewal prestores The fail count value of service interface.
10. according to any described devices of claim 7-9, it is characterised in that described device Also include:Unexpected message transmitting element, for obtain the state of service interface that need to be called it Afterwards, if the state is abnormal, unexpected message is sent.
11. according to any described devices of claim 7-9, it is characterised in that the failure Count value updating block is additionally operable to after scheduled time length is waited, if there is no described hold Row result, then send unexpected message.
12. according to any described devices of claim 7-9, it is characterised in that described device Also include:Initialization unit, for being spaced at every predetermined time, by the service interface Fail count value is reset, and is normal by the state initialization of the service interface.
CN201610099097.5A 2016-02-23 2016-02-23 Method and device for processing service interface call request Active CN107104999B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610099097.5A CN107104999B (en) 2016-02-23 2016-02-23 Method and device for processing service interface call request

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610099097.5A CN107104999B (en) 2016-02-23 2016-02-23 Method and device for processing service interface call request

Publications (2)

Publication Number Publication Date
CN107104999A true CN107104999A (en) 2017-08-29
CN107104999B CN107104999B (en) 2021-05-25

Family

ID=59658327

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610099097.5A Active CN107104999B (en) 2016-02-23 2016-02-23 Method and device for processing service interface call request

Country Status (1)

Country Link
CN (1) CN107104999B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107562551A (en) * 2017-09-05 2018-01-09 北京小度信息科技有限公司 Monitoring method, device and the computer-readable recording medium of outside access system
CN108021462A (en) * 2017-12-08 2018-05-11 北京百度网讯科技有限公司 Method and apparatus for calling cloud service
CN109343955A (en) * 2018-09-14 2019-02-15 网易无尾熊(杭州)科技有限公司 Recommendation service call method, medium, device and calculating equipment
CN110336856A (en) * 2019-05-10 2019-10-15 成都终身成长科技有限公司 Interface call method, device, electronic equipment and storage medium
CN113419876A (en) * 2021-06-30 2021-09-21 广州华多网络科技有限公司 Remote interface proxy calling method and device, computer equipment and storage medium
CN116048829A (en) * 2022-07-01 2023-05-02 荣耀终端有限公司 Interface calling method, device and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102325148A (en) * 2011-05-25 2012-01-18 重庆新媒农信科技有限公司 WebService service calling method
WO2013097674A1 (en) * 2011-12-28 2013-07-04 北京奇虎科技有限公司 Distributed system and data operation method thereof
CN104239156A (en) * 2013-06-21 2014-12-24 阿里巴巴集团控股有限公司 External service call method and system
CN104270472A (en) * 2014-10-24 2015-01-07 杭州高达软件***股份有限公司 Remote service invocation method, device and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102325148A (en) * 2011-05-25 2012-01-18 重庆新媒农信科技有限公司 WebService service calling method
WO2013097674A1 (en) * 2011-12-28 2013-07-04 北京奇虎科技有限公司 Distributed system and data operation method thereof
CN104239156A (en) * 2013-06-21 2014-12-24 阿里巴巴集团控股有限公司 External service call method and system
CN104270472A (en) * 2014-10-24 2015-01-07 杭州高达软件***股份有限公司 Remote service invocation method, device and system

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107562551A (en) * 2017-09-05 2018-01-09 北京小度信息科技有限公司 Monitoring method, device and the computer-readable recording medium of outside access system
CN108021462A (en) * 2017-12-08 2018-05-11 北京百度网讯科技有限公司 Method and apparatus for calling cloud service
CN108021462B (en) * 2017-12-08 2019-06-04 北京百度网讯科技有限公司 Method and apparatus for calling cloud service
CN109343955A (en) * 2018-09-14 2019-02-15 网易无尾熊(杭州)科技有限公司 Recommendation service call method, medium, device and calculating equipment
CN109343955B (en) * 2018-09-14 2021-03-16 阿里巴巴(中国)有限公司 Recommendation service calling method, medium, device and computing equipment
CN110336856A (en) * 2019-05-10 2019-10-15 成都终身成长科技有限公司 Interface call method, device, electronic equipment and storage medium
CN110336856B (en) * 2019-05-10 2021-11-26 成都终身成长科技有限公司 Interface calling method and device, electronic equipment and storage medium
CN113419876A (en) * 2021-06-30 2021-09-21 广州华多网络科技有限公司 Remote interface proxy calling method and device, computer equipment and storage medium
CN116048829A (en) * 2022-07-01 2023-05-02 荣耀终端有限公司 Interface calling method, device and storage medium
CN116048829B (en) * 2022-07-01 2023-10-10 荣耀终端有限公司 Interface calling method, device and storage medium

Also Published As

Publication number Publication date
CN107104999B (en) 2021-05-25

Similar Documents

Publication Publication Date Title
CN107104999A (en) The treating method and apparatus of service interface call request
US20170060576A1 (en) Rebuildable service-oriented applications
US9081937B2 (en) Systems and methods for managing subscription-based licensing of software products
CN110851253B (en) Remote operation and maintenance method, system, storage medium and electronic equipment
US20230308504A9 (en) Method and system of application development for multiple device client platforms
CN107729139A (en) A kind of method and apparatus for concurrently obtaining resource
CN107341050A (en) Service processing method and device based on dynamic thread pool
CN106686023A (en) Flow designing method, client machine, server side apparatus and system
CN105718313A (en) Application operation method and device
CN107179951A (en) Remote procedure calling (PRC) method and device
CN108845861A (en) The implementation method and device of Softcam
CN109936605A (en) A kind of method and apparatus of loading interface data
US7725818B1 (en) Parallel composition of electronic responses to electronic requests
CN110020349A (en) The method and device of page rendering
CN112817562A (en) Service processing method and device
CN112486482A (en) Page display method and device
CN108123970A (en) Method for exhibiting data and relevant apparatus
CN105354090B (en) Management method and device of virtual equipment
CN107317788A (en) Real time data method for pushing and device
CN110807535A (en) Construction method and construction device of unified reservation platform and unified reservation platform system
CN108076110B (en) Electronic data exchange system and apparatus comprising an electronic data exchange system
CN113242184A (en) Flow control method of distributed architecture and related equipment
CN109981546A (en) The method and apparatus for obtaining the far call relationship between application module
JP2009157786A (en) Message transmission control method, message transmission control device, and message transmission control program
CN105975296A (en) Mobile application upgrading method and device

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