Skip to content

Commit

Permalink
Address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaminduR committed Nov 24, 2023
1 parent c3cc8f8 commit bb71a2e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
public class AuthorizedAPICache extends BaseCache<AuthorizedAPICacheKey, AuthorizedAPICacheEntry> {

private static final String CACHE_NAME = "AuthorizedAPICache";
private static volatile AuthorizedAPICache instance;
private static final AuthorizedAPICache instance = new AuthorizedAPICache();

public AuthorizedAPICache(String cacheName) {
private AuthorizedAPICache() {

super(cacheName);
super(CACHE_NAME);
}

/**
Expand All @@ -40,13 +40,6 @@ public AuthorizedAPICache(String cacheName) {
*/
public static AuthorizedAPICache getInstance() {

if (instance == null) {
synchronized (AuthorizedAPICache.class) {
if (instance == null) {
instance = new AuthorizedAPICache(CACHE_NAME);
}
}
}
return instance;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@
package org.wso2.carbon.identity.application.mgt.cache;

import org.wso2.carbon.identity.application.common.model.AuthorizedAPI;

import java.io.Serializable;
import org.wso2.carbon.identity.core.cache.CacheEntry;

/**
* Cache entry for authorized API.
*/
public class AuthorizedAPICacheEntry implements Serializable {
public class AuthorizedAPICacheEntry extends CacheEntry {

private AuthorizedAPI authorizedAPI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@

package org.wso2.carbon.identity.application.mgt.cache;

import java.io.Serializable;
import org.wso2.carbon.identity.core.cache.CacheKey;

/**
* Cache key for authorized API.
*/
public class AuthorizedAPICacheKey implements Serializable {
public class AuthorizedAPICacheKey extends CacheKey {

private static final long serialVersionUID = 3112605038259278777L;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ public CacheBackedAuthorizedAPIDAOImpl(AuthorizedAPIDAO authorizedAPIDAO) {
public void addAuthorizedAPI(String applicationId, String apiId, String policyId, List<Scope> scopes, int tenantId)
throws IdentityApplicationManagementException {


authorizedAPIDAO.addAuthorizedAPI(applicationId, apiId, policyId, scopes, tenantId);
}

Expand Down Expand Up @@ -101,11 +100,10 @@ public AuthorizedAPI getAuthorizedAPI(String appId, String apiId, int tenantId)
} catch (IdentityApplicationManagementException e) {
String error = "Error while retrieving authorized API for application id: " + appId + " and api id: "
+ apiId + " in tenant id: " + tenantId;
LOG.error(error, e);
throw new IdentityApplicationManagementException(error, e);
}
}
return authorizedAPI != null ? authorizedAPI : authorizedAPIDAO.getAuthorizedAPI(appId, apiId, tenantId);
return authorizedAPI;
}

private AuthorizedAPI getAuthorizedAPIFromCache(String appId, String apiId, int tenantId) {
Expand Down

0 comments on commit bb71a2e

Please sign in to comment.