易截截图软件、单文件、免安装、纯绿色、仅160KB

Using COM+ object pooling with Delphi 6

 URL: http://edn.embarcadero.com/article/27568
Abstract: Delphi 6 introduces support for COM+ object pooling, which can provide significant performance improvements under some circumstances. We take a look at Delphi 6s object pooling support. By Vincent Parrett.
Typically, when a client application instantiates a COM+ object, the COM+ runtime will create a new instance of the object. When your client is done with the object, COM+ will destroy the object. This all makes for very efficient use of memory resources, and under normal loads provides quite an acceptable performance.
However, under higher loads the creation and destruction of objects can become a substantial overhead. This is especially true if your COM+ objects are themselves allocating resources, instantiating other objects, and so on.
Object pooling can help in these situations by reducing the number of times an object must be instantiated or destroyed. When pooling is in effect, a client's request for an object will kick of a search to see if there is a ready-to-use object pool for objects of the appropriate type. If so, the COM+ system will provide and activate the object. If not, COM+ will create a new object. When the client is done with the object, COM+ will not destroy the object, but will return it to the object pool so it can be reused.
To get the best out of COM+, your objects should be stateless. To make use of object pooling, they must be stateless objects.
Object pooling with Delphi 6
Supporting object pooling in Delphi 6-generated COM+ objects is simple, however there are a few things that you need to take care with:
Threading model
The first is that you must select the Both threading model, otherwise object pooling will be disabled.
If you get this wrong, don't worry -- it's easy to fix. The New Transactional Object wizard generates code that looks something like this :
initialization
TAutoObjectFactory.Create(ComServer, TMyCOMPlusObject, Class_MyCOMPlusObject,
ci


相关文档:

Delphi 设计模式:《HeadFirst设计模式》Delphi7代码

1. 命令的接收者
{《HeadFirst设计模式》之命令模式 }
{ 本单元中的类为命令的接收者 }
{ 编译工具 :Delphi7.0 }
{ 联系方式 :xshlife@163.com }

unit uReceiveObject;

interface

type
TLight = class(TObject)
private
FLocation: String;
public
constru ......

Delphi 设计模式:《HeadFirst设计模式》Delphi7代码

没有应用状态模式的代码
1. 工程文件
program Project1;
{$APPTYPE CONSOLE}
uses
uGumballMachine in 'uGumballMachine.pas';
var
aGumballMachine: TGumballMachine;
begin
aGumballMachine := TGumballMachine.Create(5);
aGumballMachine.InsertQuarter;
aGumballMachine.TurnCrank;
Writeln; ......

delphi 调试时总出现cpu窗口,ntdll.dll点的解决方法

 在主界面的implementation  {$R *.dfm} 下放入以下代码:
procedure PatchInt3;
var
NOP: Byte;
NTDLL: THandle;
BytesWritten: DWORD;
Address: Pointer;
begin
 if Win32Platform <> VER_PLATFORM_WIN32_NT then
Exit;
 NTDLL := GetModuleHandle('NTDLL.DLL');
 if NT ......

DB2 和 Delphi 7 — SOAP 和数据库 Web 服务

 构建 Windows SOAP 服务器应用程序
首先在 Windows 上构建服务器,然后在 Linux 上构建客户机。(如果需要,可以使用其它方法 — 或者将它们全部构建在 Windows 或 Linux 上。)对于 Windows SOAP 服务器,启动 Delphi 7 Enterprise,执行 File -> New -> Other,转至对象资源库(Object Repository)的 ......

Delphi Shl与Shr 移位操作介绍

 格式:操作数 Shl/Shr 移动位数
说明:操作数与返回值都是整数
例子:16(10) = 10000(2)
     16(10) Shr 1 = 10000(2) Shr 1 = 1000(2) = 8(10)
     16(10) Shr 2 = 10000(2) Shr 2 = 100(2) = 4(10)
说明:一个整数(I)按位左移一位,相当于把它乘以2,即 I * 2
&n ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号