Summary of the invention
Embodiments providing a kind of connection management method and connection pool control appliance, setting up the duration that network is connected, the stand-by period of minimizing user, and then the Experience Degree of raising user to shortening client and server.
The connection management method that the embodiment of the present invention provides can comprise:
Connection pool control appliance receives the network connecting request that client is initiated, described network connecting request is used for asking to set up network with server and is connected, described client has established with described connection pool control appliance and has been connected, and described server has established with described connection pool control appliance and has been connected;
Described connection pool control appliance to judge in connection pool whether available free connection, and if so, then the described free time connects and distributes to described client by described connection pool control appliance, and described client is connected based on described idle connection establishment network with described server.
Alternatively, described connection pool control appliance also comprises before receiving the network connecting request of client initiation:
Described connection pool control appliance connects with described client and described server respectively;
Described connection pool control appliance generates N number of free time and connects, and is connected the described N number of free time generated and join in described connection pool, described N be greater than or equal to 1 positive integer.
Alternatively, described method also comprises:
Described connection pool control appliance judges whether length standby time of the free time connection that the non-described connection pool control appliance in described connection pool generates exceedes preset time period, if so, the free time connection that standby time, the long described non-described connection pool control appliance exceeding preset time period generated then is discharged.
Alternatively, described method also comprises:
Described connection pool control appliance judges whether the quantity of the free time connection that the non-described connection pool control appliance in described connection pool generates exceedes default value, if, then discharge the free time connection that K non-described connection pool control appliance generates, described K is the difference between the quantity of the free time connection that the non-described connection pool control appliance in described connection pool generates and default value, and K is positive integer.
Alternatively, described method also comprises:
When the connection of described client and described server disconnects, the described linkage flag disconnected be idle connection by described connection pool control appliance, and the described idle connection of mark is added in connection pool.
The connection pool control appliance that the embodiment of the present invention provides can comprise:
Receiving element, for receiving the network connecting request that client is initiated, described network connecting request is used for asking to set up network with server and is connected, and described client has established with described connection pool control appliance and has been connected, and described server has established with described connection pool control appliance and has been connected;
First judging unit, for judging in connection pool whether available free connection;
Allocation units, if for connection available free in described connection pool, then connect the described free time and distribute to described client, described client is connected based on described idle connection establishment network with described server.
Alternatively, described connection pool control appliance also comprises:
Linkage unit, for connecting with described client and described server respectively;
Generation unit, for generate N number of free time connect, and by generate described N number of free time connect join in described connection pool, described N be greater than or equal to 1 positive integer.
Alternatively, described connection pool control appliance also comprises:
Second judging unit, whether length standby time that the free time that the non-described connection pool control appliance for judging in described connection pool generates connects exceedes preset time period;
First releasing unit, if exceed preset time period for length standby time of the free time connection of the non-described connection pool control appliance generation in described connection pool, then discharge the long free time connection exceeding the described non-described connection pool control appliance generation of preset time period standby time.
Alternatively, described connection pool control appliance also comprises:
3rd judging unit, whether the quantity that the free time that the non-described connection pool control appliance for judging in described connection pool generates connects exceedes default value;
Second releasing unit, if the quantity connected for the free time of the non-described connection pool control appliance generation in described connection pool exceedes default value, then discharge the free time connection that K non-described connection pool control appliance generates, described K is the difference between the quantity of the free time connection that the non-described connection pool control appliance in described connection pool generates and default value, and K is positive integer.
Alternatively, described connection pool control appliance also comprises:
Storage unit, for when the connection of described client and described server disconnects, is idle connection by the described linkage flag disconnected, and is added in connection pool described idle connection of mark.
As can be seen from the above technical solutions, the embodiment of the present invention has the following advantages: connection pool control appliance receives the network connecting request that client is initiated, described network connecting request is used for asking to set up network with server and is connected, described client has established with described connection pool control appliance and has been connected, and described server has established with described connection pool control appliance and has been connected; Described connection pool control appliance to judge in connection pool whether available free connection, and if so, then the described free time connects and distributes to described client by described connection pool control appliance, and described client is connected based on described idle connection establishment network with described server.Like this, when client-requested sets up network connection, connection pool control appliance first can to judge in this connection pool whether available free connection, if, then the connection of this free time directly can be distributed to this client by connection pool control appliance, thus the network set up between client with server is connected, because client is connected by existing idle connection establishment network with server, and connect without the need to re-establishing network, thus client and server can be shortened set up the duration that network is connected, reduce the stand-by period of user, and then improve the Experience Degree of user.
Term " first ", " second ", " the 3rd " " 4th " etc. (if existence) in specification of the present invention and claims and above-mentioned accompanying drawing are for distinguishing similar object, and need not be used for describing specific order or precedence.Should be appreciated that the data used like this can be exchanged in the appropriate case, so as embodiments of the invention described herein such as can with except here diagram or describe those except order implement.In addition, term " comprises " and " having " and their any distortion, intention is to cover not exclusive comprising, such as, contain those steps or unit that the process of series of steps or unit, method, system, product or equipment is not necessarily limited to clearly list, but can comprise clearly do not list or for intrinsic other step of these processes, method, product or equipment or unit.
First refer to Fig. 1, a kind of schematic flow sheet of the connection management method that Fig. 1 provides for the embodiment of the present invention, as shown in Figure 1, an embodiment of the connection management method that the embodiment of the present invention provides can comprise following content:
101, connection pool control appliance receives the network connecting request that client is initiated;
When client need with server carry out network is connected time, client can to connection pool control appliance transmission network connecting request, this connection pool can receive this client initiation network connecting request.
It should be noted that, above-mentioned client has established with above-mentioned connection pool control appliance and has been connected, and above-mentioned server has established with above-mentioned connection pool control appliance and has been connected.
Be understandable that, above-mentioned network connecting request is used for asking to set up network with server and is connected.
Be understandable that, above-mentioned connection pool control appliance can only connect with a client, also can connect with multiple client.
102, connection pool control appliance to judge in connection pool whether available free connection, if so, then performs 103;
After above-mentioned connection pool control appliance receives the network connecting request that above-mentioned client sends, whether available free connection can be judged in connection pool, if so, then performs 103.
Be understandable that, above-mentioned connection pool control appliance is used for carrying out control and management to above-mentioned connection pool, and above-mentioned connection pool can be used for managing the connection between client and server.
103, free time connection is distributed to client by connection pool control appliance, and client is connected based on described idle connection establishment network with server.
If available free connection in above-mentioned connection pool, then this free time can connect and distribute to above-mentioned client by above-mentioned connection pool control appliance, thus makes this client can set up network with above-mentioned server and be connected based on the connection of this free time.
In the present embodiment, connection pool control appliance receives the network connecting request that client is initiated, described network connecting request is used for asking to set up network with server and is connected, described client has established with described connection pool control appliance and has been connected, and described server has established with described connection pool control appliance and has been connected; Described connection pool control appliance to judge in connection pool whether available free connection, and if so, then the described free time connects and distributes to described client by described connection pool control appliance, and described client is connected based on described idle connection establishment network with described server.Like this, when client-requested sets up network connection, connection pool control appliance first can to judge in this connection pool whether available free connection, if, then the connection of this free time directly can be distributed to this client by connection pool control appliance, thus the network set up between client with server is connected, because client is connected by existing idle connection establishment network with server, and connect without the need to re-establishing network, thus client and server can be shortened set up the duration that network is connected, reduce the stand-by period of user, and then improve the Experience Degree of user.
Above-mentioned embodiment illustrated in fig. 1 describe connection pool control appliance receive client send network connecting request after, if available free connection in connection pool, then direct connection this free time distributes to this client, this client can be connected based on this free time and connect with server.In actual applications, before above-mentioned connection pool control appliance receives the network connecting request of above-mentioned client transmission, this connection pool control appliance also can connect with client and server, is described below with a specific embodiment.Refer to Fig. 2, the another kind of schematic flow sheet of the connection management method that Fig. 2 provides for the embodiment of the present invention; As shown in Figure 2, another embodiment that the embodiment of the present invention provides can comprise following content:
201, connection pool control appliance connects with client and server respectively;
When connection pool control appliance starts, above-mentioned client and server can be gone respectively to establish a communications link.
202, connection pool control appliance generates N number of free time connection, and joins in connection pool by N number of idle connection thed generate;
After above-mentioned connection pool control appliance connects with above-mentioned client and server respectively, this connection pool control appliance can generate N number of free time connection, and N number of free time connection of this generation is joined in above-mentioned connection pool, so that when above-mentioned client needs, this free time is connected and distributes to this client.
It should be noted that, above-mentioned N can set according to user's request, N be greater than or equal to 1 positive integer.
203, connection pool control appliance receives the network connecting request that client is initiated;
When client need with server carry out network is connected time, client can to connection pool control appliance transmission network connecting request, this connection pool can receive this client initiation network connecting request.
Be understandable that, above-mentioned network connecting request is used for asking to set up network with server and is connected.
Be understandable that, above-mentioned connection pool control appliance can only connect with a client, also can connect with multiple client.
204, connection pool control appliance to judge in connection pool whether available free connection, if so, then performs 205, if not, then performs 206;
After above-mentioned connection pool control appliance receives the network connecting request that above-mentioned client sends, whether available free connection can be judged in connection pool, if so, then performs 205, if not, then perform 206.
Be understandable that, above-mentioned connection pool control appliance is used for carrying out control and management to above-mentioned connection pool, and above-mentioned connection pool can be used for managing the connection between client and server.
205, free time connection is distributed to client by connection pool control appliance, and client is connected based on described idle connection establishment network with server;
If available free connection in above-mentioned connection pool, then this free time can connect and distribute to above-mentioned client by above-mentioned connection pool control appliance, thus makes this client can set up network with above-mentioned server and be connected based on the connection of this free time.
206, the connection pool control appliance newly-built free time connects, and client is distributed in the connection of newly-built free time, and client is connected based on idle connection establishment network with server.
Newly-built one of above-mentioned connection pool control appliance idle connects, and is connected this newly-built free time and distribute to above-mentioned client, thus makes this client can set up network based on the connection of this free time with above-mentioned server to be connected.
Be understandable that, the connection of newly-built free time also can join in connection pool by above-mentioned connection pool control appliance.
In the present embodiment, above-mentioned connection pool control appliance is after connecting with above-mentioned client and server, N number of free time connection can be generated in advance, and the connection of this free time is joined connection pool, when client need and server set up network be connected time, the free time of this generation can directly connect by above-mentioned connection pool control appliance distributes to this client, make this client can set up network based on the free time connection of this distribution with server to be connected, like this, client needs and server sets up network when being connected, the free time generated can be directly used to connect, and without the need to newly-built, thus client and server can be shortened set up the duration that network is connected, reduce the stand-by period of user, and then improve the Experience Degree of user.
In embodiment shown in above-mentioned Fig. 2, after connection pool control appliance connects with client and server respectively, this connection pool control appliance can generate N number of free time connection, and the connection of the free time of this generation is joined in connection pool, in actual applications, this connection pool control appliance also can being connected client for idle with the linkage flag disconnected between server, and the connection of the free time of this mark is added in connection pool, be described in detail with a specific embodiment below, refer to Fig. 3, the another kind of schematic flow sheet of the connection management method that Fig. 3 provides for the embodiment of the present invention, as shown in Figure 3, another embodiment that the embodiment of the present invention provides can comprise following content:
301, connection pool control appliance connects with client and server respectively;
When connection pool control appliance starts, above-mentioned client and server can be gone respectively to establish a communications link.
302, connection pool control appliance generates N number of free time connection, and joins in connection pool by N number of idle connection thed generate;
After above-mentioned connection pool control appliance connects with above-mentioned client and server respectively, this connection pool control appliance can generate N number of free time connection, and N number of free time connection of this generation is joined in above-mentioned connection pool, so that when above-mentioned client needs, this free time is connected and distributes to this client.
It should be noted that, above-mentioned N can set according to user's request, N be greater than or equal to 1 positive integer.
303, connection pool control appliance receives the network connecting request that client is initiated;
When client need with server carry out network is connected time, client can to connection pool control appliance transmission network connecting request, this connection pool can receive this client initiation network connecting request.
Be understandable that, above-mentioned network connecting request is used for asking to set up network with server and is connected.
Be understandable that, above-mentioned connection pool control appliance can only connect with a client, also can connect with multiple client.
304, connection pool control appliance to judge in connection pool whether available free connection, if so, then performs 305, if not, then performs 307;
After above-mentioned connection pool control appliance receives the network connecting request that above-mentioned client sends, whether available free connection can be judged in connection pool, if so, then performs 305, if not, then perform 307.
Be understandable that, above-mentioned connection pool control appliance is used for carrying out control and management to above-mentioned connection pool, and above-mentioned connection pool can be used for managing the connection between client and server.
305, free time connection is distributed to client by connection pool control appliance, and client is connected based on described idle connection establishment network with server;
If available free connection in above-mentioned connection pool, then this free time can connect and distribute to above-mentioned client by above-mentioned connection pool control appliance, thus makes this client can set up network with above-mentioned server and be connected based on the connection of this free time.
306, when the connection of client and described server disconnects, the linkage flag disconnected be idle connection by connection pool control appliance, and adds in connection pool by the connection of the free time of mark;
When above-mentioned client and above-mentioned server are set up after network is connected and communicates, above-mentioned connection pool control appliance can monitor the connection between above-mentioned client and server, when connection when between above-mentioned client and server disconnects, the linkage flag of this disconnection can be idle connection by above-mentioned connection pool control appliance, and this free time of this mark connection is joined in connection pool, so that the follow-up use of above-mentioned client.
It should be noted that, above-mentioned connection pool control appliance also can be monitored above-mentioned connection pool, whether length standby time of the free time connection that this connection pool control appliance can judge in this connection pool has exceeded preset time period, if length standby time that the free time in this connection pool connects has exceeded preset time period, and the standby time long free time exceeding preset time period connects the free time connection that non-above-mentioned connection pool control appliance generates, then above-mentioned connection pool control appliance can discharge the free time connection that this standby time, the long disconnected pond control appliance exceeding preset time period generated, this preset time period can according to user's request equipment, the span of such as this preset time period can be 2 minutes to 30 minutes.
It should be noted that, above-mentioned connection pool control appliance also can be monitored above-mentioned connection pool, this connection pool control appliance also can judge whether the quantity of the free time connection that this connection pool control appliance non-in this connection pool generates has exceeded default value, if, the free time that then above-mentioned connection pool control appliance release K disconnected pond control appliance generates connects, K is the difference between the quantity of the free time connection that this connection pool control appliance non-in connection pool generates and default value, K is positive integer, this default value also specifically can set according to the performance of the demand of user or this connection pool control appliance, this default value is directly proportional to the performance of user's request amount or this connection pool control appliance, specifically be not construed as limiting herein.
Be understandable that, the free time of above-mentioned connection pool control appliance mark connects the free time connection being above-mentioned disconnected pond control appliance and generating.
307, the connection pool control appliance newly-built free time connects, and client is distributed in the connection of newly-built free time, and client is connected based on idle connection establishment network with server.
Newly-built one of above-mentioned connection pool control appliance idle connects, and is connected this newly-built free time and distribute to above-mentioned client, thus makes this client can set up network based on the connection of this free time with above-mentioned server to be connected.
Be understandable that, the connection of newly-built free time also can join in connection pool by above-mentioned connection pool control appliance.
In the present embodiment, after connection pool control appliance connects with client and server respectively, connection pool control appliance receives the network connecting request that client is initiated, described connection pool control appliance to judge in connection pool whether available free connection, if, then described free time connection is distributed to described client by described connection pool control appliance, and described client is connected based on described idle connection establishment network with described server.Like this, when client-requested sets up network connection, connection pool control appliance first can to judge in this connection pool whether available free connection, if, then the connection of this free time directly can be distributed to this client by connection pool control appliance, thus the network set up between client with server is connected, because client is connected by existing idle connection establishment network with server, and connect without the need to re-establishing network, thus client and server can be shortened set up the duration that network is connected, reduce the stand-by period of user, and then improve the Experience Degree of user, simultaneously, the linkage flag separated with server of client can be connected for idle and join in connection pool by above-mentioned connection pool control appliance, this connection pool control appliance can be monitored connection pool, the free time that long for the standby time disconnected pond control appliance exceeding preset time period generates can be connected and discharge, if the quantity that the free time that in connection pool, disconnected pond control appliance generates connects exceedes default value, this connection pool control appliance also can discharge the free time connection that disconnected pond control appliance in above-mentioned K this connection pool generates, the consumption of connection pool memory space can be reduced like this, and then can economize on resources.
For the ease of understanding, with an embody rule scene, the connection management method that the embodiment of the present invention provides is described in detail below.
When connection pool control appliance starts, can establish a communications link with client and server respectively, this connection pool control appliance can only connect with a client, also can connect with multiple client, such as, connection pool control appliance can establish a communications link with client 1, client 2 and client 3 respectively.After connection pool control appliance starts, this connection pool control appliance can generate N number of free time connection, and this N number of free time connection is joined in connection pool, N be greater than or equal to 1 positive integer, this connection pool control appliance can be used for carrying out control and management to this connection pool, and such as, this connection pool control appliance generates 5 idle connections, be respectively A1, A2, A3, A4, A5, this A1, A2, A3, A4, A5 can add in connection pool by connection pool control appliance.When client needs to establish a communications link with server, such as, client 1 needs to establish a communications link with server, client 1 can send network connecting request to connection pool control appliance, this network connecting request is used for asking to set up network with server and is connected, after above-mentioned connection pool control appliance receives the network connecting request of client 1 transmission, whether available free connection can be judged in above-mentioned connection pool, if, then the connection of this free time is distributed to client 1 by connection pool control appliance, such as, free time in connection pool connects for A1 and A2, then A1 or A2 can be distributed to client 1 by connection pool control appliance, thus make client 1 set up network based on A1 or A2 with server to be connected, if there is no idle connection in above-mentioned connection pool, then this connection pool control appliance can be the newly-built idle connection of client 1, such as, and the newly-built idle connection B1 of this connection pool control appliance, and B1 is distributed to client 1, thus make client 1 can set up network based on B1 with server to be connected.When above-mentioned client and above-mentioned server are set up after network is connected and communicates, above-mentioned connection pool control appliance can monitor the connection between above-mentioned client and server, when connection when between above-mentioned client and server disconnects, the linkage flag of this disconnection can be idle connection by above-mentioned connection pool control appliance, and this free time of this mark connection is joined in connection pool, so that the follow-up use of above-mentioned client, such as, client 1 communicates based on B1 with between server, when B1 disconnects, B1 can be labeled as idle connection by connection pool control appliance, and B1 is joined in connection pool, so that follow-up use.Above-mentioned connection pool control appliance also can be monitored above-mentioned connection pool, whether length standby time of the free time connection that this connection pool control appliance can judge in this connection pool has exceeded preset time period, if length standby time that the free time in this connection pool connects has exceeded preset time period, and the standby time long free time exceeding preset time period connects the free time connection that non-above-mentioned connection pool control appliance generates, then above-mentioned connection pool control appliance can discharge the free time connection that this standby time, the long disconnected pond control appliance exceeding preset time period generated, this preset time period can according to user's request equipment, the span of such as this preset time period can be 2 minutes to 30 minutes.Such as, be connected with in connection pool: A1, A2, A3, A4, A5, B1, B2, B3, B4, free time in connection pool connects: A3, A4, B1 and B2, and length standby time of A3 is 1 minute, and length standby time of A4 is 5 minutes, length standby time of B1 is 6 minutes, length standby time of B2 is 2 minutes, and preset time period is 3 minutes, then the free time exceeding preset time period connects for what B1 of A4, and A4 is the generation of connection pool control appliance, then B1 can discharge by connection pool control appliance.This connection pool control appliance also can judge whether the quantity of the free time connection that this connection pool control appliance non-in this connection pool generates has exceeded default value, if, the free time that then above-mentioned connection pool control appliance release K disconnected pond control appliance generates connects, K is the difference between the quantity of the free time connection that this connection pool control appliance non-in connection pool generates and default value, K is positive integer, such as, be connected with in connection pool: A1, A2, A3, A4, A5, B1, B2, B3, B4, free time in connection pool connects: A3, A4, B1, B2, B3, and B4, default value is 2, A3 and A4 is that connection pool control appliance generates, the quantity that the free time that then in connection pool, disconnected pond control appliance generates connects is 4, then connection pool control appliance can connect B1 by releasing idling, B2, B3, with any two in B4.
Above the connection management method that the embodiment of the present invention provides is described, below the connection pool control appliance that the embodiment of the present invention provides is described.Refer to Fig. 4, a kind of structural representation of the connection pool control appliance that Fig. 4 provides for the embodiment of the present invention, as shown in Figure 4, an embodiment of the connection pool control appliance 400 that the embodiment of the present invention provides can comprise:
Receiving element 401, for receiving the network connecting request that client is initiated, this network connecting request is used for asking to set up network with server and is connected, and this client has established with this connection pool control appliance 400 and has been connected, and this server has established with this connection pool control appliance 400 and has been connected;
First judging unit 402, for judging in connection pool whether available free connection;
Allocation units 403, if for connection available free in this connection pool, then connect this free time and distribute to this client, this client is connected based on this idle connection establishment network with this server.
In the present embodiment, receiving element 401 receives the network connecting request that client is initiated, this network connecting request is used for asking to set up network with server and is connected, and this client has established with this connection pool control appliance 400 and has been connected, and this server has established with this connection pool control appliance 400 and has been connected; First judging unit 402 to judge in connection pool whether available free connection, and if so, then this free time connects and distributes to this client by allocation units 403, and this client is connected based on this idle connection establishment network with this server.Like this, when client-requested sets up network connection, first judging unit 402 first can to judge in this connection pool whether available free connection, if, then the connection of this free time directly can be distributed to this client by allocation units 403, thus the network set up between client with server is connected, because client is connected by existing idle connection establishment network with server, and connect without the need to re-establishing network, thus client and server can be shortened set up the duration that network is connected, reduce the stand-by period of user, and then improve the Experience Degree of user.
Above-mentioned embodiment illustrated in fig. 4 describe receiving element 401 receive client send network connecting request after, if available free connection in connection pool, then the connection of this free time is directly distributed to this client by allocation units 403, this client can be connected based on this free time and connect with server.In actual applications, above-mentioned connection pool control appliance 400 also can comprise other unit, for receive at above-mentioned receiving element 401 above-mentioned client send network connecting request before, connect with client and server, be described with a specific embodiment below.Refer to Fig. 5, the another kind of structural representation of the connection pool control appliance that Fig. 5 provides for the embodiment of the present invention, as shown in Figure 5, another embodiment of the connection pool control appliance 500 that the embodiment of the present invention provides can comprise:
Receiving element 501, for receiving the network connecting request that client is initiated, this network connecting request is used for asking to set up network with server and is connected, and this client has established with this connection pool control appliance 500 and has been connected, and this server has established with this connection pool control appliance 500 and has been connected;
First judging unit 502, for judging in connection pool whether available free connection;
Allocation units 503, if for connection available free in this connection pool, then connect this free time and distribute to this client, this client is connected based on this idle connection establishment network with this server.
The connection pool control appliance 500 that the embodiment of the present invention provides also can comprise:
Linkage unit 505, for connecting with this client and this server respectively;
Generation unit 504, for generate N number of free time connect, and by generate this N number of free time connect join in this connection pool, this N be greater than or equal to 1 positive integer.
In the present embodiment, above-mentioned linkage unit 505 is after connecting with above-mentioned client and server, generation unit 504 can generate N number of free time connection in advance, and the connection of this free time is joined connection pool, when client need and server set up network be connected time, the free time of this generation can directly connect by above-mentioned allocation units 503 distributes to this client, make this client can set up network based on the free time connection of this distribution with server to be connected, like this, client needs and server sets up network when being connected, the free time generated can be directly used to connect, and without the need to newly-built, thus client and server can be shortened set up the duration that network is connected, reduce the stand-by period of user, and then improve the Experience Degree of user.
In embodiment shown in above-mentioned Fig. 5, after connection pool control appliance 500 connects with client and server respectively, this generation unit 504 can generate N number of free time connection, and the connection of the free time of this generation is joined in connection pool, in actual applications, connection pool control appliance 500 also can comprise other unit, for being connected client for idle with the linkage flag disconnected between server, and the connection of the free time of this mark is added in connection pool, be described in detail with a specific embodiment below, refer to Fig. 6, the another kind of structural representation of the connection pool control appliance that Fig. 6 provides for the embodiment of the present invention, as shown in Figure 6, another embodiment of the connection pool control appliance 600 that the embodiment of the present invention provides can comprise:
Receiving element 601, for receiving the network connecting request that client is initiated, this network connecting request is used for asking to set up network with server and is connected, and this client has established with this connection pool control appliance 600 and has been connected, and this server has established with this connection pool control appliance 600 and has been connected;
First judging unit 602, for judging in connection pool whether available free connection;
Allocation units 603, if for connection available free in this connection pool, then connect this free time and distribute to this client, this client is connected based on this idle connection establishment network with this server.
The connection pool control appliance 600 that the embodiment of the present invention provides also can comprise:
Linkage unit 605, for connecting with this client and this server respectively;
Generation unit 604, for generate N number of free time connect, and by generate this N number of free time connect join in this connection pool, this N be greater than or equal to 1 positive integer.
The connection pool control appliance 600 that the embodiment of the present invention provides also can comprise:
Storage unit 606, for when the connection of this client and this server disconnects, is idle connection by this linkage flag disconnected, and this free time of mark connection is added in connection pool.
The connection pool control appliance 600 that the embodiment of the present invention provides also can comprise:
Second judging unit 608, whether length standby time that the free time that the non-generation unit 604 for judging in this connection pool generates connects exceedes preset time period;
First releasing unit 607, if exceed preset time period for length standby time of the free time connection of non-generation unit 604 generation in this connection pool, then discharges the long free time connection exceeding non-this generation unit 604 generation of preset time period standby time.
The connection pool control appliance 600 that the embodiment of the present invention provides also can comprise:
3rd judging unit 609, whether the quantity that the free time that this generation unit 604 non-for judging in this connection pool generates connects exceedes default value;
Second releasing unit 610, if the quantity connected for the free time of this generation unit 604 non-in this connection pool exceedes default value, then discharge the free time connection that K this generation unit 604 non-generates, this K is the difference between the quantity of the free time connection that this generation unit 604 non-in this connection pool generates and default value, and K is positive integer.
Be understandable that, the free time that above-mentioned storage unit 606 marks connects the free time connection being above-mentioned non-generation unit 604 and generating.
In the present embodiment, after linkage unit 605 connects with client and server respectively, receiving element 601 receives the network connecting request that client is initiated, first judging unit 602 to judge in connection pool whether available free connection, if, then the connection of this free time is distributed to described client by allocation units 603, and described client is connected based on described idle connection establishment network with described server.Like this, when client-requested sets up network connection, first judging unit 602 first can to judge in this connection pool whether available free connection, if, then the connection of this free time directly can be distributed to this client by allocation units 603, thus the network set up between client with server is connected, because client is connected by existing idle connection establishment network with server, and connect without the need to re-establishing network, thus client and server can be shortened set up the duration that network is connected, reduce the stand-by period of user, and then improve the Experience Degree of user, simultaneously, the linkage flag separated with server of client can be connected for idle and join in connection pool by above-mentioned storage unit 606, this connection pool control appliance 600 can be monitored connection pool, the free time connection that long for the standby time non-generation unit 604 exceeding preset time period generates can discharge by the first releasing unit 607, if the quantity that the free time that in connection pool, non-generation unit 604 generates connects exceedes default value, this second releasing unit 610 also can discharge the free time connection that non-generation unit 604 in above-mentioned K this connection pool generates, the consumption of connection pool memory space can be reduced like this, and then can economize on resources.
For the ease of understanding, in the connection pool control appliance provided the embodiment of the present invention with an embody rule scene below, each unit is described in detail alternately.
When connection pool control appliance 600 starts, linkage unit 605 can establish a communications link with client and server respectively, this linkage unit 605 can only connect with a client, also can connect with multiple client, such as, linkage unit 605 can establish a communications link with client 1, client 2 and client 3 respectively.After connection pool control appliance 600 starts, this generation unit 604 can generate N number of free time connection, and this N number of free time connection is joined in connection pool, N be greater than or equal to 1 positive integer, this connection pool control appliance 600 can be used for carrying out control and management to this connection pool, and such as, this generation unit 604 generates 5 idle connections, be respectively A1, A2, A3, A4, A5, this A1, A2, A3, A4, A5 can add in connection pool by generation unit 604.When client needs to establish a communications link with server, such as, client 1 needs to establish a communications link with server, client 1 can send network connecting request to receiving element 601, this network connecting request is used for asking to set up network with server and is connected, after above-mentioned receiving element 601 receives the network connecting request of client 1 transmission, first judging unit 602 can to judge in above-mentioned connection pool whether available free connection, if, then the connection of this free time is distributed to client 1 by allocation units 603, such as, free time in connection pool connects for A1 and A2, then connect allocation units 603 and A1 or A2 can be distributed to client 1, thus make client 1 set up network based on A1 or A2 with server to be connected, if there is no idle connection in above-mentioned connection pool, then this connection pool control appliance 600 can be the newly-built idle connection of client 1, such as, the newly-built idle connection B1 of this connection pool control appliance 600, and B1 is distributed to client 1, thus make client 1 can set up network based on B1 with server to be connected.When above-mentioned client and above-mentioned server are set up after network is connected and communicates, above-mentioned connection pool control appliance 600 can monitor the connection between above-mentioned client and server, when connection when between above-mentioned client and server disconnects, the linkage flag of this disconnection can be idle connection by above-mentioned storage unit 606, and this free time of this mark connection is joined in connection pool, so that the follow-up use of above-mentioned client, such as, client 1 communicates based on B1 with between server, when B1 disconnects, B1 can be labeled as idle connection by storage unit 606, and B1 is joined in connection pool, so that follow-up use.Above-mentioned connection pool control appliance 600 also can be monitored above-mentioned connection pool, whether length standby time of the free time connection that the second judging unit 608 can judge in this connection pool has exceeded preset time period, if length standby time that the free time in this connection pool connects has exceeded preset time period, and the standby time long free time exceeding preset time period connects the free time connection that non-above-mentioned generation unit 604 generates, then the first releasing unit 607 can discharge the free time connection that this standby time, the long non-generation unit 604 exceeding preset time period generated, this preset time period can according to user's request equipment, the span of such as this preset time period can be 2 minutes to 30 minutes.Such as, be connected with in connection pool: A1, A2, A3, A4, A5, B1, B2, B3, B4, free time in connection pool connects: A3, A4, B1 and B2, and length standby time of A3 is 1 minute, and length standby time of A4 is 5 minutes, length standby time of B1 is 6 minutes, length standby time of B2 is 2 minutes, and preset time period is 3 minutes, then the free time exceeding preset time period connects for what B1 of A4, and A4 is generation unit 604 generation, then B1 can discharge by the first releasing unit 607.3rd judging unit 609 also can judge whether the quantity of the free time connection that this generation unit 604 non-in this connection pool generates has exceeded default value, if, then the second releasing unit 610 can discharge the free time connection that K non-generation unit 604 generates, K is the difference between the quantity of the free time connection that this generation unit 604 non-in connection pool generates and default value, K is positive integer, such as, be connected with in connection pool: A1, A2, A3, A4, A5, B1, B2, B3, B4, free time in connection pool connects: A3, A4, B1, B2, B3, and B4, default value is 2, A3 and A4 is that generation unit 604 generates, the quantity that the free time that then in connection pool, non-generation unit 604 generates connects is 4, then the second releasing unit 610 can connect B1 by releasing idling, B2, B3, with any two in B4.
Those skilled in the art can be well understood to, and for convenience and simplicity of description, the system of foregoing description, the specific works process of device and unit, with reference to the corresponding process in preceding method embodiment, can not repeat them here.
In several embodiments that the application provides, should be understood that, disclosed system, apparatus and method, can realize by another way.Such as, device embodiment described above is only schematic, such as, the division of described unit, be only a kind of logic function to divide, actual can have other dividing mode when realizing, such as multiple unit or assembly can in conjunction with or another system can be integrated into, or some features can be ignored, or do not perform.Another point, shown or discussed coupling each other or direct-coupling or communication connection can be by some interfaces, and the indirect coupling of device or unit or communication connection can be electrical, machinery or other form.
The described unit illustrated as separating component or can may not be and physically separates, and the parts as unit display can be or may not be physical location, namely can be positioned at a place, or also can be distributed in multiple network element.Some or all of unit wherein can be selected according to the actual needs to realize the object of the present embodiment scheme.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, also can be that the independent physics of unit exists, also can two or more unit in a unit integrated.Above-mentioned integrated unit both can adopt the form of hardware to realize, and the form of SFU software functional unit also can be adopted to realize.
If described integrated unit using the form of SFU software functional unit realize and as independently production marketing or use time, can be stored in a computer read/write memory medium.Based on such understanding, the part that technical scheme of the present invention contributes to prior art in essence in other words or all or part of of this technical scheme can embody with the form of software product, this computer software product is stored in a storage medium, comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform all or part of step of method described in each embodiment of the present invention.And aforesaid storage medium comprises: USB flash disk, portable hard drive, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disc or CD etc. various can be program code stored medium.
The above, above embodiment only in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment to invention has been detailed description, those of ordinary skill in the art is to be understood that: it still can be modified to the technical scheme described in foregoing embodiments, or carries out equivalent replacement to wherein portion of techniques feature; And these amendments or replacement, do not make the essence of appropriate technical solution depart from the spirit and scope of various embodiments of the present invention technical scheme.