Fix fpc pooling

Services implementation pooling
Services configuration in external file

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@216 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2007-07-18 20:27:46 +00:00
parent 726114b2ae
commit b78e642342
6 changed files with 918 additions and 162 deletions

View File

@@ -92,6 +92,7 @@ type
IItemFactoryEx = interface(IItemFactory) IItemFactoryEx = interface(IItemFactory)
['{66B77926-7E45-4780-8FFB-FB78625EDC1D}'] ['{66B77926-7E45-4780-8FFB-FB78625EDC1D}']
procedure ReleaseInstance(const AInstance : IInterface); procedure ReleaseInstance(const AInstance : IInterface);
procedure DiscardInstance(const AInstance : IInterface);
function GetPropertyManager( function GetPropertyManager(
const APropertyGroup : string; const APropertyGroup : string;
const ACreateIfNotExists : Boolean const ACreateIfNotExists : Boolean
@@ -1042,7 +1043,7 @@ type
FMin : PtrInt; FMin : PtrInt;
FMax : PtrInt; FMax : PtrInt;
private private
function CreateNew() : TIntfPoolItem; function CreateNew(const AUsed : Boolean) : TIntfPoolItem;
function TryGet(const AIndex : PtrInt) : Boolean; function TryGet(const AIndex : PtrInt) : Boolean;
public public
constructor Create( constructor Create(
@@ -1052,6 +1053,8 @@ type
destructor Destroy();override; destructor Destroy();override;
function Get(const ATimeOut : Cardinal) : IInterface; function Get(const ATimeOut : Cardinal) : IInterface;
procedure Release(const AItem : IInterface); procedure Release(const AItem : IInterface);
procedure Discard(const AItem : IInterface);
function GetInstancesCount() : PtrInt;
property Min : PtrInt read FMin; property Min : PtrInt read FMin;
property Max : PtrInt read FMax; property Max : PtrInt read FMax;
end; end;
@@ -1075,6 +1078,7 @@ type
protected protected
function CreateInstance():IInterface;override; function CreateInstance():IInterface;override;
procedure ReleaseInstance(const AInstance : IInterface);virtual; procedure ReleaseInstance(const AInstance : IInterface);virtual;
procedure DiscardInstance(const AInstance : IInterface);virtual;
function GetPropertyManager( function GetPropertyManager(
const APropertyGroup : string; const APropertyGroup : string;
const ACreateIfNotExists : Boolean const ACreateIfNotExists : Boolean
@@ -2153,6 +2157,12 @@ begin
end; end;
end; end;
procedure TSimpleItemFactoryEx.DiscardInstance(const AInstance : IInterface);
begin
if Pooled then
FPool.Discard(AInstance);
end;
function TSimpleItemFactoryEx.GetPropertyManager( function TSimpleItemFactoryEx.GetPropertyManager(
const APropertyGroup : string; const APropertyGroup : string;
const ACreateIfNotExists : Boolean const ACreateIfNotExists : Boolean
@@ -4303,7 +4313,7 @@ end;
constructor TIntfPoolItem.Create(AIntf: IInterface; const AUsed: Boolean); constructor TIntfPoolItem.Create(AIntf: IInterface; const AUsed: Boolean);
begin begin
FIntf := AIntf; FIntf := AIntf as IInterface;
FUsed := AUsed; FUsed := AUsed;
end; end;
@@ -4315,11 +4325,11 @@ end;
{ TIntfPool } { TIntfPool }
function TIntfPool.CreateNew(): TIntfPoolItem; function TIntfPool.CreateNew(const AUsed : Boolean): TIntfPoolItem;
begin begin
FCS.Acquire(); FCS.Acquire();
try try
Result := TIntfPoolItem.Create(FFactory.CreateInstance(),True); Result := TIntfPoolItem.Create(FFactory.CreateInstance(),AUsed);
FList.Add(Result); FList.Add(Result);
finally finally
FCS.Release(); FCS.Release();
@@ -4349,7 +4359,8 @@ constructor TIntfPool.Create(
var var
i : PtrInt; i : PtrInt;
begin begin
Assert( ( AMin >= 0 ) and ( AMax >= AMin ) and ( AFactory <> nil ) ); if not ( ( AMin >= 0 ) and ( AMax >= AMin ) and ( AFactory <> nil ) ) then
raise Exception.CreateFmt('Invalid pool arguments Min = %d; Max = %d .',[AMin,AMax]);
FMax := AMax; FMax := AMax;
FMin := AMin; FMin := AMin;
FFactory := AFactory; FFactory := AFactory;
@@ -4357,7 +4368,7 @@ begin
FList := TObjectList.Create(True); FList := TObjectList.Create(True);
FCS := TCriticalSection.Create(); FCS := TCriticalSection.Create();
for i := 0 to Pred(AMin) do begin for i := 0 to Pred(AMin) do begin
CreateNew(); CreateNew(False);
end; end;
end; end;
@@ -4383,7 +4394,7 @@ begin
end; end;
end; end;
if ( Result = nil ) then begin if ( Result = nil ) then begin
Result := CreateNew().Intf; Result := CreateNew(True).Intf;
end; end;
end else begin end else begin
raise EServiceException.Create('Unable to create the object : Timeout expired.'); raise EServiceException.Create('Unable to create the object : Timeout expired.');
@@ -4393,9 +4404,11 @@ end;
procedure TIntfPool.Release(const AItem: IInterface); procedure TIntfPool.Release(const AItem: IInterface);
var var
i : PtrInt; i : PtrInt;
a : IInterface;
begin begin
a := AItem as IInterface;
for i := 0 to Pred(FList.Count) do begin for i := 0 to Pred(FList.Count) do begin
if ( TIntfPoolItem(FList[i]).Intf = AItem ) then begin if ( TIntfPoolItem(FList[i]).Intf = a ) then begin
TIntfPoolItem(FList[i]).Used := False; TIntfPoolItem(FList[i]).Used := False;
FLock.Release(); FLock.Release();
Break; Break;
@@ -4403,6 +4416,34 @@ begin
end; end;
end; end;
procedure TIntfPool.Discard(const AItem : IInterface);
var
i : PtrInt;
a : IInterface;
itm : TIntfPoolItem;
begin
a := AItem as IInterface;
for i := 0 to Pred(FList.Count) do begin
if ( TIntfPoolItem(FList[i]).Intf = a ) then begin
itm := TIntfPoolItem(FList[i]);
itm.FIntf := FFactory.CreateInstance() as IInterface;
itm.Used := False;
FLock.Release();
Break;
end;
end;
end;
function TIntfPool.GetInstancesCount() : PtrInt;
begin
FCS.Acquire();
try
Result := FList.Count;
finally
FCS.Release();
end;
end;
{ TStringBufferRemotable } { TStringBufferRemotable }
class procedure TStringBufferRemotable.Save ( class procedure TStringBufferRemotable.Save (

View File

@@ -12,7 +12,7 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=".exe"/> <TargetFileExt Value=".exe"/>
<ActiveEditorIndexAtStart Value="8"/> <ActiveEditorIndexAtStart Value="3"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@@ -34,15 +34,15 @@
<PackageName Value="indylaz"/> <PackageName Value="indylaz"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="54"> <Units Count="55">
<Unit0> <Unit0>
<Filename Value="http_server.pas"/> <Filename Value="http_server.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="http_server"/> <UnitName Value="http_server"/>
<CursorPos X="14" Y="30"/> <CursorPos X="3" Y="34"/>
<TopLine Value="13"/> <TopLine Value="1"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="103"/> <UsageCount Value="121"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@@ -50,15 +50,15 @@
<UnitName Value="app_object"/> <UnitName Value="app_object"/>
<CursorPos X="42" Y="214"/> <CursorPos X="42" Y="214"/>
<TopLine Value="200"/> <TopLine Value="200"/>
<UsageCount Value="33"/> <UsageCount Value="31"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="..\..\base_service_intf.pas"/> <Filename Value="..\..\base_service_intf.pas"/>
<UnitName Value="base_service_intf"/> <UnitName Value="base_service_intf"/>
<CursorPos X="1" Y="4398"/> <CursorPos X="1" Y="1"/>
<TopLine Value="4387"/> <TopLine Value="1"/>
<EditorIndex Value="8"/> <EditorIndex Value="8"/>
<UsageCount Value="49"/> <UsageCount Value="58"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
@@ -67,7 +67,7 @@
<CursorPos X="80" Y="80"/> <CursorPos X="80" Y="80"/>
<TopLine Value="66"/> <TopLine Value="66"/>
<EditorIndex Value="9"/> <EditorIndex Value="9"/>
<UsageCount Value="50"/> <UsageCount Value="59"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
@@ -75,34 +75,34 @@
<UnitName Value="metadata_service_imp"/> <UnitName Value="metadata_service_imp"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="34"/> <UsageCount Value="32"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="..\user_service_intf_imp.pas"/> <Filename Value="..\user_service_intf_imp.pas"/>
<UnitName Value="user_service_intf_imp"/> <UnitName Value="user_service_intf_imp"/>
<CursorPos X="1" Y="1"/> <CursorPos X="46" Y="21"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="6"/> <EditorIndex Value="6"/>
<UsageCount Value="47"/> <UsageCount Value="56"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="..\user_service_intf_binder.pas"/> <Filename Value="..\user_service_intf_binder.pas"/>
<UnitName Value="user_service_intf_binder"/> <UnitName Value="user_service_intf_binder"/>
<CursorPos X="55" Y="16"/> <CursorPos X="39" Y="83"/>
<TopLine Value="14"/> <TopLine Value="224"/>
<EditorIndex Value="3"/> <EditorIndex Value="3"/>
<UsageCount Value="33"/> <UsageCount Value="42"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<Filename Value="..\user_service_intf.pas"/> <Filename Value="..\user_service_intf.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="user_service_intf"/> <UnitName Value="user_service_intf"/>
<CursorPos X="3" Y="119"/> <CursorPos X="7" Y="3"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="7"/> <EditorIndex Value="7"/>
<UsageCount Value="54"/> <UsageCount Value="72"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
@@ -111,23 +111,23 @@
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="7"/> <TopLine Value="7"/>
<EditorIndex Value="12"/> <EditorIndex Value="12"/>
<UsageCount Value="50"/> <UsageCount Value="59"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
<Filename Value="..\..\semaphore.pas"/> <Filename Value="..\..\semaphore.pas"/>
<UnitName Value="semaphore"/> <UnitName Value="semaphore"/>
<CursorPos X="2" Y="12"/> <CursorPos X="1" Y="141"/>
<TopLine Value="1"/> <TopLine Value="117"/>
<UsageCount Value="27"/> <UsageCount Value="25"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="..\..\server_service_intf.pas"/> <Filename Value="..\..\server_service_intf.pas"/>
<UnitName Value="server_service_intf"/> <UnitName Value="server_service_intf"/>
<CursorPos X="67" Y="105"/> <CursorPos X="1" Y="1"/>
<TopLine Value="102"/> <TopLine Value="1"/>
<EditorIndex Value="5"/> <EditorIndex Value="5"/>
<UsageCount Value="49"/> <UsageCount Value="58"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
@@ -135,171 +135,171 @@
<UnitName Value="server_service_soap"/> <UnitName Value="server_service_soap"/>
<CursorPos X="17" Y="22"/> <CursorPos X="17" Y="22"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="42"/> <UsageCount Value="40"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="..\..\base_soap_formatter.pas"/> <Filename Value="..\..\base_soap_formatter.pas"/>
<UnitName Value="base_soap_formatter"/> <UnitName Value="base_soap_formatter"/>
<CursorPos X="36" Y="1576"/> <CursorPos X="36" Y="1576"/>
<TopLine Value="1586"/> <TopLine Value="1586"/>
<UsageCount Value="43"/> <UsageCount Value="41"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
<Filename Value="..\..\server_service_imputils.pas"/> <Filename Value="..\..\server_service_imputils.pas"/>
<UnitName Value="server_service_imputils"/> <UnitName Value="server_service_imputils"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="37"/> <UsageCount Value="35"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
<Filename Value="..\..\..\..\..\..\lazarus_23_215\others_package\indy\indy-10.2.0.1\fpc\Protocols\IdCustomHTTPServer.pas"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215\others_package\indy\indy-10.2.0.1\fpc\Protocols\IdCustomHTTPServer.pas"/>
<UnitName Value="IdCustomHTTPServer"/> <UnitName Value="IdCustomHTTPServer"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="4"/> <UsageCount Value="2"/>
</Unit14> </Unit14>
<Unit15> <Unit15>
<Filename Value="..\..\..\..\..\..\lazarus23_213\fpc\2.1.3\source\rtl\i386\i386.inc"/> <Filename Value="..\..\..\..\..\..\lazarus23_213\fpc\2.1.3\source\rtl\i386\i386.inc"/>
<CursorPos X="49" Y="1252"/> <CursorPos X="49" Y="1252"/>
<TopLine Value="1231"/> <TopLine Value="1231"/>
<UsageCount Value="4"/> <UsageCount Value="2"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="..\..\wst.inc"/> <Filename Value="..\..\wst.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="3"/> <UsageCount Value="1"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="..\..\xmlrpc_formatter.pas"/> <Filename Value="..\..\xmlrpc_formatter.pas"/>
<UnitName Value="xmlrpc_formatter"/> <UnitName Value="xmlrpc_formatter"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="28"/> <TopLine Value="28"/>
<UsageCount Value="4"/> <UsageCount Value="2"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="..\..\server_service_xmlrpc.pas"/> <Filename Value="..\..\server_service_xmlrpc.pas"/>
<UnitName Value="server_service_xmlrpc"/> <UnitName Value="server_service_xmlrpc"/>
<CursorPos X="21" Y="22"/> <CursorPos X="21" Y="22"/>
<TopLine Value="7"/> <TopLine Value="7"/>
<UsageCount Value="40"/> <UsageCount Value="38"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
<Filename Value="..\..\server_binary_formatter.pas"/> <Filename Value="..\..\server_binary_formatter.pas"/>
<UnitName Value="server_binary_formatter"/> <UnitName Value="server_binary_formatter"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="38"/> <UsageCount Value="36"/>
</Unit19> </Unit19>
<Unit20> <Unit20>
<Filename Value="..\..\base_xmlrpc_formatter.pas"/> <Filename Value="..\..\base_xmlrpc_formatter.pas"/>
<UnitName Value="base_xmlrpc_formatter"/> <UnitName Value="base_xmlrpc_formatter"/>
<CursorPos X="3" Y="985"/> <CursorPos X="3" Y="985"/>
<TopLine Value="974"/> <TopLine Value="974"/>
<UsageCount Value="38"/> <UsageCount Value="36"/>
</Unit20> </Unit20>
<Unit21> <Unit21>
<Filename Value="..\..\..\..\..\..\lazarus23_213\others_package\indy\indy-10.2.0.1\fpc\Core\IdSocketHandle.pas"/> <Filename Value="..\..\..\..\..\..\lazarus23_213\others_package\indy\indy-10.2.0.1\fpc\Core\IdSocketHandle.pas"/>
<UnitName Value="IdSocketHandle"/> <UnitName Value="IdSocketHandle"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="4"/> <UsageCount Value="2"/>
</Unit21> </Unit21>
<Unit22> <Unit22>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\others_package\indy\indy-10.2.0.1\lazarus\IdAboutVCL.pas"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\others_package\indy\indy-10.2.0.1\lazarus\IdAboutVCL.pas"/>
<UnitName Value="IdAboutVCL"/> <UnitName Value="IdAboutVCL"/>
<CursorPos X="19" Y="1"/> <CursorPos X="19" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="5"/> <UsageCount Value="3"/>
</Unit22> </Unit22>
<Unit23> <Unit23>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\others_package\indy\indy-10.2.0.1\fpc\System\IdGlobal.pas"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\others_package\indy\indy-10.2.0.1\fpc\System\IdGlobal.pas"/>
<UnitName Value="IdGlobal"/> <UnitName Value="IdGlobal"/>
<CursorPos X="59" Y="982"/> <CursorPos X="59" Y="982"/>
<TopLine Value="981"/> <TopLine Value="981"/>
<UsageCount Value="5"/> <UsageCount Value="3"/>
</Unit23> </Unit23>
<Unit24> <Unit24>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\systemh.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\systemh.inc"/>
<CursorPos X="21" Y="208"/> <CursorPos X="21" Y="208"/>
<TopLine Value="193"/> <TopLine Value="193"/>
<EditorIndex Value="11"/> <EditorIndex Value="11"/>
<UsageCount Value="31"/> <UsageCount Value="40"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit24> </Unit24>
<Unit25> <Unit25>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\innr.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\innr.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="42"/> <TopLine Value="42"/>
<UsageCount Value="5"/> <UsageCount Value="3"/>
</Unit25> </Unit25>
<Unit26> <Unit26>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\i386\fastmove.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\i386\fastmove.inc"/>
<CursorPos X="11" Y="835"/> <CursorPos X="11" Y="835"/>
<TopLine Value="821"/> <TopLine Value="821"/>
<UsageCount Value="6"/> <UsageCount Value="4"/>
</Unit26> </Unit26>
<Unit27> <Unit27>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\system.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\system.inc"/>
<CursorPos X="11" Y="306"/> <CursorPos X="11" Y="306"/>
<TopLine Value="285"/> <TopLine Value="285"/>
<UsageCount Value="39"/> <UsageCount Value="37"/>
</Unit27> </Unit27>
<Unit28> <Unit28>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\generic.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\generic.inc"/>
<CursorPos X="5" Y="1289"/> <CursorPos X="5" Y="1289"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="12"/> <UsageCount Value="10"/>
</Unit28> </Unit28>
<Unit29> <Unit29>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\system.fpd"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\system.fpd"/>
<CursorPos X="22" Y="17"/> <CursorPos X="22" Y="17"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="5"/> <UsageCount Value="3"/>
</Unit29> </Unit29>
<Unit30> <Unit30>
<Filename Value="..\..\wst_fpc_xml.pas"/> <Filename Value="..\..\wst_fpc_xml.pas"/>
<UnitName Value="wst_fpc_xml"/> <UnitName Value="wst_fpc_xml"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="38"/> <UsageCount Value="36"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\sysutils\sysstrh.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\sysutils\sysstrh.inc"/>
<CursorPos X="11" Y="66"/> <CursorPos X="11" Y="66"/>
<TopLine Value="52"/> <TopLine Value="52"/>
<UsageCount Value="38"/> <UsageCount Value="36"/>
</Unit31> </Unit31>
<Unit32> <Unit32>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\sysutils\sysstr.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\sysutils\sysstr.inc"/>
<CursorPos X="6" Y="44"/> <CursorPos X="6" Y="44"/>
<TopLine Value="30"/> <TopLine Value="30"/>
<UsageCount Value="5"/> <UsageCount Value="3"/>
</Unit32> </Unit32>
<Unit33> <Unit33>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\win\sysosh.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\win\sysosh.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="51"/> <TopLine Value="51"/>
<UsageCount Value="5"/> <UsageCount Value="3"/>
</Unit33> </Unit33>
<Unit34> <Unit34>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\objpash.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\objpash.inc"/>
<CursorPos X="8" Y="216"/> <CursorPos X="25" Y="216"/>
<TopLine Value="203"/> <TopLine Value="203"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit34> </Unit34>
<Unit35> <Unit35>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\varianth.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\varianth.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="5"/> <UsageCount Value="3"/>
</Unit35> </Unit35>
<Unit36> <Unit36>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\rtti.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\rtti.inc"/>
<CursorPos X="36" Y="64"/> <CursorPos X="36" Y="64"/>
<TopLine Value="101"/> <TopLine Value="101"/>
<EditorIndex Value="4"/> <EditorIndex Value="4"/>
<UsageCount Value="38"/> <UsageCount Value="47"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit36> </Unit36>
<Unit37> <Unit37>
@@ -307,20 +307,20 @@
<UnitName Value="metadata_service"/> <UnitName Value="metadata_service"/>
<CursorPos X="26" Y="13"/> <CursorPos X="26" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="34"/> <UsageCount Value="32"/>
</Unit37> </Unit37>
<Unit38> <Unit38>
<Filename Value="..\..\wst_rtti_filter\cursor_intf.pas"/> <Filename Value="..\..\wst_rtti_filter\cursor_intf.pas"/>
<UnitName Value="cursor_intf"/> <UnitName Value="cursor_intf"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="23"/> <UsageCount Value="21"/>
</Unit38> </Unit38>
<Unit39> <Unit39>
<Filename Value="..\user_service_intf.wst"/> <Filename Value="..\user_service_intf.wst"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="6"/> <UsageCount Value="4"/>
<SyntaxHighlighter Value="None"/> <SyntaxHighlighter Value="None"/>
</Unit39> </Unit39>
<Unit40> <Unit40>
@@ -328,7 +328,7 @@
<UnitName Value="DOM"/> <UnitName Value="DOM"/>
<CursorPos X="42" Y="228"/> <CursorPos X="42" Y="228"/>
<TopLine Value="215"/> <TopLine Value="215"/>
<UsageCount Value="14"/> <UsageCount Value="12"/>
</Unit40> </Unit40>
<Unit41> <Unit41>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\typinfo.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\typinfo.pp"/>
@@ -336,7 +336,7 @@
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="115"/> <TopLine Value="115"/>
<EditorIndex Value="10"/> <EditorIndex Value="10"/>
<UsageCount Value="32"/> <UsageCount Value="41"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit41> </Unit41>
<Unit42> <Unit42>
@@ -344,14 +344,14 @@
<UnitName Value="user_service_intf_proxy"/> <UnitName Value="user_service_intf_proxy"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="31"/> <UsageCount Value="29"/>
</Unit42> </Unit42>
<Unit43> <Unit43>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\others_package\indy\indy-10.2.0.1\fpc\Protocols\IdCustomHTTPServer.pas"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\others_package\indy\indy-10.2.0.1\fpc\Protocols\IdCustomHTTPServer.pas"/>
<UnitName Value="IdCustomHTTPServer"/> <UnitName Value="IdCustomHTTPServer"/>
<CursorPos X="14" Y="252"/> <CursorPos X="14" Y="252"/>
<TopLine Value="239"/> <TopLine Value="239"/>
<UsageCount Value="8"/> <UsageCount Value="6"/>
</Unit43> </Unit43>
<Unit44> <Unit44>
<Filename Value="..\..\type_lib_edtr\uabout.pas"/> <Filename Value="..\..\type_lib_edtr\uabout.pas"/>
@@ -361,7 +361,7 @@
<UnitName Value="uabout"/> <UnitName Value="uabout"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="8"/> <UsageCount Value="6"/>
</Unit44> </Unit44>
<Unit45> <Unit45>
<Filename Value="..\..\type_lib_edtr\uwsttypelibraryedit.pas"/> <Filename Value="..\..\type_lib_edtr\uwsttypelibraryedit.pas"/>
@@ -370,7 +370,7 @@
<UnitName Value="uwsttypelibraryedit"/> <UnitName Value="uwsttypelibraryedit"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="7"/> <UsageCount Value="5"/>
</Unit45> </Unit45>
<Unit46> <Unit46>
<Filename Value="..\..\ide\lazarus\wstimportdlg.pas"/> <Filename Value="..\..\ide\lazarus\wstimportdlg.pas"/>
@@ -380,7 +380,7 @@
<UnitName Value="wstimportdlg"/> <UnitName Value="wstimportdlg"/>
<CursorPos X="27" Y="7"/> <CursorPos X="27" Y="7"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="8"/> <UsageCount Value="6"/>
</Unit46> </Unit46>
<Unit47> <Unit47>
<Filename Value="..\..\indy_http_server.pas"/> <Filename Value="..\..\indy_http_server.pas"/>
@@ -388,7 +388,7 @@
<CursorPos X="1" Y="317"/> <CursorPos X="1" Y="317"/>
<TopLine Value="293"/> <TopLine Value="293"/>
<EditorIndex Value="2"/> <EditorIndex Value="2"/>
<UsageCount Value="24"/> <UsageCount Value="33"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit47> </Unit47>
<Unit48> <Unit48>
@@ -396,44 +396,171 @@
<UnitName Value="server_listener"/> <UnitName Value="server_listener"/>
<CursorPos X="28" Y="33"/> <CursorPos X="28" Y="33"/>
<TopLine Value="26"/> <TopLine Value="26"/>
<UsageCount Value="23"/> <UsageCount Value="21"/>
</Unit48> </Unit48>
<Unit49> <Unit49>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\aliases.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\aliases.inc"/>
<CursorPos X="84" Y="14"/> <CursorPos X="84" Y="14"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="13"/> <UsageCount Value="11"/>
</Unit49> </Unit49>
<Unit50> <Unit50>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\variant.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\variant.inc"/>
<CursorPos X="11" Y="24"/> <CursorPos X="11" Y="24"/>
<TopLine Value="29"/> <TopLine Value="29"/>
<UsageCount Value="13"/> <UsageCount Value="11"/>
</Unit50> </Unit50>
<Unit51> <Unit51>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\sysutils\osutilsh.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\sysutils\osutilsh.inc"/>
<CursorPos X="53" Y="37"/> <CursorPos X="53" Y="37"/>
<TopLine Value="30"/> <TopLine Value="30"/>
<UsageCount Value="16"/> <UsageCount Value="14"/>
</Unit51> </Unit51>
<Unit52> <Unit52>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\win\sysutils.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\win\sysutils.pp"/>
<UnitName Value="sysutils"/> <UnitName Value="sysutils"/>
<CursorPos X="45" Y="1084"/> <CursorPos X="45" Y="1084"/>
<TopLine Value="1076"/> <TopLine Value="1076"/>
<UsageCount Value="16"/> <UsageCount Value="14"/>
</Unit52> </Unit52>
<Unit53> <Unit53>
<Filename Value="..\..\config_objects.pas"/> <Filename Value="..\..\config_objects.pas"/>
<UnitName Value="config_objects"/> <UnitName Value="config_objects"/>
<CursorPos X="1" Y="1"/> <CursorPos X="59" Y="16"/>
<TopLine Value="22"/> <TopLine Value="1"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<UsageCount Value="13"/> <UsageCount Value="22"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit53> </Unit53>
<Unit54>
<Filename Value="..\..\wst_delphi.inc"/>
<CursorPos X="22" Y="5"/>
<TopLine Value="1"/>
<UsageCount Value="8"/>
</Unit54>
</Units> </Units>
<JumpHistory Count="0" HistoryIndex="-1"/> <JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1002" Column="23" TopLine="989"/>
</Position1>
<Position2>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="2094" Column="54" TopLine="2093"/>
</Position2>
<Position3>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1004" Column="37" TopLine="996"/>
</Position3>
<Position4>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1095" Column="1" TopLine="1070"/>
</Position4>
<Position5>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1061" Column="23" TopLine="1048"/>
</Position5>
<Position6>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="2204" Column="1" TopLine="2192"/>
</Position6>
<Position7>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position7>
<Position8>
<Filename Value="..\user_service_intf_imp.pas"/>
<Caret Line="21" Column="46" TopLine="1"/>
</Position8>
<Position9>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="177" Column="52" TopLine="164"/>
</Position9>
<Position10>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="156" Column="41" TopLine="145"/>
</Position10>
<Position11>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="4398" Column="3" TopLine="4393"/>
</Position11>
<Position12>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position12>
<Position13>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="94" Column="30" TopLine="81"/>
</Position13>
<Position14>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1077" Column="30" TopLine="1064"/>
</Position14>
<Position15>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="2149" Column="47" TopLine="2136"/>
</Position15>
<Position16>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position16>
<Position17>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="94" Column="22" TopLine="81"/>
</Position17>
<Position18>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1054" Column="22" TopLine="1041"/>
</Position18>
<Position19>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1077" Column="22" TopLine="1064"/>
</Position19>
<Position20>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="2149" Column="39" TopLine="2136"/>
</Position20>
<Position21>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="2152" Column="18" TopLine="2139"/>
</Position21>
<Position22>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="4325" Column="16" TopLine="4312"/>
</Position22>
<Position23>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="4341" Column="16" TopLine="4328"/>
</Position23>
<Position24>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="4439" Column="35" TopLine="4417"/>
</Position24>
<Position25>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="4457" Column="44" TopLine="4437"/>
</Position25>
<Position26>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position26>
<Position27>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="94" Column="22" TopLine="81"/>
</Position27>
<Position28>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="4412" Column="5" TopLine="4381"/>
</Position28>
<Position29>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="158" Column="35" TopLine="44"/>
</Position29>
<Position30>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="177" Column="79" TopLine="157"/>
</Position30>
</JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="5"/>

View File

@@ -191,6 +191,7 @@ Type
IServiceImplementationFactory IServiceImplementationFactory
) )
protected protected
procedure ReleaseInstance(const AInstance : IInterface);override;
procedure RegisterExtension( procedure RegisterExtension(
const AExtensionList : array of string const AExtensionList : array of string
); );
@@ -679,6 +680,20 @@ end;
{ TImplementationFactory } { TImplementationFactory }
const sSERVICES_EXTENSIONS = 'extensions';sLIST = 'list'; const sSERVICES_EXTENSIONS = 'extensions';sLIST = 'list';
procedure TImplementationFactory.ReleaseInstance(const AInstance : IInterface);
var
objCtrl : IObjectControl;
begin
if Pooled and
Supports(AInstance,IObjectControl,objCtrl) and
( not objCtrl.CanBePooled() )
then begin
DiscardInstance(AInstance);
end else begin
inherited ReleaseInstance(AInstance);
end;
end;
procedure TImplementationFactory.RegisterExtension( procedure TImplementationFactory.RegisterExtension(
const AExtensionList : array of string const AExtensionList : array of string
); );

View File

@@ -0,0 +1,448 @@
unit test_utilities;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, fpcunit, testutils, testregistry,
TypInfo,
base_service_intf, server_service_intf;
type
ITest = interface
['{61442DCF-0F6B-490F-AA33-FF856C07A757}']
procedure SayHello();
procedure DontPool();
end;
{ TTestClass }
TTestClass = class(TActivableServiceImplementation,IObjectControl,ITest)
private
FPooled : Boolean;
protected
procedure SayHello();
function CanBePooled() : Boolean;
procedure DontPool();
public
constructor Create();override;
end;
{ TTest_TIntfPool }
TTest_TIntfPool= class(TTestCase)
published
procedure Create_ZEROS();
procedure Create_NON_ZERO_MIN();
procedure Release();
procedure Release_NON();
procedure Discard();
end;
{ TTest_TSimpleItemFactoryEx }
TTest_TSimpleItemFactoryEx = class(TTestCase)
published
procedure NOT_Pooled();
procedure POOLED_Create_ZEROS();
procedure POOLED_Release();
procedure POOLED_Release_NON();
procedure POOLED_Discard();
end;
{ TTest_TImplementationFactory }
TTest_TImplementationFactory = class(TTestCase)
published
procedure POOLED_Discard();
end;
implementation
{ TTestClass }
procedure TTestClass.SayHello();
begin
end;
function TTestClass.CanBePooled() : Boolean;
begin
Result := FPooled;
end;
procedure TTestClass.DontPool();
begin
FPooled := False;
end;
constructor TTestClass.Create();
begin
inherited Create();
FPooled := True;
_AddRef(); // not to allow the rtl to reuse the same memory for another instance of the same class!!
end;
{ TTest_TIntfPool }
procedure TTest_TIntfPool.Create_ZEROS();
var
ok : Boolean;
obj : TIntfPool;
begin
ok := False;
try
obj := TIntfPool.Create(0,0,TSimpleItemFactory.Create(TTestClass));
except
ok := True;
end;
Check(ok);
end;
procedure TTest_TIntfPool.Create_NON_ZERO_MIN();
const MIN_A = Integer(1); MAX_A = Integer(5);
var
obj : TIntfPool;
begin
obj := TIntfPool.Create(MIN_A,MAX_A,TSimpleItemFactory.Create(TTestClass));
CheckEquals(MIN_A,obj.Min);
CheckEquals(MAX_A,obj.Max);
CheckEquals(MIN_A,obj.GetInstancesCount());
end;
procedure TTest_TIntfPool.Release();
const MIN_A = Integer(1); MAX_A = Integer(5); MIN_B = Integer(0);
var
obj : TIntfPool;
elt : ITest;
i : Integer;
begin
obj := TIntfPool.Create(MIN_A,MAX_A,TSimpleItemFactory.Create(TTestClass));
for i := 0 to 300 do begin
elt := obj.Get(0) as ITest;
elt.SayHello();
obj.Release(elt);
end;
FreeAndNil(obj);
obj := TIntfPool.Create(MIN_B,MAX_A,TSimpleItemFactory.Create(TTestClass));
for i := 0 to 300 do begin
elt := obj.Get(0) as ITest;
elt.SayHello();
obj.Release(elt);
end;
FreeAndNil(obj);
obj := TIntfPool.Create(MAX_A,MAX_A,TSimpleItemFactory.Create(TTestClass));
for i := 0 to 300 do begin
elt := obj.Get(0) as ITest;
elt.SayHello();
obj.Release(elt);
end;
end;
procedure TTest_TIntfPool.Release_NON();
const MIN_A = Integer(1); MAX_A = Integer(5); MIN_B = Integer(0);
var
obj : TIntfPool;
elt : ITest;
i : Integer;
ok : Boolean;
il : IInterfaceList;
begin
il := TInterfaceList.Create();
obj := TIntfPool.Create(MIN_A,MAX_A,TSimpleItemFactory.Create(TTestClass));
for i := 1 to MAX_A do begin
elt := obj.Get(100) as ITest;
elt.SayHello();
il.Add(elt);
//obj.Release(elt); do not release
end;
ok := False;
try
elt := obj.Get(100) as ITest;
except
ok := True;
end;
Check(ok);
CheckEquals(MAX_A,obj.GetInstancesCount());
for i := 0 to Pred(MAX_A) do begin
obj.Release(il[0]);
il.Delete(0);
end;
for i := 1 to 100 do begin
elt := obj.Get(100) as ITest;
elt.SayHello();
il.Add(elt);
obj.Release(elt);
end;
end;
procedure TTest_TIntfPool.Discard();
const MIN_A = Integer(1); MAX_A = Integer(5); MIN_B = Integer(0);
var
obj : TIntfPool;
oldElt, elt : ITest;
begin
obj := TIntfPool.Create(MIN_A,MIN_A,TSimpleItemFactory.Create(TTestClass));
elt := obj.Get(10) as ITest;
oldElt := elt;
obj.Release(elt);
elt := obj.Get(10) as ITest;
Check(oldElt = elt);
obj.Discard(elt);
elt := obj.Get(10) as ITest;
Check(oldElt <> elt );
FreeAndNil(obj);oldElt := nil; elt := nil;
obj := TIntfPool.Create(MIN_A,MAX_A,TSimpleItemFactory.Create(TTestClass));
elt := obj.Get(10) as ITest;
oldElt := elt;
obj.Release(elt);
elt := obj.Get(10) as ITest;
Check(oldElt = elt);
obj.Discard(elt);
elt := obj.Get(10) as ITest;
Check(oldElt <> elt );
FreeAndNil(obj);oldElt := nil; elt := nil;
obj := TIntfPool.Create(MIN_B,MIN_A,TSimpleItemFactory.Create(TTestClass));
elt := obj.Get(10) as ITest;
oldElt := elt;
obj.Release(elt);
elt := obj.Get(10) as ITest;
Check(oldElt = elt);
obj.Discard(elt);
elt := obj.Get(10) as ITest;
Check(oldElt <> elt );
FreeAndNil(obj);oldElt := nil; elt := nil;
obj := TIntfPool.Create(MIN_B,MAX_A,TSimpleItemFactory.Create(TTestClass));
elt := obj.Get(10) as ITest;
oldElt := elt;
obj.Release(elt);
elt := obj.Get(10) as ITest;
Check(oldElt = elt);
obj.Discard(elt);
elt := obj.Get(10) as ITest;
Check(oldElt <> elt );
end;
{ TTest_TSimpleItemFactoryEx }
procedure TTest_TSimpleItemFactoryEx.NOT_Pooled();
const MIN_A = Integer(1); MAX_A = Integer(5); MIN_B = Integer(0);
var
obj : IItemFactoryEx;
elt : ITest;
i : Integer;
begin
obj := TSimpleItemFactoryEx.Create(TTestClass);
for i := 0 to 300 do begin
elt := obj.CreateInstance() as ITest;
elt.SayHello();
end;
obj := TSimpleItemFactoryEx.Create(TTestClass,'');
for i := 0 to 300 do begin
elt := obj.CreateInstance() as ITest;
elt.SayHello();
end;
end;
procedure TTest_TSimpleItemFactoryEx.POOLED_Create_ZEROS();
var
ok : Boolean;
obj : IItemFactoryEx;
begin
ok := False;
try
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;Pooled=True',[0,0]));
except
ok := True;
end;
Check(ok);
end;
procedure TTest_TSimpleItemFactoryEx.POOLED_Release();
const MIN_A = Integer(1); MAX_A = Integer(5); MIN_B = Integer(0);
var
obj : IItemFactoryEx;
elt : ITest;
i : Integer;
begin
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;Pooled=True',[MIN_A,MAX_A]));
for i := 0 to 300 do begin
elt := obj.CreateInstance() as ITest;
elt.SayHello();
obj.ReleaseInstance(elt);
end;
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;Pooled=True',[MIN_B,MAX_A]));
for i := 0 to 300 do begin
elt := obj.CreateInstance() as ITest;
elt.SayHello();
obj.ReleaseInstance(elt);
end;
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;Pooled=True',[MAX_A,MAX_A]));
for i := 0 to 300 do begin
elt := obj.CreateInstance() as ITest;
elt.SayHello();
obj.ReleaseInstance(elt);
end;
end;
procedure TTest_TSimpleItemFactoryEx.POOLED_Release_NON();
const MIN_A = Integer(1); MAX_A = Integer(5); MIN_B = Integer(0);
var
obj : IItemFactoryEx;
elt : ITest;
i : Integer;
ok : Boolean;
il : IInterfaceList;
begin
il := TInterfaceList.Create();
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_A,MAX_A]));
for i := 1 to MAX_A do begin
elt := obj.CreateInstance() as ITest;
elt.SayHello();
il.Add(elt);
//obj.Release(elt); do not release
end;
ok := False;
try
elt := obj.CreateInstance() as ITest;
except
ok := True;
end;
Check(ok);
for i := 0 to Pred(MAX_A) do begin
obj.ReleaseInstance(il[0]);
il.Delete(0);
end;
for i := 1 to 100 do begin
elt := obj.CreateInstance() as ITest;
elt.SayHello();
il.Add(elt);
obj.ReleaseInstance(elt);
end;
end;
procedure TTest_TSimpleItemFactoryEx.POOLED_Discard();
const MIN_A = Integer(1); MAX_A = Integer(5); MIN_B = Integer(0);
var
obj : IItemFactoryEx;
oldElt, elt : ITest;
begin
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_A,MIN_A]));
elt := obj.CreateInstance() as ITest;
oldElt := elt;
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt = elt,'1.1');
obj.DiscardInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt <> elt, '1.2' );
oldElt := nil; elt := nil;
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_A,MAX_A]));
elt := obj.CreateInstance() as ITest;
oldElt := elt;
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt = elt,'2.1');
obj.DiscardInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt <> elt ,'2.2');
oldElt := nil; elt := nil;
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_B,MIN_A]));
elt := obj.CreateInstance() as ITest;
oldElt := elt;
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt = elt,'3.1');
obj.DiscardInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt <> elt ,'3.2');
oldElt := nil; elt := nil;
obj := TSimpleItemFactoryEx.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_B,MAX_A]));
elt := obj.CreateInstance() as ITest;
oldElt := elt;
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt = elt,'4.1');
obj.DiscardInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt <> elt,'4.2');
end;
{ TTest_TImplementationFactory }
procedure TTest_TImplementationFactory.POOLED_Discard();
const MIN_A = Integer(1); MAX_A = Integer(5); MIN_B = Integer(0);
var
obj : IItemFactoryEx;
oldElt, elt : ITest;
begin
obj := TImplementationFactory.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_A,MIN_A]));
elt := obj.CreateInstance() as ITest;
oldElt := elt;
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt = elt,'1.1');
elt.DontPool();
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt <> elt, '1.2' );
oldElt := nil; elt := nil;
obj := TImplementationFactory.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_A,MAX_A]));
elt := obj.CreateInstance() as ITest;
oldElt := elt;
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt = elt,'2.1');
elt.DontPool();
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt <> elt ,'2.2');
oldElt := nil; elt := nil;
obj := TImplementationFactory.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_B,MIN_A]));
elt := obj.CreateInstance() as ITest;
oldElt := elt;
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt = elt,'3.1');
elt.DontPool();
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt <> elt ,'3.2');
oldElt := nil; elt := nil;
obj := TImplementationFactory.Create(TTestClass,Format('PoolMin=%d;PoolMax=%d;TimeOut=100;Pooled=True',[MIN_B,MAX_A]));
elt := obj.CreateInstance() as ITest;
oldElt := elt;
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt = elt,'4.1');
elt.DontPool();
obj.ReleaseInstance(elt);
elt := obj.CreateInstance() as ITest;
Check(oldElt <> elt,'4.2');
end;
initialization
RegisterTest(TTest_TIntfPool);
RegisterTest(TTest_TSimpleItemFactoryEx);
RegisterTest(TTest_TImplementationFactory);
end.

View File

@@ -7,7 +7,7 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<IconPath Value="./"/> <IconPath Value="./"/>
<TargetFileExt Value=".exe"/> <TargetFileExt Value=".exe"/>
<ActiveEditorIndexAtStart Value="14"/> <ActiveEditorIndexAtStart Value="1"/>
</General> </General>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>
@@ -27,7 +27,7 @@
<PackageName Value="FPCUnitTestRunner"/> <PackageName Value="FPCUnitTestRunner"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="57"> <Units Count="60">
<Unit0> <Unit0>
<Filename Value="wst_test_suite.lpr"/> <Filename Value="wst_test_suite.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
@@ -40,9 +40,9 @@
<Filename Value="testformatter_unit.pas"/> <Filename Value="testformatter_unit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="testformatter_unit"/> <UnitName Value="testformatter_unit"/>
<CursorPos X="22" Y="13"/> <CursorPos X="1" Y="19"/>
<TopLine Value="1"/> <TopLine Value="55"/>
<EditorIndex Value="12"/> <EditorIndex Value="2"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit1> </Unit1>
@@ -60,9 +60,7 @@
<UnitName Value="soap_formatter"/> <UnitName Value="soap_formatter"/>
<CursorPos X="26" Y="13"/> <CursorPos X="26" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="6"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="..\..\base_binary_formatter.pas"/> <Filename Value="..\..\base_binary_formatter.pas"/>
@@ -70,21 +68,19 @@
<UnitName Value="base_binary_formatter"/> <UnitName Value="base_binary_formatter"/>
<CursorPos X="3" Y="11"/> <CursorPos X="3" Y="11"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="1"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="..\..\base_service_intf.pas"/> <Filename Value="..\..\base_service_intf.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="base_service_intf"/> <UnitName Value="base_service_intf"/>
<CursorPos X="1" Y="1"/> <CursorPos X="3" Y="1064"/>
<TopLine Value="1"/> <TopLine Value="1069"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Bookmarks Count="2"> <Bookmarks Count="2">
<Item0 X="33" Y="1127" ID="0"/> <Item0 X="33" Y="1130" ID="0"/>
<Item1 X="5" Y="1181" ID="1"/> <Item1 X="5" Y="1184" ID="1"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit5> </Unit5>
@@ -94,9 +90,7 @@
<UnitName Value="base_soap_formatter"/> <UnitName Value="base_soap_formatter"/>
<CursorPos X="26" Y="13"/> <CursorPos X="26" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="2"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/>
</Unit6> </Unit6>
<Unit7> <Unit7>
<Filename Value="..\..\binary_formatter.pas"/> <Filename Value="..\..\binary_formatter.pas"/>
@@ -112,12 +106,10 @@
<UnitName Value="binary_streamer"/> <UnitName Value="binary_streamer"/>
<CursorPos X="26" Y="13"/> <CursorPos X="26" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="8"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Bookmarks Count="1"> <Bookmarks Count="1">
<Item0 X="38" Y="489" ID="2"/> <Item0 X="38" Y="489" ID="2"/>
</Bookmarks> </Bookmarks>
<Loaded Value="True"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
<Filename Value="..\..\server_binary_formatter.pas"/> <Filename Value="..\..\server_binary_formatter.pas"/>
@@ -125,9 +117,7 @@
<UnitName Value="server_binary_formatter"/> <UnitName Value="server_binary_formatter"/>
<CursorPos X="26" Y="13"/> <CursorPos X="26" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="11"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="..\..\metadata_repository.pas"/> <Filename Value="..\..\metadata_repository.pas"/>
@@ -141,9 +131,9 @@
<Filename Value="testmetadata_unit.pas"/> <Filename Value="testmetadata_unit.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="testmetadata_unit"/> <UnitName Value="testmetadata_unit"/>
<CursorPos X="48" Y="180"/> <CursorPos X="31" Y="194"/>
<TopLine Value="158"/> <TopLine Value="170"/>
<EditorIndex Value="14"/> <EditorIndex Value="4"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit11> </Unit11>
@@ -153,9 +143,7 @@
<UnitName Value="metadata_generator"/> <UnitName Value="metadata_generator"/>
<CursorPos X="1" Y="19"/> <CursorPos X="1" Y="19"/>
<TopLine Value="67"/> <TopLine Value="67"/>
<EditorIndex Value="10"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
<Filename Value="..\..\ws_helper\parserdefs.pas"/> <Filename Value="..\..\ws_helper\parserdefs.pas"/>
@@ -175,7 +163,7 @@
<UnitName Value="metadata_wsdl"/> <UnitName Value="metadata_wsdl"/>
<CursorPos X="44" Y="21"/> <CursorPos X="44" Y="21"/>
<TopLine Value="209"/> <TopLine Value="209"/>
<EditorIndex Value="13"/> <EditorIndex Value="3"/>
<UsageCount Value="206"/> <UsageCount Value="206"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit14> </Unit14>
@@ -184,59 +172,61 @@
<UnitName Value="DOM"/> <UnitName Value="DOM"/>
<CursorPos X="15" Y="429"/> <CursorPos X="15" Y="429"/>
<TopLine Value="413"/> <TopLine Value="413"/>
<UsageCount Value="8"/> <UsageCount Value="6"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\sysutils\sysutilh.inc"/> <Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\sysutils\sysutilh.inc"/>
<CursorPos X="13" Y="235"/> <CursorPos X="13" Y="235"/>
<TopLine Value="215"/> <TopLine Value="215"/>
<UsageCount Value="2"/> <UsageCount Value="0"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="..\..\server_service_intf.pas"/> <Filename Value="..\..\server_service_intf.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="server_service_intf"/> <UnitName Value="server_service_intf"/>
<CursorPos X="35" Y="379"/> <CursorPos X="52" Y="140"/>
<TopLine Value="397"/> <TopLine Value="134"/>
<EditorIndex Value="1"/>
<UsageCount Value="203"/> <UsageCount Value="203"/>
<Loaded Value="True"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="..\..\service_intf.pas"/> <Filename Value="..\..\service_intf.pas"/>
<UnitName Value="service_intf"/> <UnitName Value="service_intf"/>
<CursorPos X="3" Y="38"/> <CursorPos X="3" Y="38"/>
<TopLine Value="27"/> <TopLine Value="27"/>
<UsageCount Value="18"/> <UsageCount Value="16"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\classes\classesh.inc"/> <Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\classes\classesh.inc"/>
<CursorPos X="3" Y="316"/> <CursorPos X="3" Y="316"/>
<TopLine Value="304"/> <TopLine Value="304"/>
<UsageCount Value="2"/> <UsageCount Value="0"/>
</Unit19> </Unit19>
<Unit20> <Unit20>
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\classes\lists.inc"/> <Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\objpas\classes\lists.inc"/>
<CursorPos X="3" Y="407"/> <CursorPos X="3" Y="407"/>
<TopLine Value="404"/> <TopLine Value="404"/>
<UsageCount Value="2"/> <UsageCount Value="0"/>
</Unit20> </Unit20>
<Unit21> <Unit21>
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\fcl\inc\contnrs.pp"/> <Filename Value="D:\lazarusClean\fpc\2.0.4\source\fcl\inc\contnrs.pp"/>
<UnitName Value="contnrs"/> <UnitName Value="contnrs"/>
<CursorPos X="3" Y="474"/> <CursorPos X="3" Y="474"/>
<TopLine Value="471"/> <TopLine Value="471"/>
<UsageCount Value="2"/> <UsageCount Value="0"/>
</Unit21> </Unit21>
<Unit22> <Unit22>
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\inc\objpash.inc"/> <Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\inc\objpash.inc"/>
<CursorPos X="27" Y="121"/> <CursorPos X="27" Y="121"/>
<TopLine Value="104"/> <TopLine Value="104"/>
<UsageCount Value="2"/> <UsageCount Value="0"/>
</Unit22> </Unit22>
<Unit23> <Unit23>
<Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\inc\objpas.inc"/> <Filename Value="D:\lazarusClean\fpc\2.0.4\source\rtl\inc\objpas.inc"/>
<CursorPos X="9" Y="166"/> <CursorPos X="9" Y="166"/>
<TopLine Value="142"/> <TopLine Value="142"/>
<UsageCount Value="2"/> <UsageCount Value="0"/>
</Unit23> </Unit23>
<Unit24> <Unit24>
<Filename Value="D:\Lazarus\components\fpcunit\guitestrunner.pas"/> <Filename Value="D:\Lazarus\components\fpcunit\guitestrunner.pas"/>
@@ -245,41 +235,41 @@
<UnitName Value="GuiTestRunner"/> <UnitName Value="GuiTestRunner"/>
<CursorPos X="34" Y="32"/> <CursorPos X="34" Y="32"/>
<TopLine Value="25"/> <TopLine Value="25"/>
<UsageCount Value="2"/> <UsageCount Value="0"/>
</Unit24> </Unit24>
<Unit25> <Unit25>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\fpcunit\fpcunit.pp"/> <Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\fpcunit\fpcunit.pp"/>
<UnitName Value="fpcunit"/> <UnitName Value="fpcunit"/>
<CursorPos X="21" Y="94"/> <CursorPos X="21" Y="94"/>
<TopLine Value="83"/> <TopLine Value="83"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit25> </Unit25>
<Unit26> <Unit26>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\fpcunit\DUnitCompatibleInterface.inc"/> <Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\fpcunit\DUnitCompatibleInterface.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="4"/> <TopLine Value="4"/>
<UsageCount Value="4"/> <UsageCount Value="2"/>
</Unit26> </Unit26>
<Unit27> <Unit27>
<Filename Value="..\..\imp_utils.pas"/> <Filename Value="..\..\imp_utils.pas"/>
<UnitName Value="imp_utils"/> <UnitName Value="imp_utils"/>
<CursorPos X="15" Y="36"/> <CursorPos X="15" Y="36"/>
<TopLine Value="22"/> <TopLine Value="22"/>
<UsageCount Value="4"/> <UsageCount Value="2"/>
</Unit27> </Unit27>
<Unit28> <Unit28>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\xml\dom.pp"/> <Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\xml\dom.pp"/>
<UnitName Value="DOM"/> <UnitName Value="DOM"/>
<CursorPos X="3" Y="51"/> <CursorPos X="3" Y="51"/>
<TopLine Value="41"/> <TopLine Value="41"/>
<UsageCount Value="4"/> <UsageCount Value="2"/>
</Unit28> </Unit28>
<Unit29> <Unit29>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\xml\xmlread.pp"/> <Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\fcl\xml\xmlread.pp"/>
<UnitName Value="XMLRead"/> <UnitName Value="XMLRead"/>
<CursorPos X="43" Y="13"/> <CursorPos X="43" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="8"/> <UsageCount Value="6"/>
</Unit29> </Unit29>
<Unit30> <Unit30>
<Filename Value="test_parserdef.pas"/> <Filename Value="test_parserdef.pas"/>
@@ -287,41 +277,39 @@
<UnitName Value="test_parserdef"/> <UnitName Value="test_parserdef"/>
<CursorPos X="93" Y="76"/> <CursorPos X="93" Y="76"/>
<TopLine Value="11"/> <TopLine Value="11"/>
<UsageCount Value="145"/> <UsageCount Value="160"/>
</Unit30> </Unit30>
<Unit31> <Unit31>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\inc\objpash.inc"/> <Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\inc\objpash.inc"/>
<CursorPos X="8" Y="190"/> <CursorPos X="8" Y="190"/>
<TopLine Value="133"/> <TopLine Value="133"/>
<UsageCount Value="9"/> <UsageCount Value="7"/>
</Unit31> </Unit31>
<Unit32> <Unit32>
<Filename Value="..\..\wst.inc"/> <Filename Value="..\..\wst.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="5"/> <UsageCount Value="13"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit32> </Unit32>
<Unit33> <Unit33>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\objpas\objpas.pp"/> <Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\objpas\objpas.pp"/>
<UnitName Value="objpas"/> <UnitName Value="objpas"/>
<CursorPos X="47" Y="64"/> <CursorPos X="47" Y="64"/>
<TopLine Value="38"/> <TopLine Value="38"/>
<UsageCount Value="4"/> <UsageCount Value="2"/>
</Unit33> </Unit33>
<Unit34> <Unit34>
<Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\inc\heaph.inc"/> <Filename Value="..\..\..\..\..\lazarusClean\fpc\2.0.4\source\rtl\inc\heaph.inc"/>
<CursorPos X="43" Y="100"/> <CursorPos X="43" Y="100"/>
<TopLine Value="83"/> <TopLine Value="83"/>
<UsageCount Value="7"/> <UsageCount Value="5"/>
</Unit34> </Unit34>
<Unit35> <Unit35>
<Filename Value="..\test_fpc\interface_problem\interface_problem.pas"/> <Filename Value="..\test_fpc\interface_problem\interface_problem.pas"/>
<UnitName Value="interface_problem"/> <UnitName Value="interface_problem"/>
<CursorPos X="1" Y="10"/> <CursorPos X="1" Y="10"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="15"/> <UsageCount Value="13"/>
</Unit35> </Unit35>
<Unit36> <Unit36>
<Filename Value="..\..\base_xmlrpc_formatter.pas"/> <Filename Value="..\..\base_xmlrpc_formatter.pas"/>
@@ -329,125 +317,121 @@
<UnitName Value="base_xmlrpc_formatter"/> <UnitName Value="base_xmlrpc_formatter"/>
<CursorPos X="26" Y="13"/> <CursorPos X="26" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="7"/> <UsageCount Value="98"/>
<UsageCount Value="83"/>
<Loaded Value="True"/>
</Unit36> </Unit36>
<Unit37> <Unit37>
<Filename Value="..\..\ws_helper\pscanner.pp"/> <Filename Value="..\..\ws_helper\pscanner.pp"/>
<UnitName Value="PScanner"/> <UnitName Value="PScanner"/>
<CursorPos X="19" Y="505"/> <CursorPos X="19" Y="505"/>
<TopLine Value="491"/> <TopLine Value="491"/>
<UsageCount Value="22"/> <UsageCount Value="20"/>
</Unit37> </Unit37>
<Unit38> <Unit38>
<Filename Value="..\..\ws_helper\pascal_parser_intf.pas"/> <Filename Value="..\..\ws_helper\pascal_parser_intf.pas"/>
<UnitName Value="pascal_parser_intf"/> <UnitName Value="pascal_parser_intf"/>
<CursorPos X="62" Y="296"/> <CursorPos X="62" Y="296"/>
<TopLine Value="296"/> <TopLine Value="296"/>
<UsageCount Value="32"/> <UsageCount Value="30"/>
</Unit38> </Unit38>
<Unit39> <Unit39>
<Filename Value="..\..\ws_helper\pastree.pp"/> <Filename Value="..\..\ws_helper\pastree.pp"/>
<UnitName Value="PasTree"/> <UnitName Value="PasTree"/>
<CursorPos X="18" Y="254"/> <CursorPos X="18" Y="254"/>
<TopLine Value="243"/> <TopLine Value="243"/>
<UsageCount Value="22"/> <UsageCount Value="20"/>
</Unit39> </Unit39>
<Unit40> <Unit40>
<Filename Value="..\..\..\..\..\..\lazarus_23_215\fpc\2.1.5\source\packages\fcl-xml\src\dom.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215\fpc\2.1.5\source\packages\fcl-xml\src\dom.pp"/>
<UnitName Value="DOM"/> <UnitName Value="DOM"/>
<CursorPos X="38" Y="225"/> <CursorPos X="38" Y="225"/>
<TopLine Value="203"/> <TopLine Value="203"/>
<UsageCount Value="21"/> <UsageCount Value="19"/>
</Unit40> </Unit40>
<Unit41> <Unit41>
<Filename Value="..\..\wst_rtti_filter\cursor_intf.pas"/> <Filename Value="..\..\wst_rtti_filter\cursor_intf.pas"/>
<UnitName Value="cursor_intf"/> <UnitName Value="cursor_intf"/>
<CursorPos X="3" Y="75"/> <CursorPos X="3" Y="75"/>
<TopLine Value="70"/> <TopLine Value="70"/>
<UsageCount Value="13"/> <UsageCount Value="11"/>
</Unit41> </Unit41>
<Unit42> <Unit42>
<Filename Value="..\..\wst_rtti_filter\dom_cursors.pas"/> <Filename Value="..\..\wst_rtti_filter\dom_cursors.pas"/>
<UnitName Value="dom_cursors"/> <UnitName Value="dom_cursors"/>
<CursorPos X="3" Y="182"/> <CursorPos X="3" Y="182"/>
<TopLine Value="180"/> <TopLine Value="180"/>
<UsageCount Value="13"/> <UsageCount Value="11"/>
</Unit42> </Unit42>
<Unit43> <Unit43>
<Filename Value="..\..\..\..\..\..\lazarus_23_215\fpc\2.1.5\source\packages\fcl-fpcunit\src\fpcunit.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215\fpc\2.1.5\source\packages\fcl-fpcunit\src\fpcunit.pp"/>
<UnitName Value="fpcunit"/> <UnitName Value="fpcunit"/>
<CursorPos X="1" Y="446"/> <CursorPos X="1" Y="446"/>
<TopLine Value="434"/> <TopLine Value="434"/>
<UsageCount Value="11"/> <UsageCount Value="9"/>
</Unit43> </Unit43>
<Unit44> <Unit44>
<Filename Value="..\..\..\..\..\..\lazarus_23_215\fpc\2.1.5\source\rtl\i386\i386.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215\fpc\2.1.5\source\rtl\i386\i386.inc"/>
<CursorPos X="1" Y="1284"/> <CursorPos X="1" Y="1284"/>
<TopLine Value="1268"/> <TopLine Value="1268"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit44> </Unit44>
<Unit45> <Unit45>
<Filename Value="..\..\..\..\..\..\lazarus_23_215\fpc\2.1.5\source\rtl\objpas\classes\streams.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215\fpc\2.1.5\source\rtl\objpas\classes\streams.inc"/>
<CursorPos X="1" Y="107"/> <CursorPos X="1" Y="107"/>
<TopLine Value="95"/> <TopLine Value="95"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit45> </Unit45>
<Unit46> <Unit46>
<Filename Value="..\..\semaphore.pas"/> <Filename Value="..\..\semaphore.pas"/>
<UnitName Value="semaphore"/> <UnitName Value="semaphore"/>
<CursorPos X="44" Y="6"/> <CursorPos X="3" Y="30"/>
<TopLine Value="1"/> <TopLine Value="23"/>
<UsageCount Value="12"/> <UsageCount Value="10"/>
</Unit46> </Unit46>
<Unit47> <Unit47>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\packages\fcl-xml\src\dom.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\packages\fcl-xml\src\dom.pp"/>
<UnitName Value="DOM"/> <UnitName Value="DOM"/>
<CursorPos X="19" Y="328"/> <CursorPos X="19" Y="328"/>
<TopLine Value="313"/> <TopLine Value="313"/>
<UsageCount Value="13"/> <UsageCount Value="11"/>
</Unit47> </Unit47>
<Unit48> <Unit48>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\win32\system.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\win32\system.pp"/>
<UnitName Value="System"/> <UnitName Value="System"/>
<CursorPos X="22" Y="33"/> <CursorPos X="22" Y="33"/>
<TopLine Value="18"/> <TopLine Value="18"/>
<UsageCount Value="11"/> <UsageCount Value="9"/>
</Unit48> </Unit48>
<Unit49> <Unit49>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\packages\fcl-base\src\inc\contnrs.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\packages\fcl-base\src\inc\contnrs.pp"/>
<UnitName Value="contnrs"/> <UnitName Value="contnrs"/>
<CursorPos X="3" Y="964"/> <CursorPos X="3" Y="964"/>
<TopLine Value="962"/> <TopLine Value="962"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit49> </Unit49>
<Unit50> <Unit50>
<Filename Value="..\..\wst_delphi.inc"/> <Filename Value="..\..\wst_delphi.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="4"/> <UsageCount Value="13"/>
<UsageCount Value="14"/>
<Loaded Value="True"/>
</Unit50> </Unit50>
<Unit51> <Unit51>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\strutils.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\objpas\strutils.pp"/>
<UnitName Value="strutils"/> <UnitName Value="strutils"/>
<CursorPos X="10" Y="29"/> <CursorPos X="10" Y="29"/>
<TopLine Value="14"/> <TopLine Value="14"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit51> </Unit51>
<Unit52> <Unit52>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\objpash.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\objpash.inc"/>
<CursorPos X="20" Y="168"/> <CursorPos X="20" Y="168"/>
<TopLine Value="166"/> <TopLine Value="166"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit52> </Unit52>
<Unit53> <Unit53>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\objpas.inc"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\rtl\inc\objpas.inc"/>
<CursorPos X="11" Y="442"/> <CursorPos X="11" Y="442"/>
<TopLine Value="556"/> <TopLine Value="556"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit53> </Unit53>
<Unit54> <Unit54>
<Filename Value="..\..\wst_fpc_xml.pas"/> <Filename Value="..\..\wst_fpc_xml.pas"/>
@@ -455,27 +439,168 @@
<UnitName Value="wst_fpc_xml"/> <UnitName Value="wst_fpc_xml"/>
<CursorPos X="8" Y="38"/> <CursorPos X="8" Y="38"/>
<TopLine Value="11"/> <TopLine Value="11"/>
<EditorIndex Value="3"/> <UsageCount Value="44"/>
<UsageCount Value="29"/>
<Loaded Value="True"/>
</Unit54> </Unit54>
<Unit55> <Unit55>
<Filename Value="..\..\wst_global.inc"/> <Filename Value="..\..\wst_global.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="9"/> <UsageCount Value="10"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit55> </Unit55>
<Unit56> <Unit56>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\packages\fcl-base\src\inc\custapp.pp"/> <Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\packages\fcl-base\src\inc\custapp.pp"/>
<UnitName Value="CustApp"/> <UnitName Value="CustApp"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="10"/> <UsageCount Value="8"/>
</Unit56> </Unit56>
<Unit57>
<Filename Value="test_utilities.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="test_utilities"/>
<CursorPos X="39" Y="97"/>
<TopLine Value="42"/>
<EditorIndex Value="5"/>
<UsageCount Value="35"/>
<Loaded Value="True"/>
</Unit57>
<Unit58>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\packages\fcl-fpcunit\src\fpcunit.pp"/>
<UnitName Value="fpcunit"/>
<CursorPos X="3" Y="212"/>
<TopLine Value="217"/>
<UsageCount Value="9"/>
</Unit58>
<Unit59>
<Filename Value="..\..\..\..\..\..\lazarus_23_215XX\fpc\source\packages\fcl-fpcunit\src\testregistry.pp"/>
<UnitName Value="testregistry"/>
<CursorPos X="35" Y="40"/>
<TopLine Value="19"/>
<UsageCount Value="9"/>
</Unit59>
</Units> </Units>
<JumpHistory Count="0" HistoryIndex="-1"/> <JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="test_utilities.pas"/>
<Caret Line="182" Column="3" TopLine="188"/>
</Position1>
<Position2>
<Filename Value="test_utilities.pas"/>
<Caret Line="367" Column="22" TopLine="345"/>
</Position2>
<Position3>
<Filename Value="test_utilities.pas"/>
<Caret Line="366" Column="29" TopLine="353"/>
</Position3>
<Position4>
<Filename Value="test_utilities.pas"/>
<Caret Line="225" Column="38" TopLine="203"/>
</Position4>
<Position5>
<Filename Value="test_utilities.pas"/>
<Caret Line="370" Column="116" TopLine="360"/>
</Position5>
<Position6>
<Filename Value="test_utilities.pas"/>
<Caret Line="340" Column="13" TopLine="327"/>
</Position6>
<Position7>
<Filename Value="test_utilities.pas"/>
<Caret Line="334" Column="15" TopLine="328"/>
</Position7>
<Position8>
<Filename Value="..\..\base_service_intf.pas"/>
<Caret Line="1063" Column="81" TopLine="1059"/>
</Position8>
<Position9>
<Filename Value="test_utilities.pas"/>
<Caret Line="58" Column="3" TopLine="56"/>
</Position9>
<Position10>
<Filename Value="test_utilities.pas"/>
<Caret Line="393" Column="43" TopLine="379"/>
</Position10>
<Position11>
<Filename Value="test_utilities.pas"/>
<Caret Line="22" Column="45" TopLine="9"/>
</Position11>
<Position12>
<Filename Value="test_utilities.pas"/>
<Caret Line="394" Column="23" TopLine="379"/>
</Position12>
<Position13>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="693" Column="21" TopLine="675"/>
</Position13>
<Position14>
<Filename Value="test_utilities.pas"/>
<Caret Line="394" Column="47" TopLine="379"/>
</Position14>
<Position15>
<Filename Value="test_utilities.pas"/>
<Caret Line="22" Column="31" TopLine="17"/>
</Position15>
<Position16>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="177" Column="48" TopLine="164"/>
</Position16>
<Position17>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="167" Column="42" TopLine="154"/>
</Position17>
<Position18>
<Filename Value="test_utilities.pas"/>
<Caret Line="85" Column="3" TopLine="82"/>
</Position18>
<Position19>
<Filename Value="test_utilities.pas"/>
<Caret Line="394" Column="26" TopLine="384"/>
</Position19>
<Position20>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="194" Column="20" TopLine="178"/>
</Position20>
<Position21>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="683" Column="38" TopLine="673"/>
</Position21>
<Position22>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="187" Column="20" TopLine="181"/>
</Position22>
<Position23>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="191" Column="27" TopLine="181"/>
</Position23>
<Position24>
<Filename Value="test_utilities.pas"/>
<Caret Line="394" Column="27" TopLine="384"/>
</Position24>
<Position25>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="187" Column="21" TopLine="179"/>
</Position25>
<Position26>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="689" Column="22" TopLine="680"/>
</Position26>
<Position27>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="133" Column="25" TopLine="120"/>
</Position27>
<Position28>
<Filename Value="..\..\server_service_intf.pas"/>
<Caret Line="776" Column="44" TopLine="766"/>
</Position28>
<Position29>
<Filename Value="test_utilities.pas"/>
<Caret Line="394" Column="45" TopLine="390"/>
</Position29>
<Position30>
<Filename Value="test_utilities.pas"/>
<Caret Line="431" Column="45" TopLine="416"/>
</Position30>
</JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
<Version Value="5"/> <Version Value="5"/>

View File

@@ -9,7 +9,7 @@ uses
base_service_intf, base_soap_formatter, binary_formatter, binary_streamer, base_service_intf, base_soap_formatter, binary_formatter, binary_streamer,
server_binary_formatter, metadata_repository, server_binary_formatter, metadata_repository,
metadata_generator, parserdefs, server_service_intf, metadata_wsdl, metadata_generator, parserdefs, server_service_intf, metadata_wsdl,
test_parserdef, base_xmlrpc_formatter, wst_fpc_xml; test_parserdef, base_xmlrpc_formatter, wst_fpc_xml, test_utilities;
Const Const
ShortOpts = 'alh'; ShortOpts = 'alh';