456956 Reduce ThreadLocal.remove() weak reference garbage
This commit is contained in:
parent
3abfbe26b3
commit
3270af81e8
|
@ -126,14 +126,14 @@ public class ServletCallbackHandler implements CallbackHandler
|
|||
public CallerPrincipalCallback getThreadCallerPrincipalCallback()
|
||||
{
|
||||
CallerPrincipalCallback callerPrincipalCallback = _callerPrincipals.get();
|
||||
_callerPrincipals.remove();
|
||||
_callerPrincipals.set(null);
|
||||
return callerPrincipalCallback;
|
||||
}
|
||||
|
||||
public GroupPrincipalCallback getThreadGroupPrincipalCallback()
|
||||
{
|
||||
GroupPrincipalCallback groupPrincipalCallback = _groupPrincipals.get();
|
||||
_groupPrincipals.remove();
|
||||
_groupPrincipals.set(null);
|
||||
return groupPrincipalCallback;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,7 +211,6 @@ public class ContextFactory implements ObjectFactory
|
|||
return (Context)__contextMap.get(loader);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Associate the given Context with the current thread.
|
||||
* disassociate method should be called to reset the context.
|
||||
|
@ -227,10 +226,9 @@ public class ContextFactory implements ObjectFactory
|
|||
|
||||
public static void disassociateContext(final Context ctx)
|
||||
{
|
||||
__threadContext.remove();
|
||||
__threadContext.set(null);
|
||||
}
|
||||
|
||||
|
||||
public static ClassLoader associateClassLoader(final ClassLoader loader)
|
||||
{
|
||||
ClassLoader prev = (ClassLoader)__threadClassLoader.get();
|
||||
|
@ -238,10 +236,9 @@ public class ContextFactory implements ObjectFactory
|
|||
return prev;
|
||||
}
|
||||
|
||||
|
||||
public static void disassociateClassLoader ()
|
||||
{
|
||||
__threadClassLoader.remove();
|
||||
__threadClassLoader.set(null);
|
||||
}
|
||||
|
||||
public static void dump(Appendable out, String indent) throws IOException
|
||||
|
@ -259,5 +256,4 @@ public class ContextFactory implements ObjectFactory
|
|||
context.dump(out,indent+(last?" ":" | "));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,10 +86,7 @@ public class HttpChannel<T> implements HttpParser.RequestHandler<T>, Runnable, H
|
|||
protected static HttpChannel<?> setCurrentHttpChannel(HttpChannel<?> channel)
|
||||
{
|
||||
HttpChannel<?> last=__currentChannel.get();
|
||||
if (channel==null)
|
||||
__currentChannel.remove();
|
||||
else
|
||||
__currentChannel.set(channel);
|
||||
__currentChannel.set(channel);
|
||||
return last;
|
||||
}
|
||||
|
||||
|
|
|
@ -80,10 +80,7 @@ public class HttpConnection extends AbstractConnection implements Runnable, Http
|
|||
protected static HttpConnection setCurrentConnection(HttpConnection connection)
|
||||
{
|
||||
HttpConnection last=__currentConnection.get();
|
||||
if (connection==null)
|
||||
__currentConnection.remove();
|
||||
else
|
||||
__currentConnection.set(connection);
|
||||
__currentConnection.set(connection);
|
||||
return last;
|
||||
}
|
||||
|
||||
|
|
|
@ -496,7 +496,7 @@ public class GzipFilter extends UserAgentFilter
|
|||
_allocatedDeflater = new Deflater(_deflateCompressionLevel,_deflateNoWrap);
|
||||
else
|
||||
{
|
||||
_deflater.remove();
|
||||
_deflater.set(null);
|
||||
_allocatedDeflater.reset();
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ public class NonBlockingThread implements Runnable
|
|||
}
|
||||
finally
|
||||
{
|
||||
__nonBlockingThread.remove();
|
||||
__nonBlockingThread.set(Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue