Merge branch 'omaha_14.2.4' of ssh://www.awips2omaha.com:29418/AWIPS2_baseline into master_14.2.4

Former-commit-id: 41921f7db2 [formerly 60756ddb841a0daa347493047b76d2fcb93f7f4a]
Former-commit-id: 814b9a2869
This commit is contained in:
Brian.Dyke 2014-09-26 15:15:57 -04:00
commit a2b18e4bee
3 changed files with 58 additions and 57 deletions

View file

@ -289,9 +289,12 @@ class WECache(object):
saveSize = 0 # number of grids in saveRequest
# get full time range for flush
sortedList = sorted(trList, key=lambda t: t[0])
flushTR = (sortedList[0][0], sortedList[-1][1])
if (len(trList)):
sortedList = sorted(trList, key=lambda t: t[0])
flushTR = (sortedList[0][0], sortedList[-1][1])
else:
flushTR = (0, 2**31-1) # all times
timeSpan = None # time span if this contiguous batch
gridsToSave = ArrayList(self._batchSize) # grids in this contiguous batch
saveBatch = False
@ -420,7 +423,7 @@ class WECache(object):
def flush(self):
"""Writes all dirty time ranges in the WECache to HDF5/DB"""
# flush entire inventory
self.__flushGrids(self._dirty)
self.__flushGrids(self.keys())
def overlaps(self, tr1, tr2):
if (tr1[0] >= tr2[0] and tr1[0] < tr2[1]) or \

View file

@ -76,24 +76,6 @@ public class RegistryRESTServices {
/** JAXB Manager */
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 {
jaxbManager = new RegistryJaxbManager(new RegistryNamespaceMapper());
}
@ -193,11 +175,27 @@ public class RegistryRESTServices {
Client client = (Client) Proxy.getInvocationHandler((Proxy) service);
ClientConfiguration config = WebClient.getConfig(service);
HTTPConduit conduit = config.getHttpConduit();
conduit.setClient(restPolicy);
conduit.setClient(getRestPolicy());
// Create HTTP header containing the calling registry
client.header(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
RegistryUtil.LOCAL_REGISTRY_ADDRESS);
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;
}
}

View file

@ -112,44 +112,12 @@ public class RegistrySOAPServices {
/** The name of the validator service */
protected static final String VALIDATOR_SERVICE_NAME = "validator";
protected static final ProxyConfiguration proxyConfig;
protected static final HTTPClientPolicy httpClientPolicy;
protected static final ProxyConfiguration proxyConfig = getProxyConfiguration();
protected static final String HTTP_RECEIVE_TIMEOUT_PROPERTY = "ebxml-http-receive-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
@ -346,7 +314,7 @@ public class RegistrySOAPServices {
T port = (T) ref.getPort(serviceInterface);
Client client = ClientProxy.getClient(port);
((HTTPConduit) client.getConduit()).setClient(httpClientPolicy);
((HTTPConduit) client.getConduit()).setClient(getSoapPolicy());
// Create HTTP header containing the calling registry
Map<String, List<String>> headers = new HashMap<String, List<String>>();
headers.put(RegistryUtil.CALLING_REGISTRY_SOAP_HEADER_NAME,
@ -374,4 +342,36 @@ public class RegistrySOAPServices {
}
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;
}
}