Files
mono/mcs/class/System/System.Net/HttpStateCache.jvm.cs
T
Andrew Skiba cb848d4460 rename all jvm-only files to jvm.cs
svn path=/trunk/mcs/; revision=67540
2006-11-08 15:45:46 +00:00

44 lines
681 B
C#

using System;
using System.Collections;
using mainsoft.apache.commons.httpclient;
namespace System.Net
{
class HttpStateCache
{
private static readonly int MAX_SIZE = 30;
private Stack _states;
private int _currentSize;
internal HttpStateCache()
{
_states = new Stack(20);
}
internal HttpState GetHttpState()
{
lock(this)
{
if(_states.Count > 0)
return (HttpState) _states.Pop();
}
return new HttpState();
}
internal void ReleaseHttpState(HttpState state)
{
lock(this)
{
if(_states.Count < MAX_SIZE)
{
state.clear();
_states.Push(state);
}
}
}
}
}