易截截图软件、单文件、免安装、纯绿色、仅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. 命令的接受者
unit uReceiveObject;
interface
type
TLight = class(TObject)
public
procedure Open;
procedure Off;
end;
TGarageDoor = class(TObject)
public
procedure Up;
procedure Down;
procedure Stop;
procedure LightOn;
procedure LightOff;
end; ......

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如何响应事件

由于项目需要,开始学习DELPHI,并自己编写代码来测试用VC写的DLL,觉得自己又多掌握了一些,不对的地方希望指正,我会好好学习
1、响应键盘事件:
因为KeyPreview默认是 False;我们这里需要响应键盘事件的话,需要将其修改为True;
所以KeyPreview:=True; 这对一些快捷键会有用。
在FormCreate这个函数里修改KeyPrevie ......

Delphi下生成Map文件方法,免杀或调试用的

 以前看了 通过崩溃地址找错误行数之VC版 那时候还没用DELPHI
昨晚刚好又看到了 所以就试了一下DELPHI的,与大家共享 ^_^
什么是 MAP 文件?简单地讲, MAP 文件是程序的全局符号、源文件和代码行号信息的唯一的文本表示方法,它可以在任何地方、任何时候使用,不需要有额外的程序进行支持。而且,这是唯一能找出程 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号