Compare commits

..

7 Commits

Author SHA1 Message Date
norm-traxler
8a0faff455 Merge pull request #23 from Telecominfraproject/WIFI-4415
[Wifi 4415] remove unnecessary code
2021-09-27 15:24:04 -04:00
norm-traxler
92b97c832a Merge pull request #22 from Telecominfraproject/WIFI-4415
[WIFI-4415] Add Gateway and backend support to turn LED on/off
2021-09-27 10:56:37 -04:00
norm-traxler
3fb4dd16b8 Merge pull request #21 from Telecominfraproject/WIFI-3471
WIFI-3471 Update SDK master to use image tag 1.3.0-SNAPSHOT
2021-08-17 16:34:20 -04:00
norm-traxler
caa99afda1 Merge pull request #20 from Telecominfraproject/WIFI-3416-Remove-RestOperationsWithMetrics
WIFI-3416  Remove RestOperationsWithMetrics
2021-08-16 16:59:33 -04:00
Akshay Jagadish
e531cb8597 WIFI-3471 Update SDK master to use image tag 1.3.0-SNAPSHOT 2021-08-13 13:02:33 -04:00
Thomas Currie
b38393ec20 remove unused import 2021-08-12 14:12:11 -04:00
Thomas Currie
b14f57887f replace our custom RestTemplate class with the default one from Spring. 2021-08-12 10:27:29 -04:00
45 changed files with 255 additions and 1138 deletions

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-cassandra-tests</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-cassandra</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-cassandra</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>cloud-metrics</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-client</artifactId>
@@ -14,25 +14,25 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-container</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-exceptions</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>cloud-metrics</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -28,13 +28,7 @@ public abstract class BaseRemoteClient {
@Autowired
private void setRestTemplate(RestOperations restTemplate) {
//build user-friendly metrics Id - remove $$EnhancedByCGlib... at the end of the class name
String metricsId = this.getClass().getSimpleName();
int idx = metricsId.indexOf('$');
if(idx>0){
metricsId = metricsId.substring(0, idx);
}
this.restTemplate = new RestOperationsWithMetrics(restTemplate, metricsId);
this.restTemplate = restTemplate;
}
protected String getBaseUrlFromEnvironment(String urlPropName, String defaultUrlPropName) {

View File

@@ -1,842 +0,0 @@
package com.telecominfraproject.wlan.core.client;
import java.net.URI;
import java.util.Map;
import java.util.Set;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.RequestEntity;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RequestCallback;
import org.springframework.web.client.ResponseExtractor;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestOperations;
import com.netflix.servo.DefaultMonitorRegistry;
import com.netflix.servo.monitor.BasicCounter;
import com.netflix.servo.monitor.BasicTimer;
import com.netflix.servo.monitor.Counter;
import com.netflix.servo.monitor.MonitorConfig;
import com.netflix.servo.monitor.Stopwatch;
import com.netflix.servo.monitor.Timer;
import com.netflix.servo.tag.TagList;
import com.telecominfraproject.wlan.cloudmetrics.CloudMetricsTags;
public class RestOperationsWithMetrics implements RestOperations{
final RestOperations delegate;
private final TagList tags = CloudMetricsTags.commonTags;
private final Counter getsExecuted;
private final Counter postsExecuted;
private final Counter putsExecuted;
private final Counter deletesExecuted;
private final Counter exchangesExecuted;
private final Counter headsExecuted;
private final Counter optionsExecuted;
private final Counter execsExecuted;
private final Counter patchesExecuted;
private final Counter getsErrors;
private final Counter postsErrors;
private final Counter putsErrors;
private final Counter deletesErrors;
private final Counter exchangesErrors;
private final Counter headsErrors;
private final Counter optionsErrors;
private final Counter execsErrors;
private final Counter patchesErrors;
private final Timer getsTimer;
private final Timer postsTimer;
private final Timer putsTimer;
private final Timer deletesTimer;
private final Timer exchangesTimer;
private final Timer headsTimer;
private final Timer optionsTimer;
private final Timer execsTimer;
private final Timer patchesTimer;
public RestOperationsWithMetrics(RestOperations delegate, String metricsId){
this.delegate = delegate;
//Monitors.registerObject("RestTemplate-"+metricsId, this);
getsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-getsExecuted").withTags(tags).build());
postsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-postsExecuted").withTags(tags).build());
putsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-putsExecuted").withTags(tags).build());
deletesExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-deletesExecuted").withTags(tags).build());
exchangesExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-exchangesExecuted").withTags(tags).build());
headsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-headsExecuted").withTags(tags).build());
optionsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-optionsExecuted").withTags(tags).build());
execsExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-execsExecuted").withTags(tags).build());
patchesExecuted = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-patchesExecuted").withTags(tags).build());
getsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-getsErrors").withTags(tags).build());
postsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-postsErrors").withTags(tags).build());
putsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-putsErrors").withTags(tags).build());
deletesErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-deletesErrors").withTags(tags).build());
exchangesErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-exchangesErrors").withTags(tags).build());
headsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-headsErrors").withTags(tags).build());
optionsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-optionsErrors").withTags(tags).build());
execsErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-execsErrors").withTags(tags).build());
patchesErrors = new BasicCounter(MonitorConfig.builder("RestTemplate-"+metricsId+"-patchesErrors").withTags(tags).build());
getsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-getsTimer").withTags(tags).build());
postsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-postsTimer").withTags(tags).build());
putsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-putsTimer").withTags(tags).build());
deletesTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-deletesTimer").withTags(tags).build());
exchangesTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-exchangesTimer").withTags(tags).build());
headsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-headsTimer").withTags(tags).build());
optionsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-optionsTimer").withTags(tags).build());
execsTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-execsTimer").withTags(tags).build());
patchesTimer = new BasicTimer(MonitorConfig.builder("RestTemplate-"+metricsId+"-patchesTimer").withTags(tags).build());
DefaultMonitorRegistry.getInstance().register(getsExecuted);
DefaultMonitorRegistry.getInstance().register(postsExecuted);
DefaultMonitorRegistry.getInstance().register(putsExecuted);
DefaultMonitorRegistry.getInstance().register(deletesExecuted);
DefaultMonitorRegistry.getInstance().register(exchangesExecuted);
DefaultMonitorRegistry.getInstance().register(headsExecuted);
DefaultMonitorRegistry.getInstance().register(optionsExecuted);
DefaultMonitorRegistry.getInstance().register(execsExecuted);
DefaultMonitorRegistry.getInstance().register(getsErrors);
DefaultMonitorRegistry.getInstance().register(postsErrors);
DefaultMonitorRegistry.getInstance().register(putsErrors);
DefaultMonitorRegistry.getInstance().register(deletesErrors);
DefaultMonitorRegistry.getInstance().register(exchangesErrors);
DefaultMonitorRegistry.getInstance().register(headsErrors);
DefaultMonitorRegistry.getInstance().register(optionsErrors);
DefaultMonitorRegistry.getInstance().register(execsErrors);
DefaultMonitorRegistry.getInstance().register(getsTimer);
DefaultMonitorRegistry.getInstance().register(postsTimer);
DefaultMonitorRegistry.getInstance().register(putsTimer);
DefaultMonitorRegistry.getInstance().register(deletesTimer);
DefaultMonitorRegistry.getInstance().register(exchangesTimer);
DefaultMonitorRegistry.getInstance().register(headsTimer);
DefaultMonitorRegistry.getInstance().register(optionsTimer);
DefaultMonitorRegistry.getInstance().register(execsTimer);
}
public <T> T getForObject(String url, Class<T> responseType, Object... uriVariables) throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
T ret = delegate.getForObject(url, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> T getForObject(String url, Class<T> responseType, Map<String, ?> uriVariables)
throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
T ret = delegate.getForObject(url, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> T getForObject(URI url, Class<T> responseType) throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
T ret = delegate.getForObject(url, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Object... uriVariables)
throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.getForEntity(url, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> ResponseEntity<T> getForEntity(String url, Class<T> responseType, Map<String, ?> uriVariables)
throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.getForEntity(url, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public <T> ResponseEntity<T> getForEntity(URI url, Class<T> responseType) throws RestClientException {
getsExecuted.increment();
Stopwatch s = getsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.getForEntity(url, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
getsErrors.increment();
}
}
}
public HttpHeaders headForHeaders(String url, Object... uriVariables) throws RestClientException {
headsExecuted.increment();
Stopwatch s = headsTimer.start();
boolean success = false;
try{
HttpHeaders ret = delegate.headForHeaders(url, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
headsErrors.increment();
}
}
}
public HttpHeaders headForHeaders(String url, Map<String, ?> uriVariables) throws RestClientException {
headsExecuted.increment();
Stopwatch s = headsTimer.start();
boolean success = false;
try{
HttpHeaders ret = delegate.headForHeaders(url, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
headsErrors.increment();
}
}
}
public HttpHeaders headForHeaders(URI url) throws RestClientException {
headsExecuted.increment();
Stopwatch s = headsTimer.start();
boolean success = false;
try{
HttpHeaders ret = delegate.headForHeaders(url);
success = true;
return ret;
}finally{
s.stop();
if(!success){
headsErrors.increment();
}
}
}
public URI postForLocation(String url, Object request, Object... uriVariables) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
URI ret = delegate.postForLocation(url, request, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public URI postForLocation(String url, Object request, Map<String, ?> uriVariables) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
URI ret = delegate.postForLocation(url, request, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public URI postForLocation(URI url, Object request) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
URI ret = delegate.postForLocation(url, request);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> T postForObject(String url, Object request, Class<T> responseType, Object... uriVariables)
throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
T ret = delegate.postForObject(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> T postForObject(String url, Object request, Class<T> responseType, Map<String, ?> uriVariables)
throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
T ret = delegate.postForObject(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> T postForObject(URI url, Object request, Class<T> responseType) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
T ret = delegate.postForObject(url, request, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> responseType,
Object... uriVariables) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.postForEntity(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> ResponseEntity<T> postForEntity(String url, Object request, Class<T> responseType,
Map<String, ?> uriVariables) throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.postForEntity(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public <T> ResponseEntity<T> postForEntity(URI url, Object request, Class<T> responseType)
throws RestClientException {
postsExecuted.increment();
Stopwatch s = postsTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.postForEntity(url, request, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
postsErrors.increment();
}
}
}
public void put(String url, Object request, Object... uriVariables) throws RestClientException {
putsExecuted.increment();
Stopwatch s = putsTimer.start();
boolean success = false;
try{
delegate.put(url, request, uriVariables);
success = true;
}finally{
s.stop();
if(!success){
putsErrors.increment();
}
}
}
public void put(String url, Object request, Map<String, ?> uriVariables) throws RestClientException {
putsExecuted.increment();
Stopwatch s = putsTimer.start();
boolean success = false;
try{
delegate.put(url, request, uriVariables);
success = true;
}finally{
s.stop();
if(!success){
putsErrors.increment();
}
}
}
public void put(URI url, Object request) throws RestClientException {
putsExecuted.increment();
Stopwatch s = putsTimer.start();
boolean success = false;
try{
delegate.put(url, request);
success = true;
}finally{
s.stop();
if(!success){
putsErrors.increment();
}
}
}
public void delete(String url, Object... uriVariables) throws RestClientException {
deletesExecuted.increment();
Stopwatch s = deletesTimer.start();
boolean success = false;
try{
delegate.delete(url, uriVariables);
success = true;
}finally{
s.stop();
if(!success){
deletesErrors.increment();
}
}
}
public void delete(String url, Map<String, ?> uriVariables) throws RestClientException {
deletesExecuted.increment();
Stopwatch s = deletesTimer.start();
boolean success = false;
try{
delegate.delete(url, uriVariables);
success = true;
}finally{
s.stop();
if(!success){
deletesErrors.increment();
}
}
}
public void delete(URI url) throws RestClientException {
deletesExecuted.increment();
Stopwatch s = deletesTimer.start();
boolean success = false;
try{
delegate.delete(url);
success = true;
}finally{
s.stop();
if(!success){
deletesErrors.increment();
}
}
}
public Set<HttpMethod> optionsForAllow(String url, Object... uriVariables) throws RestClientException {
optionsExecuted.increment();
Stopwatch s = optionsTimer.start();
boolean success = false;
try{
Set<HttpMethod> ret = delegate.optionsForAllow(url, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
optionsErrors.increment();
}
}
}
public Set<HttpMethod> optionsForAllow(String url, Map<String, ?> uriVariables) throws RestClientException {
optionsExecuted.increment();
Stopwatch s = optionsTimer.start();
boolean success = false;
try{
Set<HttpMethod> ret = delegate.optionsForAllow(url, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
optionsErrors.increment();
}
}
}
public Set<HttpMethod> optionsForAllow(URI url) throws RestClientException {
optionsExecuted.increment();
Stopwatch s = optionsTimer.start();
boolean success = false;
try{
Set<HttpMethod> ret = delegate.optionsForAllow(url);
success = true;
return ret;
}finally{
s.stop();
if(!success){
optionsErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
Class<T> responseType, Object... uriVariables) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
Class<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity,
Class<T> responseType) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
ParameterizedTypeReference<T> responseType, Object... uriVariables) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(String url, HttpMethod method, HttpEntity<?> requestEntity,
ParameterizedTypeReference<T> responseType, Map<String, ?> uriVariables) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(URI url, HttpMethod method, HttpEntity<?> requestEntity,
ParameterizedTypeReference<T> responseType) throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(url, method, requestEntity, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, Class<T> responseType)
throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(requestEntity, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> ResponseEntity<T> exchange(RequestEntity<?> requestEntity, ParameterizedTypeReference<T> responseType)
throws RestClientException {
exchangesExecuted.increment();
Stopwatch s = exchangesTimer.start();
boolean success = false;
try{
ResponseEntity<T> ret = delegate.exchange(requestEntity, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
exchangesErrors.increment();
}
}
}
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor, Object... uriVariables) throws RestClientException {
execsExecuted.increment();
Stopwatch s = execsTimer.start();
boolean success = false;
try{
T ret = delegate.execute(url, method, requestCallback, responseExtractor, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
execsErrors.increment();
}
}
}
public <T> T execute(String url, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor, Map<String, ?> uriVariables) throws RestClientException {
execsExecuted.increment();
Stopwatch s = execsTimer.start();
boolean success = false;
try{
T ret = delegate.execute(url, method, requestCallback, responseExtractor, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
execsErrors.increment();
}
}
}
public <T> T execute(URI url, HttpMethod method, RequestCallback requestCallback,
ResponseExtractor<T> responseExtractor) throws RestClientException {
execsExecuted.increment();
Stopwatch s = execsTimer.start();
boolean success = false;
try{
T ret = delegate.execute(url, method, requestCallback, responseExtractor);
success = true;
return ret;
}finally{
s.stop();
if(!success){
execsErrors.increment();
}
}
}
@Override
public <T> T patchForObject(String url, Object request, Class<T> responseType, Object... uriVariables)
throws RestClientException {
patchesExecuted.increment();
Stopwatch s = patchesTimer.start();
boolean success = false;
try{
T ret = delegate.patchForObject(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
patchesErrors.increment();
}
}
}
@Override
public <T> T patchForObject(String url, Object request, Class<T> responseType, Map<String, ?> uriVariables)
throws RestClientException {
patchesExecuted.increment();
Stopwatch s = patchesTimer.start();
boolean success = false;
try{
T ret = delegate.patchForObject(url, request, responseType, uriVariables);
success = true;
return ret;
}finally{
s.stop();
if(!success){
patchesErrors.increment();
}
}
}
@Override
public <T> T patchForObject(URI url, Object request, Class<T> responseType) throws RestClientException {
patchesExecuted.increment();
Stopwatch s = patchesTimer.start();
boolean success = false;
try{
T ret = delegate.patchForObject(url, request, responseType);
success = true;
return ret;
}finally{
s.stop();
if(!success){
patchesErrors.increment();
}
}
}
}

View File

@@ -8,7 +8,7 @@ import org.springframework.core.env.Environment;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.client.RestOperations;
import org.springframework.web.client.RestTemplate;
import java.net.URI;
@@ -18,7 +18,7 @@ public class PingClientTest {
PingClient pingClient = mock(PingClient.class, CALLS_REAL_METHODS);
RestOperations restTemplate = mock(RestOperationsWithMetrics.class);
RestTemplate restTemplate = mock(RestTemplate.class);
Environment env = mock(Environment.class);

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-container</artifactId>
@@ -18,7 +18,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
@@ -32,7 +32,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>cloud-metrics</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<!-- Auth0 dependencies -->

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-datastore-inmemory</artifactId>
@@ -13,7 +13,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-exceptions</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-elasticsearch</artifactId>
@@ -14,12 +14,12 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-exceptions</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<!-- ElasticSearch dependencies -->
<dependency>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-exceptions</artifactId>

View File

@@ -3,22 +3,30 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-hazelcast-client</artifactId>
<name>base-hazelcast-client</name>
<description>Common classes for accessing Hazelcast in-memory grid data store.</description>
<dependencies>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast</artifactId>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-client</artifactId>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>common-hazelcast</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -10,6 +10,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import com.hazelcast.config.Config;
import com.hazelcast.config.GroupConfig;
import com.hazelcast.config.InterfacesConfig;
import com.hazelcast.config.JoinConfig;
import com.hazelcast.config.MapConfig;
@@ -18,6 +19,7 @@ import com.hazelcast.config.QueueConfig;
import com.hazelcast.config.TcpIpConfig;
import com.hazelcast.core.Hazelcast;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.spi.properties.GroupProperty;
@Configuration
@Profile("HazelcastForUnitTest")
@@ -67,14 +69,12 @@ public class HazelcastForUnitTest {
public HazelcastInstance hazelcastInstanceTest() {
// this is used for experiments and unit tests
Config config = new Config();
// config.setProperty(GroupProperty.LOGGING_TYPE.getName(), "slf4j");
// config.setProperty(GroupProperty.PHONE_HOME_ENABLED.getName(), "false");
config.setProperty(GroupProperty.LOGGING_TYPE.getName(), "slf4j");
config.setProperty(GroupProperty.PHONE_HOME_ENABLED.getName(), "false");
// GroupConfig groupConfig = new GroupConfig(System.getProperty("tip.wlan.hazelcast.groupName", "wc-dev"));
// groupConfig.setPassword(System.getProperty("tip.wlan.hazelcast.groupPassword", "wc-dev-pass"));
// config.setGroupConfig(groupConfig);
config.setClusterName(System.getProperty("tip.wlan.hazelcast.clusterName", "wc-dev"));
GroupConfig groupConfig = new GroupConfig(System.getProperty("tip.wlan.hazelcast.groupName", "wc-dev"));
groupConfig.setPassword(System.getProperty("tip.wlan.hazelcast.groupPassword", "wc-dev-pass"));
config.setGroupConfig(groupConfig);
config.getNetworkConfig().setPublicAddress("127.0.0.1").setPort(5900).setPortAutoIncrement(true)
.setInterfaces(new InterfacesConfig().addInterface("127.0.0.1"));

View File

@@ -14,8 +14,8 @@ import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.config.security.UsernamePasswordIdentityConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.spi.properties.GroupProperty;
import com.telecominfraproject.wlan.core.model.utils.SystemAndEnvPropertyResolver;
/**
@@ -142,11 +142,10 @@ public class HazelcastClientConfiguration {
@Bean
public HazelcastInstance hazelcastClientUnicast() {
ClientConfig clientConfig = new ClientConfig();
// clientConfig.setProperty(GroupProperty.LOGGING_TYPE.getName(), "slf4j");
// clientConfig.setProperty(GroupProperty.PHONE_HOME_ENABLED.getName(), "false");
clientConfig.setProperty(GroupProperty.LOGGING_TYPE.getName(), "slf4j");
clientConfig.setProperty(GroupProperty.PHONE_HOME_ENABLED.getName(), "false");
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(groupName, groupPassword));
clientConfig.getGroupConfig().setName(groupName).setPassword(groupPassword);
for (String addrStr : nodeAddressesStr.split(",")) {
clientConfig.getNetworkConfig().addAddress(addrStr);
}
@@ -157,7 +156,7 @@ public class HazelcastClientConfiguration {
clientConfig.getNetworkConfig().setSmartRouting(false);
// the client will attempt to re-connect to the cluster forever if
// cluster is not available
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
HazelcastInstance client = new ReConnectingHazelcastClient(clientConfig, reconnectTimeSec);

View File

@@ -1,42 +1,47 @@
package com.telecominfraproject.wlan.hazelcast.client;
import java.util.Collection;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.hazelcast.cardinality.CardinalityEstimator;
import com.hazelcast.client.ClientService;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.cluster.Cluster;
import com.hazelcast.cluster.Endpoint;
import com.hazelcast.collection.IList;
import com.hazelcast.collection.IQueue;
import com.hazelcast.collection.ISet;
import com.hazelcast.config.Config;
import com.hazelcast.core.ClientService;
import com.hazelcast.core.Cluster;
import com.hazelcast.core.DistributedObject;
import com.hazelcast.core.DistributedObjectListener;
import com.hazelcast.core.Endpoint;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.IAtomicLong;
import com.hazelcast.core.IAtomicReference;
import com.hazelcast.core.ICacheManager;
import com.hazelcast.core.ICountDownLatch;
import com.hazelcast.core.IExecutorService;
import com.hazelcast.core.IList;
import com.hazelcast.core.ILock;
import com.hazelcast.core.IMap;
import com.hazelcast.core.IQueue;
import com.hazelcast.core.ISemaphore;
import com.hazelcast.core.ISet;
import com.hazelcast.core.ITopic;
import com.hazelcast.core.IdGenerator;
import com.hazelcast.core.LifecycleService;
import com.hazelcast.core.MultiMap;
import com.hazelcast.core.PartitionService;
import com.hazelcast.core.ReplicatedMap;
import com.hazelcast.cp.CPSubsystem;
import com.hazelcast.crdt.pncounter.PNCounter;
import com.hazelcast.durableexecutor.DurableExecutorService;
import com.hazelcast.flakeidgen.FlakeIdGenerator;
import com.hazelcast.logging.LoggingService;
import com.hazelcast.map.IMap;
import com.hazelcast.multimap.MultiMap;
import com.hazelcast.partition.PartitionService;
import com.hazelcast.replicatedmap.ReplicatedMap;
import com.hazelcast.mapreduce.JobTracker;
import com.hazelcast.quorum.QuorumService;
import com.hazelcast.ringbuffer.Ringbuffer;
import com.hazelcast.scheduledexecutor.IScheduledExecutorService;
import com.hazelcast.splitbrainprotection.SplitBrainProtectionService;
import com.hazelcast.sql.SqlService;
import com.hazelcast.topic.ITopic;
import com.hazelcast.transaction.HazelcastXAResource;
import com.hazelcast.transaction.TransactionContext;
import com.hazelcast.transaction.TransactionException;
@@ -145,157 +150,224 @@ public class ReConnectingHazelcastClient implements HazelcastInstance {
}
return this.client;
}
@Override
public String getName() {
return getClient().getName();
}
@Override
public <E> IQueue<E> getQueue(String name) {
return getClient().getQueue(name);
}
@Override
public <E> ITopic<E> getTopic(String name) {
return getClient().getTopic(name);
}
@Override
public <E> ISet<E> getSet(String name) {
return getClient().getSet(name);
}
@Override
public <E> IList<E> getList(String name) {
return getClient().getList(name);
}
@Override
public <K, V> IMap<K, V> getMap(String name) {
return getClient().getMap(name);
}
@Override
public <K, V> ReplicatedMap<K, V> getReplicatedMap(String name) {
return getClient().getReplicatedMap(name);
}
@Override
public JobTracker getJobTracker(String name) {
return getClient().getJobTracker(name);
}
@Override
public <K, V> MultiMap<K, V> getMultiMap(String name) {
return getClient().getMultiMap(name);
}
@Override
public ILock getLock(String key) {
return getClient().getLock(key);
}
@Override
public <E> Ringbuffer<E> getRingbuffer(String name) {
return getClient().getRingbuffer(name);
}
@Override
public <E> ITopic<E> getReliableTopic(String name) {
return getClient().getReliableTopic(name);
}
@Override
public Cluster getCluster() {
return getClient().getCluster();
}
@Override
public Endpoint getLocalEndpoint() {
return getClient().getLocalEndpoint();
}
@Override
public IExecutorService getExecutorService(String name) {
return getClient().getExecutorService(name);
}
public DurableExecutorService getDurableExecutorService(String name) {
return getClient().getDurableExecutorService(name);
}
@Override
public <T> T executeTransaction(TransactionalTask<T> task) throws TransactionException {
return getClient().executeTransaction(task);
}
@Override
public <T> T executeTransaction(TransactionOptions options, TransactionalTask<T> task) throws TransactionException {
return getClient().executeTransaction(options, task);
}
@Override
public TransactionContext newTransactionContext() {
return getClient().newTransactionContext();
}
@Override
public TransactionContext newTransactionContext(TransactionOptions options) {
return getClient().newTransactionContext(options);
}
public FlakeIdGenerator getFlakeIdGenerator(String name) {
return getClient().getFlakeIdGenerator(name);
@Override
public IdGenerator getIdGenerator(String name) {
return getClient().getIdGenerator(name);
}
@Override
public IAtomicLong getAtomicLong(String name) {
return getClient().getAtomicLong(name);
}
@Override
public <E> IAtomicReference<E> getAtomicReference(String name) {
return getClient().getAtomicReference(name);
}
@Override
public ICountDownLatch getCountDownLatch(String name) {
return getClient().getCountDownLatch(name);
}
@Override
public ISemaphore getSemaphore(String name) {
return getClient().getSemaphore(name);
}
@Override
public Collection<DistributedObject> getDistributedObjects() {
return getClient().getDistributedObjects();
}
public UUID addDistributedObjectListener(DistributedObjectListener distributedObjectListener) {
@Override
public String addDistributedObjectListener(DistributedObjectListener distributedObjectListener) {
return getClient().addDistributedObjectListener(distributedObjectListener);
}
public boolean removeDistributedObjectListener(UUID registrationId) {
@Override
public boolean removeDistributedObjectListener(String registrationId) {
return getClient().removeDistributedObjectListener(registrationId);
}
@Override
public Config getConfig() {
return getClient().getConfig();
}
@Override
public PartitionService getPartitionService() {
return getClient().getPartitionService();
}
public SplitBrainProtectionService getSplitBrainProtectionService() {
return getClient().getSplitBrainProtectionService();
@Override
public QuorumService getQuorumService() {
return getClient().getQuorumService();
}
@Override
public ClientService getClientService() {
return getClient().getClientService();
}
@Override
public LoggingService getLoggingService() {
return getClient().getLoggingService();
}
@Override
public LifecycleService getLifecycleService() {
return getClient().getLifecycleService();
}
@Override
public <T extends DistributedObject> T getDistributedObject(String serviceName, String name) {
return getClient().getDistributedObject(serviceName, name);
}
@Override
public ConcurrentMap<String, Object> getUserContext() {
return getClient().getUserContext();
}
@Override
public HazelcastXAResource getXAResource() {
return getClient().getXAResource();
}
@Override
public void shutdown() {
getClient().shutdown();
}
@Override
public DurableExecutorService getDurableExecutorService(String name) {
return getClient().getDurableExecutorService(name);
}
@Override
public ICacheManager getCacheManager() {
return getClient().getCacheManager();
}
@Override
public CardinalityEstimator getCardinalityEstimator(String name) {
return getClient().getCardinalityEstimator(name);
}
public PNCounter getPNCounter(String name) {
return getClient().getPNCounter(name);
}
@Override
public IScheduledExecutorService getScheduledExecutorService(String name) {
return getClient().getScheduledExecutorService(name);
}
public CPSubsystem getCPSubsystem() {
return getClient().getCPSubsystem();
}
public SqlService getSql() {
return getClient().getSql();
}
public void shutdown() {
getClient().shutdown();
@Override
public PNCounter getPNCounter(String name) {
return getClient().getPNCounter(name);
}
@Override
public CPSubsystem getCPSubsystem() {
return getClient().getCPSubsystem();
}
@Override
public FlakeIdGenerator getFlakeIdGenerator(String name) {
return getClient().getFlakeIdGenerator(name);
}
}

View File

@@ -6,8 +6,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
@@ -16,16 +16,15 @@ import org.slf4j.LoggerFactory;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.collection.IQueue;
import com.hazelcast.collection.impl.queue.QueueService;
import com.hazelcast.config.security.UsernamePasswordIdentityConfig;
import com.hazelcast.core.DistributedObject;
import com.hazelcast.core.DistributedObjectEvent;
import com.hazelcast.core.DistributedObjectListener;
import com.hazelcast.core.EntryEvent;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.flakeidgen.FlakeIdGenerator;
import com.hazelcast.map.IMap;
import com.hazelcast.core.IMap;
import com.hazelcast.core.IQueue;
import com.hazelcast.core.IdGenerator;
import com.hazelcast.map.listener.EntryAddedListener;
import com.hazelcast.map.listener.EntryEvictedListener;
import com.hazelcast.map.listener.EntryRemovedListener;
@@ -36,8 +35,7 @@ public class TestClient {
public static void main_1(String[] args) throws IOException {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig("wc-dev", "wc-dev-pass"));
clientConfig.getGroupConfig().setName("wc-dev").setPassword("wc-dev-pass");
clientConfig.getNetworkConfig().addAddress("127.0.0.1:5900");
clientConfig.getNetworkConfig().addAddress("127.0.0.1:5901");
clientConfig.getNetworkConfig().addAddress("127.0.0.1:5902");
@@ -55,7 +53,7 @@ public class TestClient {
System.out.println("metricsMap["+ entry.getKey() +"]: " +entry.getValue());
}
FlakeIdGenerator testIdGenerator = client.getFlakeIdGenerator("id_generator_created_from_client");
IdGenerator testIdGenerator = client.getIdGenerator("id_generator_created_from_client");
Map<Long, String> mapCreatedFromClient = client.getMap( "map_created_from_client" );
System.out.println("mapCreatedFromClient: " + mapCreatedFromClient);
@@ -122,8 +120,7 @@ public class TestClient {
public static void main_2(String[] args) throws InterruptedException {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
clientConfig.getNetworkConfig().addAddress("127.0.0.1:5901");
clientConfig.getNetworkConfig().addAddress("127.0.0.1:5902");
@@ -242,7 +239,7 @@ public class TestClient {
public static void main_3(String[] args) throws InterruptedException, ExecutionException {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
// clientConfig.getNetworkConfig().addAddress("127.0.0.1:5901");
// clientConfig.getNetworkConfig().addAddress("127.0.0.1:5902");
@@ -250,7 +247,7 @@ public class TestClient {
//see http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#java-client-operation-modes
// here we're using "dumb" client that connects only to a single node of the cluster
clientConfig.getNetworkConfig().setSmartRouting(false);
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
//HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
HazelcastInstance client = new ReConnectingHazelcastClient(clientConfig, 20);
@@ -262,7 +259,7 @@ public class TestClient {
if(Boolean.getBoolean("populateMapBeforeTest")){
@SuppressWarnings("rawtypes")
List<CompletionStage<String>> futures = new ArrayList<>(1000);
List<Future> futures = new ArrayList<>(1000);
//populate map with entries
for(int i=0; i<1000000; i++){
@@ -283,12 +280,12 @@ public class TestClient {
// }
// }
futures.add(client.<String, String>getMap("testMap").putAsync("t_" + Integer.toString(fI), Integer.toString(fI)));
futures.add(client.getMap("testMap").putAsync("t_" + Integer.toString(fI), Integer.toString(fI)));
//wait for a batch of futures to complete
if(futures.size()>=990){
for(CompletionStage<String> f: futures){
f.toCompletableFuture().get();
for(Future<?> f: futures){
f.get();
}
futures.clear();
@@ -296,8 +293,8 @@ public class TestClient {
}
for(CompletionStage<String> f: futures){
f.toCompletableFuture().get();
for(Future<?> f: futures){
f.get();
}
end = System.currentTimeMillis();
@@ -326,7 +323,7 @@ public class TestClient {
evenCount = 0;
Predicate<String, String> predicate = new SamplePredicate();
for(Map.Entry<String, String> entry: client.<String, String>getMap( "testMap" ).entrySet(predicate )){
for(Map.Entry<?, ?> entry: client.getMap( "testMap" ).entrySet(predicate )){
evenCount++;
}
@@ -358,13 +355,13 @@ public class TestClient {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
//see http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#java-client-operation-modes
// here we're using "dumb" client that connects only to a single node of the cluster
clientConfig.getNetworkConfig().setSmartRouting(false);
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
@@ -389,13 +386,13 @@ public class TestClient {
public static void main_5(String[] args) {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
//see http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#java-client-operation-modes
// here we're using "dumb" client that connects only to a single node of the cluster
clientConfig.getNetworkConfig().setSmartRouting(false);
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
@@ -429,13 +426,13 @@ public class TestClient {
public static void main_6(String[] args) {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
//see http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#java-client-operation-modes
// here we're using "dumb" client that connects only to a single node of the cluster
clientConfig.getNetworkConfig().setSmartRouting(false);
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
@@ -467,13 +464,13 @@ public class TestClient {
public static void main_7(String[] args) {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
//see http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#java-client-operation-modes
// here we're using "dumb" client that connects only to a single node of the cluster
clientConfig.getNetworkConfig().setSmartRouting(false);
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);
@@ -526,13 +523,13 @@ public class TestClient {
public static void main(String[] args) {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
//see http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#java-client-operation-modes
// here we're using "dumb" client that connects only to a single node of the cluster
clientConfig.getNetworkConfig().setSmartRouting(false);
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
HazelcastInstance hazelcastClient = HazelcastClient.newHazelcastClient(clientConfig);
@@ -601,13 +598,13 @@ public class TestClient {
public static void main_9(String[] args) throws InterruptedException {
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
//see http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#java-client-operation-modes
// here we're using "dumb" client that connects only to a single node of the cluster
clientConfig.getNetworkConfig().setSmartRouting(false);
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
HazelcastInstance hazelcastClient = HazelcastClient.newHazelcastClient(clientConfig);
DistributedObjectListener distributedObjectListener = new DistributedObjectListener() {

View File

@@ -5,9 +5,9 @@ import java.util.Set;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.config.security.UsernamePasswordIdentityConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import com.hazelcast.core.IMap;
import com.hazelcast.spi.properties.GroupProperty;
import com.telecominfraproject.wlan.hazelcast.common.HazelcastObjectsConfiguration;
public class GetValues
@@ -25,10 +25,10 @@ public class GetValues
// }
ClientConfig clientConfig = new ClientConfig();
// clientConfig.setProperty(GroupProperty.LOGGING_TYPE.getName(), "slf4j");
// clientConfig.setProperty(GroupProperty.PHONE_HOME_ENABLED.getName(), "false");
clientConfig.setProperty(GroupProperty.LOGGING_TYPE.getName(), "slf4j");
clientConfig.setProperty(GroupProperty.PHONE_HOME_ENABLED.getName(), "false");
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);

View File

@@ -2,9 +2,9 @@ package com.telecominfraproject.wlan.hazelcast.client.clu;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.config.security.UsernamePasswordIdentityConfig;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import com.hazelcast.core.IMap;
import com.hazelcast.spi.properties.GroupProperty;
public class SetProvisionedCapacity {
@@ -21,14 +21,16 @@ public class SetProvisionedCapacity {
ClientConfig clientConfig = new ClientConfig();
clientConfig.setProperty(GroupProperty.LOGGING_TYPE.getName(), "slf4j");
clientConfig.setProperty(GroupProperty.PHONE_HOME_ENABLED.getName(), "false");
clientConfig.getSecurityConfig().setUsernamePasswordIdentityConfig(new UsernamePasswordIdentityConfig(clusterName, password));
clientConfig.getGroupConfig().setName(clusterName).setPassword(password);
clientConfig.getNetworkConfig().addAddress(addr);
//see http://docs.hazelcast.org/docs/3.6/manual/html-single/index.html#java-client-operation-modes
// here we're using "dumb" client that connects only to a single node of the cluster
clientConfig.getNetworkConfig().setSmartRouting(false);
//clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
clientConfig.getNetworkConfig().setConnectionAttemptLimit(0);
HazelcastInstance client = HazelcastClient.newHazelcastClient(clientConfig);

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-hierarchical-datastore</artifactId>
@@ -13,17 +13,17 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-hazelcast-client</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>cloud-metrics</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -27,7 +27,6 @@ import java.util.Set;
import java.util.TimeZone;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Callable;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
@@ -42,9 +41,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StreamUtils;
import com.hazelcast.collection.IQueue;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import com.hazelcast.core.IMap;
import com.hazelcast.core.IQueue;
import com.netflix.servo.monitor.Counter;
import com.netflix.servo.monitor.Timer;
import com.telecominfraproject.wlan.cloudmetrics.CloudMetricsUtils;
@@ -496,8 +495,7 @@ public class HierarchicalDatastore{
try {
LOG.trace("submitting append request to hazelcast");
//submit operation and wait for its completion
CompletionStage<Set<String>> cs = dirListMap.submitToKey(dirKey, new AppendStringToSetEntryProcessor(shortFileName) );
cs.toCompletableFuture().get();
dirListMap.submitToKey(dirKey, new AppendStringToSetEntryProcessor(shortFileName) ).get();
LOG.trace("append request is processed in hazelcast");
} catch (InterruptedException e) {
Thread.currentThread().interrupt();

View File

@@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import org.junit.AfterClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -36,7 +35,7 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import com.hazelcast.core.IMap;
import com.telecominfraproject.wlan.core.model.filter.EntryFilter;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.telecominfraproject.wlan.hazelcast.HazelcastForUnitTest;
@@ -60,7 +59,6 @@ import com.telecominfraproject.wlan.hierarchical.datastore.writer.StreamHolder;
PropertySourcesPlaceholderConfigurer.class, //must have this to resolve non-string @Value annotations, i.e. int properties, etc.
})
@ActiveProfiles({"HazelcastForUnitTest"})
@Ignore("DT: these compoinents are not used for now, re-enable the tests if and when they are back in the system")
public class HierarchicalDatastoreHourlyIndexTests {
static{

View File

@@ -30,7 +30,7 @@ import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import com.hazelcast.core.IMap;
import com.telecominfraproject.wlan.core.model.filter.EntryFilter;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.telecominfraproject.wlan.hazelcast.HazelcastForUnitTest;
@@ -53,7 +53,6 @@ import com.telecominfraproject.wlan.hierarchical.datastore.writer.StreamHolder;
PropertySourcesPlaceholderConfigurer.class, //must have this to resolve non-string @Value annotations, i.e. int properties, etc.
})
@ActiveProfiles({"HazelcastForUnitTest"})
@Ignore("DT: these compoinents are not used for now, re-enable the tests if and when they are back in the system")
public class HierarchicalDatastoreRecordIndexTests {
static{

View File

@@ -26,7 +26,6 @@ import java.util.zip.ZipOutputStream;
import javax.annotation.PostConstruct;
import org.junit.AfterClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -58,7 +57,6 @@ import com.telecominfraproject.wlan.hierarchical.datastore.index.registry.Record
HazelcastObjectsConfiguration.class,
})
@ActiveProfiles({"HazelcastForUnitTest"})
@Ignore("DT: these compoinents are not used for now, re-enable the tests if and when they are back in the system")
public class HierarchicalDatastoreTests {
static{

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-jdbc-tests</artifactId>
@@ -16,7 +16,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-jdbc</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-jdbc</artifactId>
@@ -41,7 +41,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>cloud-metrics</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -3,7 +3,6 @@ package com.telecominfraproject.wlan.core.server.jdbc;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Stream;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
@@ -1093,80 +1092,7 @@ class JdbcOperationsWithMetrics implements JdbcOperations{
}
}
@Override
public <T> Stream<T> queryForStream(String sql, RowMapper<T> rowMapper) throws DataAccessException {
queriesExecuted.increment();
Stopwatch s = queriesTimer.start();
boolean success = false;
try{
Stream<T> ret = delegate.queryForStream(sql, rowMapper);
success = true;
return ret;
}finally{
s.stop();
if(!success){
queriesErrors.increment();
}
}
}
@Override
public <T> Stream<T> queryForStream(PreparedStatementCreator psc, RowMapper<T> rowMapper) throws DataAccessException {
queriesExecuted.increment();
Stopwatch s = queriesTimer.start();
boolean success = false;
try{
Stream<T> ret = delegate.queryForStream(psc, rowMapper);
success = true;
return ret;
}finally{
s.stop();
if(!success){
queriesErrors.increment();
}
}
}
@Override
public <T> Stream<T> queryForStream(String sql, PreparedStatementSetter pss, RowMapper<T> rowMapper) throws DataAccessException {
queriesExecuted.increment();
Stopwatch s = queriesTimer.start();
boolean success = false;
try{
Stream<T> ret = delegate.queryForStream(sql, pss, rowMapper);
success = true;
return ret;
}finally{
s.stop();
if(!success){
queriesErrors.increment();
}
}
}
@Override
public <T> Stream<T> queryForStream(String sql, RowMapper<T> rowMapper, Object... args) throws DataAccessException {
queriesExecuted.increment();
Stopwatch s = queriesTimer.start();
boolean success = false;
try{
Stream<T> ret = delegate.queryForStream(sql, rowMapper, args);
success = true;
return ret;
}finally{
s.stop();
if(!success){
queriesErrors.increment();
}
}
}
@Override
public String toString() {
return "JOWM-"+delegate.toString();

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
@@ -15,7 +15,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-models</artifactId>
@@ -14,20 +14,20 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-exceptions</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>json-patch-tip</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<!-- this is used to register all subclasses of BaseJsonModel for deserialization -->
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>reflections-tip</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->

View File

@@ -73,19 +73,5 @@ public enum RadioType {
return false;
}
public static String getRadioDisplayString(RadioType radioType) {
// This display format matches UI
switch (radioType) {
case is2dot4GHz:
return "2.4GHz";
case is5GHz:
return "5GHz";
case is5GHzU:
return "5GHz (U)";
case is5GHzL:
return "5GHz (L)";
default:
return radioType.name();
}
}
}

View File

@@ -45,11 +45,11 @@ public class BaseJsonTypeResolverBuilder extends StdTypeResolverBuilder {
@Override
protected Object _deserializeTypedUsingDefaultImpl(final JsonParser jp, DeserializationContext ctxt,
TokenBuffer tb, String priorFailureMsg) throws IOException {
TokenBuffer tb) throws IOException {
Object obj = null;
JsonParser parser = jp;
try{
obj = super._deserializeTypedUsingDefaultImpl(parser, ctxt, tb, priorFailureMsg);
obj = super._deserializeTypedUsingDefaultImpl(parser, ctxt, tb);
}catch(Exception e){
JsonDeserializer<Object> deser = ctxt.findContextualValueDeserializer(this._baseType, null);
if (deser != null) {
@@ -109,7 +109,7 @@ public class BaseJsonTypeResolverBuilder extends StdTypeResolverBuilder {
return ret;
}
public void setPropertyName(String property) {
public void setPropertName(String property) {
super._typeProperty = property;
}
}

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-partitioner</artifactId>
@@ -13,7 +13,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-hazelcast-client</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -9,9 +9,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.cp.CPSubsystem;
import com.hazelcast.cp.lock.FencedLock;
import com.hazelcast.map.IMap;
import com.hazelcast.core.ILock;
import com.hazelcast.core.IMap;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
/**
@@ -66,9 +65,7 @@ public class DynamicServicePartitioner implements ServicePartitionerInterface {
IMap<String, byte[]> partitionerMap = hazelcastInstance.getMap(mapName);
// lock the whole partitionerMap while refresh is happening
// see https://docs.hazelcast.com/imdg/4.2/migration-guides
CPSubsystem cpSubsystem = hazelcastInstance.getCPSubsystem();
FencedLock mapLock = cpSubsystem.getLock("lock_" + mapName);
ILock mapLock = hazelcastInstance.getLock("lock_" + mapName);
mapLock.lock();
try {

View File

@@ -10,7 +10,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.map.IMap;
import com.hazelcast.core.IMap;
/**
* @author yongli

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-remote-tests</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-tx-tests</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-scheduler</artifactId>
@@ -14,7 +14,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-stream-consumer</artifactId>
@@ -14,13 +14,13 @@
<dependency>
<artifactId>base-models</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>cloud-metrics</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-stream-interface</artifactId>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>base-tx-tests</artifactId>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>cloud-metrics</artifactId>
@@ -13,18 +13,18 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-exceptions</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-elasticsearch</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>common-hazelcast</artifactId>
@@ -19,7 +19,7 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-models</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>

View File

@@ -4,10 +4,8 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map.Entry;
import java.util.function.BiFunction;
import com.hazelcast.map.impl.ComputeEntryProcessor;
import com.hazelcast.map.AbstractEntryProcessor;
/**
* This class appends an item to a List<Long> stored in a hazelcast map.
@@ -19,24 +17,11 @@ import com.hazelcast.map.impl.ComputeEntryProcessor;
* <b>Very important</b>: this class must implement Serializable interface because it is submitted to Hazelcast Cluster
* @author dtop
*/
public class AppendLongToListEntryProcessor extends ComputeEntryProcessor<String, List<Long>> implements Serializable {
public class AppendLongToListEntryProcessor extends AbstractEntryProcessor<String, List<Long>> implements Serializable {
private static final long serialVersionUID = -6960225265547599510L;
private long tsToAppend;
// private BiFunction<String, List<Long>, List<Long>> biFunction = (key, value) -> {
// if(value==null){
// value = new ArrayList<>();
// }
//
// // process and modify value
// if(!value.contains(tsToAppend)){
// value.add(tsToAppend);
// }
//
// return value;
// };
public AppendLongToListEntryProcessor() {
// for serialization
}
@@ -46,7 +31,7 @@ public class AppendLongToListEntryProcessor extends ComputeEntryProcessor<String
}
@Override
public List<Long> process(Entry<String, List<Long>> entry) {
public Object process(Entry<String, List<Long>> entry) {
List<Long> value = entry.getValue();
if(value==null){
@@ -59,6 +44,6 @@ public class AppendLongToListEntryProcessor extends ComputeEntryProcessor<String
}
entry.setValue(value);
return value;
return true;
}
}

View File

@@ -5,7 +5,7 @@ import java.util.HashSet;
import java.util.Map.Entry;
import java.util.Set;
import com.hazelcast.map.impl.ComputeEntryProcessor;
import com.hazelcast.map.AbstractEntryProcessor;
/**
* This class appends an item to a Set<String> stored in a hazelcast map.
@@ -17,7 +17,7 @@ import com.hazelcast.map.impl.ComputeEntryProcessor;
* <b>Very important</b>: this class must implement Serializable interface because it is submitted to Hazelcast Cluster
* @author dtop
*/
public class AppendStringToSetEntryProcessor extends ComputeEntryProcessor<String, Set<String>> implements Serializable {
public class AppendStringToSetEntryProcessor extends AbstractEntryProcessor<String, Set<String>> implements Serializable {
private static final long serialVersionUID = -6960225265547599510L;
private String stringToAppend;
@@ -31,7 +31,7 @@ public class AppendStringToSetEntryProcessor extends ComputeEntryProcessor<Strin
}
@Override
public Set<String> process(Entry<String, Set<String>> entry) {
public Object process(Entry<String, Set<String>> entry) {
Set<String> value = entry.getValue();
if(value==null){
@@ -43,6 +43,6 @@ public class AppendStringToSetEntryProcessor extends ComputeEntryProcessor<Strin
entry.setValue(value);
return value;
return true;
}
}

View File

@@ -5,7 +5,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>reflections-tip</artifactId>

View File

@@ -3,7 +3,7 @@
<parent>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>tip-wlan-cloud-root-pom</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>webtoken-auth-service</artifactId>
@@ -14,13 +14,13 @@
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-container</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.telecominfraproject.wlan</groupId>
<artifactId>base-client</artifactId>
<version>1.2.0-SNAPSHOT</version>
<version>1.3.0-SNAPSHOT</version>
</dependency>
</dependencies>