public class MultiEndpointPoolSample extends Object implements ClientCallback
MultiEndpointPool, which caches TCP Connections to the
servers.
To test the connection pool - we run 100000 requests simultaneously
using custom ExecutorService (we randomly chose the
target server for each request). After we got responses from the
servers - we print out statistics: number of requests sent
(expected value is 100000), number of responses missed (expected value is 0),
the total number of client-side Connections been established
(expected value is <= 4).| Constructor and Description |
|---|
MultiEndpointPoolSample() |
| Modifier and Type | Method and Description |
|---|---|
void |
exec() |
static void |
main(String[] args) |
void |
onConnectionEstablished(org.glassfish.grizzly.Connection connection)
The callback operation will be executed once new client-side
Connection is established. |
void |
onResponseReceived(org.glassfish.grizzly.Connection connection,
String responseMessage)
The callback operation will be executed once a client
Connection
receives response from a server. |
public void onConnectionEstablished(org.glassfish.grizzly.Connection connection)
Connection is established.onConnectionEstablished in interface ClientCallbackconnection - the new Connectionpublic void onResponseReceived(org.glassfish.grizzly.Connection connection,
String responseMessage)
Connection
receives response from a server.onResponseReceived in interface ClientCallbackconnection - the client-side ConnectionresponseMessage - the responseCopyright © 2020 Oracle Corporation. All Rights Reserved.