Skip to content

Commit

Permalink
Some cleanups and small performance improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesde committed Sep 1, 2016
1 parent 28e78b1 commit 2e6eaff
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 70 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class ArtifactExecutionFacadeImpl implements ArtifactExecutionFacade {
protected final static Logger logger = LoggerFactory.getLogger(ArtifactExecutionFacadeImpl.class)

protected ExecutionContextImpl eci
protected Deque<ArtifactExecutionInfoImpl> artifactExecutionInfoStack = new LinkedList<ArtifactExecutionInfoImpl>()
protected List<ArtifactExecutionInfoImpl> artifactExecutionInfoHistory = new LinkedList<ArtifactExecutionInfoImpl>()
protected LinkedList<ArtifactExecutionInfoImpl> artifactExecutionInfoStack = new LinkedList<ArtifactExecutionInfoImpl>()
protected LinkedList<ArtifactExecutionInfoImpl> artifactExecutionInfoHistory = new LinkedList<ArtifactExecutionInfoImpl>()

// this is used by ScreenUrlInfo.isPermitted() which is called a lot, but that is transient so put here to have one per EC instance
protected Map<String, Boolean> screenPermittedCache = null
Expand Down Expand Up @@ -103,7 +103,7 @@ public class ArtifactExecutionFacadeImpl implements ArtifactExecutionFacade {

@Override
ArtifactExecutionInfo pop(ArtifactExecutionInfo aei) {
if (this.artifactExecutionInfoStack.size() > 0) {
try {
ArtifactExecutionInfoImpl lastAeii = (ArtifactExecutionInfoImpl) artifactExecutionInfoStack.removeFirst()
// removed this for performance reasons, generally just checking the name is adequate
// || aei.typeEnumId != lastAeii.typeEnumId || aei.actionEnumId != lastAeii.actionEnumId
Expand All @@ -119,8 +119,8 @@ public class ArtifactExecutionFacadeImpl implements ArtifactExecutionFacade {
eci.ecfi.countArtifactHit(lastAeii.typeEnum, lastAeii.actionDetail, lastAeii.nameInternal,
lastAeii.parameters, lastAeii.startTimeMillis, lastAeii.getRunningTimeMillisDouble(), lastAeii.outputSize)
return lastAeii
} else {
logger.warn("Tried to pop from an empty ArtifactExecutionInfo stack", new Exception("Bad pop location"))
} catch(NoSuchElementException e) {
logger.warn("Tried to pop from an empty ArtifactExecutionInfo stack", e)
return null
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ public class ArtifactExecutionInfoImpl implements ArtifactExecutionInfo {
public AuthzType internalAuthorizedAuthzType = null;
public AuthzAction internalAuthorizedActionEnum = null;
public boolean internalAuthorizationInheritable = false;
private Boolean internalAuthzWasRequired = null;
private Boolean isAccess = null;
private boolean internalAuthzWasRequired = false;
private boolean isAccess = false;
private boolean trackArtifactHit = true;
private Boolean internalAuthzWasGranted = null;
private boolean internalAuthzWasGranted = false;
public ArtifactAuthzCheck internalAacv = null;

//protected Exception createdLocation = null
Expand Down Expand Up @@ -112,15 +112,15 @@ public String getActionDescription() {
void setAuthorizationInheritable(boolean isAuthorizationInheritable) { this.internalAuthorizationInheritable = isAuthorizationInheritable; }

@Override
public Boolean getAuthorizationWasRequired() { return internalAuthzWasRequired; }
public boolean getAuthorizationWasRequired() { return internalAuthzWasRequired; }
void setAuthzReqdAndIsAccess(boolean authzReqd, boolean isAccess) {
internalAuthzWasRequired = authzReqd ? Boolean.TRUE : Boolean.FALSE;
this.isAccess = isAccess ? Boolean.TRUE : Boolean.FALSE;
internalAuthzWasRequired = authzReqd;
this.isAccess = isAccess;
}
public void setTrackArtifactHit(boolean tah) { trackArtifactHit = tah; }
boolean shouldCountArtifactHit() { return trackArtifactHit && internalAuthzWasRequired && isAccess; }
@Override
public Boolean getAuthorizationWasGranted() { return internalAuthzWasGranted; }
public boolean getAuthorizationWasGranted() { return internalAuthzWasGranted; }
void setAuthorizationWasGranted(boolean value) { internalAuthzWasGranted = value ? Boolean.TRUE : Boolean.FALSE; }

ArtifactAuthzCheck getAacv() { return internalAacv; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ class ExecutionContextFactoryImpl implements ExecutionContextFactory {
ph = 'true'.equals(artifactStats.attribute('persist-hit'))
artifactPersistHitByTypeEnum.put(artifactTypeEnum, ph)
}
return ph.booleanValue()
return Boolean.TRUE.is(ph)

/* by sub-type no longer supported:
String cacheKey = artifactTypeEnum.name() + artifactSubType
Expand All @@ -1085,10 +1085,10 @@ class ExecutionContextFactoryImpl implements ExecutionContextFactory {
Boolean pb = (Boolean) artifactPersistBinByTypeEnum.get(artifactTypeEnum)
if (pb == null) {
MNode artifactStats = getArtifactStatsNode(artifactTypeEnum.name(), null)
pb = 'true'.equals(artifactStats.attribute('persist-bin'))
pb = "true".equals(artifactStats.attribute("persist-bin"))
artifactPersistBinByTypeEnum.put(artifactTypeEnum, pb)
}
return pb.booleanValue()
return Boolean.TRUE.is(pb)

/* by sub-type no longer supported:
String cacheKey = artifactTypeEnum.name().concat(artifactSubType)
Expand Down

0 comments on commit 2e6eaff

Please sign in to comment.