Skip to content

Commit

Permalink
Merge branch 'wso2:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
chamikasudusinghe authored Jun 22, 2023
2 parents 87a89a7 + ad76be5 commit 9bc0a69
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public long asyncGetAndAddCounter(String key, long value) {

Response<Long> incrementedValue = transaction.incrBy(key, value);
transaction.exec();
if (currentValue != null) {
if (currentValue != null && currentValue.get() != null) {
current = Long.parseLong(currentValue.get());
}
if (log.isDebugEnabled()) {
Expand Down Expand Up @@ -177,7 +177,7 @@ public long asyncGetAndAlterCounter(String key, long value) {
Response<Long> incrementedValue = transaction.incrBy(key, value);
transaction.exec();

if (currentValue != null) {
if (currentValue != null && currentValue.get() != null) {
current = Long.parseLong(currentValue.get());
}
if (log.isDebugEnabled()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ protected void activate(ComponentContext context) {
RedisConfig redisConfig =
ServiceReferenceHolder.getInstance().getAPIManagerConfiguration().getRedisConfig();
if (redisConfig.isRedisEnabled()) {
ServiceReferenceHolder.getInstance().setRedisPool(getJedisPool(redisConfig));
RedisBaseDistributedCountManager redisBaseDistributedCountManager =
new RedisBaseDistributedCountManager(ServiceReferenceHolder.getInstance().getRedisPool());
context.getBundleContext().registerService(DistributedCounterManager.class,
redisBaseDistributedCountManager, null);
ServiceReferenceHolder.getInstance().setRedisPool(getJedisPool(redisConfig));
}

// Create caches for the super tenant
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,19 @@ private void readChildElements(OMElement serverConfig,
redisConfig.setRedisEnabled(true);
redisConfig.setHost(redisHost.getText());
redisConfig.setPort(Integer.parseInt(redisPort.getText()));
if (redisUser != null && redisPassword != null && redisDatabaseId != null
&& redisConnectionTimeout != null && redisIsSslEnabled != null) {
if (redisUser != null) {
redisConfig.setUser(redisUser.getText());
}
if (redisPassword != null) {
redisConfig.setPassword(MiscellaneousUtil.resolve(redisPassword, secretResolver).toCharArray());
}
if (redisDatabaseId != null) {
redisConfig.setDatabaseId(Integer.parseInt(redisDatabaseId.getText()));
}
if (redisConnectionTimeout != null) {
redisConfig.setConnectionTimeout(Integer.parseInt(redisConnectionTimeout.getText()));
}
if (redisIsSslEnabled != null) {
redisConfig.setSslEnabled(Boolean.parseBoolean(redisIsSslEnabled.getText()));
}
if (propertiesElement !=null){
Expand Down

0 comments on commit 9bc0a69

Please sign in to comment.