mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Removed unnecessary synchronization.
This commit is contained in:
parent
3bdad542ef
commit
c7e3993dbc
1 changed files with 3 additions and 7 deletions
|
@ -20,14 +20,14 @@ import java.io.IOException;
|
|||
* symbolic links is undesirable. The default is to use File.getCanonicalPath.
|
||||
*/
|
||||
public abstract class PathCanonicalizationStrategy {
|
||||
private static PathCanonicalizationStrategy instance;
|
||||
private static volatile PathCanonicalizationStrategy instance;
|
||||
|
||||
static {
|
||||
setPathCanonicalization(true);
|
||||
}
|
||||
|
||||
public static String getCanonicalPath(File file) {
|
||||
return getInstance().getCanonicalPathInternal(file);
|
||||
return instance.getCanonicalPathInternal(file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -38,7 +38,7 @@ public abstract class PathCanonicalizationStrategy {
|
|||
* @param canonicalize <code>true</code> to use File.getCanonicalPath, <code>false</code>
|
||||
* to use File.getAbsolutePath.
|
||||
*/
|
||||
public static synchronized void setPathCanonicalization(boolean canonicalize) {
|
||||
public static void setPathCanonicalization(boolean canonicalize) {
|
||||
if (canonicalize) {
|
||||
instance = new PathCanonicalizationStrategy() {
|
||||
@Override
|
||||
|
@ -60,9 +60,5 @@ public abstract class PathCanonicalizationStrategy {
|
|||
}
|
||||
}
|
||||
|
||||
private static synchronized PathCanonicalizationStrategy getInstance() {
|
||||
return instance;
|
||||
}
|
||||
|
||||
protected abstract String getCanonicalPathInternal(File file);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue