Skip to content
Snippets Groups Projects
Commit ecf548e8 authored by Tobias Pietzsch's avatar Tobias Pietzsch
Browse files

revise SoftRefCache.get()

parent 5d9f4b4c
Branches
No related tags found
No related merge requests found
......@@ -82,10 +82,10 @@ public class SoftRefCache< K, V > implements Cache< K, V >
{
synchronized ( entry )
{
// check that we still have the live entry in the map
if ( entry == map.get( key ) )
if ( entry.wasLoaded() )
{
if ( entry.wasLoaded() )
value = entry.getValue();
if ( value == null )
{
/*
* The entry was already loaded, but its value has been
......@@ -94,22 +94,22 @@ public class SoftRefCache< K, V > implements Cache< K, V >
map.remove( key, entry );
value = get( key, loader );
}
else
}
else
{
try
{
value = loader.call();
entry.setValue( value );
}
catch ( final InterruptedException e )
{
Thread.currentThread().interrupt();
throw new ExecutionException( e );
}
catch ( final Exception e )
{
try
{
value = loader.call();
entry.setValue( value );
}
catch ( final InterruptedException e )
{
Thread.currentThread().interrupt();
throw new ExecutionException( e );
}
catch ( final Exception e )
{
throw new ExecutionException( e );
}
throw new ExecutionException( e );
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment