Issue #3560 Fixed slow memory leak in registry
Former-commit-id:81870960e6
[formerly 918119b26864ee246ac2571baa4e380ae21f2ded] Former-commit-id:fb8dc9fe7d
This commit is contained in:
parent
7aa6719ca2
commit
c7d6c602bd
2 changed files with 51 additions and 53 deletions
|
@ -76,24 +76,6 @@ public class RegistryRESTServices {
|
||||||
/** JAXB Manager */
|
/** JAXB Manager */
|
||||||
private RegistryJaxbManager jaxbManager;
|
private RegistryJaxbManager jaxbManager;
|
||||||
|
|
||||||
/** Policy used for rest connections */
|
|
||||||
private static final HTTPClientPolicy restPolicy;
|
|
||||||
|
|
||||||
static {
|
|
||||||
ProxyConfiguration proxyConfig = RegistrySOAPServices
|
|
||||||
.getProxyConfiguration();
|
|
||||||
restPolicy = new HTTPClientPolicy();
|
|
||||||
restPolicy.setConnection(ConnectionType.CLOSE);
|
|
||||||
restPolicy.setConnectionTimeout(2000);
|
|
||||||
restPolicy.setReceiveTimeout(30000);
|
|
||||||
restPolicy.setMaxRetransmits(1);
|
|
||||||
if (proxyConfig != null) {
|
|
||||||
restPolicy.setProxyServer(proxyConfig.getHost());
|
|
||||||
restPolicy.setProxyServerPort(proxyConfig.getPort());
|
|
||||||
restPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public RegistryRESTServices() throws JAXBException {
|
public RegistryRESTServices() throws JAXBException {
|
||||||
jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper());
|
jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper());
|
||||||
}
|
}
|
||||||
|
@ -193,11 +175,27 @@ public class RegistryRESTServices {
|
||||||
Client client = (Client) Proxy.getInvocationHandler((Proxy) service);
|
Client client = (Client) Proxy.getInvocationHandler((Proxy) service);
|
||||||
ClientConfiguration config = WebClient.getConfig(service);
|
ClientConfiguration config = WebClient.getConfig(service);
|
||||||
HTTPConduit conduit = config.getHttpConduit();
|
HTTPConduit conduit = config.getHttpConduit();
|
||||||
conduit.setClient(restPolicy);
|
conduit.setClient(getRestPolicy());
|
||||||
|
|
||||||
// Create HTTP header containing the calling registry
|
// Create HTTP header containing the calling registry
|
||||||
client.header(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
|
client.header(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
|
||||||
RegistryUtil.LOCAL_REGISTRY_ADDRESS);
|
RegistryUtil.LOCAL_REGISTRY_ADDRESS);
|
||||||
return service;
|
return service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected HTTPClientPolicy getRestPolicy(){
|
||||||
|
ProxyConfiguration proxyConfig = RegistrySOAPServices
|
||||||
|
.getProxyConfiguration();
|
||||||
|
HTTPClientPolicy restPolicy = new HTTPClientPolicy();
|
||||||
|
restPolicy.setConnection(ConnectionType.CLOSE);
|
||||||
|
restPolicy.setConnectionTimeout(2000);
|
||||||
|
restPolicy.setReceiveTimeout(30000);
|
||||||
|
restPolicy.setMaxRetransmits(1);
|
||||||
|
if (proxyConfig != null) {
|
||||||
|
restPolicy.setProxyServer(proxyConfig.getHost());
|
||||||
|
restPolicy.setProxyServerPort(proxyConfig.getPort());
|
||||||
|
restPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
|
||||||
|
}
|
||||||
|
return restPolicy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,44 +112,12 @@ public class RegistrySOAPServices {
|
||||||
/** The name of the validator service */
|
/** The name of the validator service */
|
||||||
protected static final String VALIDATOR_SERVICE_NAME = "validator";
|
protected static final String VALIDATOR_SERVICE_NAME = "validator";
|
||||||
|
|
||||||
protected static final ProxyConfiguration proxyConfig;
|
protected static final ProxyConfiguration proxyConfig = getProxyConfiguration();
|
||||||
|
|
||||||
protected static final HTTPClientPolicy httpClientPolicy;
|
|
||||||
|
|
||||||
protected static final String HTTP_RECEIVE_TIMEOUT_PROPERTY = "ebxml-http-receive-timeout";
|
protected static final String HTTP_RECEIVE_TIMEOUT_PROPERTY = "ebxml-http-receive-timeout";
|
||||||
|
|
||||||
protected static final String HTTP_CONNECTION_TIMEOUT_PROPERTY = "ebxml-http-connection-timeout";
|
protected static final String HTTP_CONNECTION_TIMEOUT_PROPERTY = "ebxml-http-connection-timeout";
|
||||||
|
|
||||||
static {
|
|
||||||
proxyConfig = getProxyConfiguration();
|
|
||||||
httpClientPolicy = new HTTPClientPolicy();
|
|
||||||
|
|
||||||
try {
|
|
||||||
httpClientPolicy.setReceiveTimeout(Long.parseLong(System
|
|
||||||
.getProperty(HTTP_RECEIVE_TIMEOUT_PROPERTY)));
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
statusHandler
|
|
||||||
.error("ebxml-http-receive-timeout not specified. Using default value of 1 minute",
|
|
||||||
e);
|
|
||||||
httpClientPolicy.setReceiveTimeout(DEFAULT_RECEIVE_TIMEOUT);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
httpClientPolicy.setConnectionTimeout(Long.parseLong(System
|
|
||||||
.getProperty(HTTP_CONNECTION_TIMEOUT_PROPERTY)));
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
statusHandler
|
|
||||||
.error("ebxml-http-connection-timeout not specified. Using default value of 10 seconds",
|
|
||||||
e);
|
|
||||||
httpClientPolicy.setConnectionTimeout(DEFAULT_CONNECT_TIMEOUT);
|
|
||||||
}
|
|
||||||
httpClientPolicy.setConnection(ConnectionType.CLOSE);
|
|
||||||
httpClientPolicy.setMaxRetransmits(5);
|
|
||||||
if (proxyConfig != null) {
|
|
||||||
httpClientPolicy.setProxyServer(proxyConfig.getHost());
|
|
||||||
httpClientPolicy.setProxyServerPort(proxyConfig.getPort());
|
|
||||||
httpClientPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the notification listener service URL for the given host
|
* Gets the notification listener service URL for the given host
|
||||||
|
@ -346,7 +314,7 @@ public class RegistrySOAPServices {
|
||||||
T port = (T) ref.getPort(serviceInterface);
|
T port = (T) ref.getPort(serviceInterface);
|
||||||
|
|
||||||
Client client = ClientProxy.getClient(port);
|
Client client = ClientProxy.getClient(port);
|
||||||
((HTTPConduit) client.getConduit()).setClient(httpClientPolicy);
|
((HTTPConduit) client.getConduit()).setClient(getSoapPolicy());
|
||||||
// Create HTTP header containing the calling registry
|
// Create HTTP header containing the calling registry
|
||||||
Map<String, List<String>> headers = new HashMap<String, List<String>>();
|
Map<String, List<String>> headers = new HashMap<String, List<String>>();
|
||||||
headers.put(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
|
headers.put(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
|
||||||
|
@ -374,4 +342,36 @@ public class RegistrySOAPServices {
|
||||||
}
|
}
|
||||||
return proxyConfig;
|
return proxyConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private HTTPClientPolicy getSoapPolicy(){
|
||||||
|
|
||||||
|
HTTPClientPolicy httpClientPolicy = new HTTPClientPolicy();
|
||||||
|
|
||||||
|
try {
|
||||||
|
httpClientPolicy.setReceiveTimeout(Long.parseLong(System
|
||||||
|
.getProperty(HTTP_RECEIVE_TIMEOUT_PROPERTY)));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
statusHandler
|
||||||
|
.error("ebxml-http-receive-timeout not specified. Using default value of 1 minute",
|
||||||
|
e);
|
||||||
|
httpClientPolicy.setReceiveTimeout(DEFAULT_RECEIVE_TIMEOUT);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
httpClientPolicy.setConnectionTimeout(Long.parseLong(System
|
||||||
|
.getProperty(HTTP_CONNECTION_TIMEOUT_PROPERTY)));
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
statusHandler
|
||||||
|
.error("ebxml-http-connection-timeout not specified. Using default value of 10 seconds",
|
||||||
|
e);
|
||||||
|
httpClientPolicy.setConnectionTimeout(DEFAULT_CONNECT_TIMEOUT);
|
||||||
|
}
|
||||||
|
httpClientPolicy.setConnection(ConnectionType.CLOSE);
|
||||||
|
httpClientPolicy.setMaxRetransmits(5);
|
||||||
|
if (proxyConfig != null) {
|
||||||
|
httpClientPolicy.setProxyServer(proxyConfig.getHost());
|
||||||
|
httpClientPolicy.setProxyServerPort(proxyConfig.getPort());
|
||||||
|
httpClientPolicy.setNonProxyHosts(proxyConfig.getNonProxyHosts());
|
||||||
|
}
|
||||||
|
return httpClientPolicy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue