Permalink
Browse files

don't synchronize on invalidator getter methods

  • Loading branch information...
1 parent eb6de50 commit 79dad3ea404d7a8c259f5a50f834acf82cb2db3e @charliesome committed Jun 11, 2013
@@ -151,14 +151,9 @@ public IRubyObject reCache(ThreadContext context, String name) {
}
protected Invalidator invalidator(ThreadContext context) {
- if (invalidator != null) {
- return invalidator;
- }
- synchronized (this) {
- if (invalidator == null) {
- invalidator = context.runtime.getConstantInvalidator(name);
- }
- return invalidator;
+ if (invalidator == null) {
+ invalidator = context.runtime.getConstantInvalidator(name);
}
+ return invalidator;
}
}
@@ -124,15 +124,10 @@ public IRubyObject reCache(ThreadContext context, String name) {
return value;
}
- protected Invalidator invalidator(ThreadContext context) {
- if (invalidator != null) {
- return invalidator;
- }
- synchronized (this) {
- if (invalidator == null) {
- invalidator = context.runtime.getConstantInvalidator(name);
- }
- return invalidator;
+ private Invalidator invalidator(ThreadContext context) {
+ if (invalidator == null) {
+ invalidator = context.runtime.getConstantInvalidator(name);
}
+ return invalidator;
}
}
@@ -123,14 +123,9 @@ public boolean isNoPrivateConsts() {
}
private Invalidator invalidator(Ruby runtime) {
- if (invalidator != null) {
- return invalidator;
- }
- synchronized (this) {
- if (invalidator == null) {
- invalidator = runtime.getConstantInvalidator(constName);
- }
- return invalidator;
+ if (invalidator == null) {
+ invalidator = runtime.getConstantInvalidator(constName);
}
+ return invalidator;
}
}
@@ -105,14 +105,9 @@ public void visit(IRVisitor visitor) {
}
private Invalidator invalidator(Ruby runtime) {
- if (invalidator != null) {
- return invalidator;
- }
- synchronized (this) {
- if (invalidator == null) {
- invalidator = runtime.getConstantInvalidator(constName);
- }
- return invalidator;
+ if (invalidator == null) {
+ invalidator = runtime.getConstantInvalidator(constName);
}
+ return invalidator;
}
}
@@ -125,14 +125,9 @@ public boolean isNoPrivateConsts() {
}
private Invalidator invalidator(Ruby runtime) {
- if (invalidator != null) {
- return invalidator;
- }
- synchronized (this) {
- if (invalidator == null) {
- invalidator = runtime.getConstantInvalidator(constName);
- }
- return invalidator;
+ if (invalidator == null) {
+ invalidator = runtime.getConstantInvalidator(constName);
}
+ return invalidator;
}
}

0 comments on commit 79dad3e

Please sign in to comment.