Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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 µ÷ÊÔʱ×ܳöÏÖ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 ......

delphi×ÊÔ´ÎļþÖÆ×÷¼°Ê¹ÓÃÏê½â

Ò»¡¢Òý×Ó£º
ÏÖÔÚµÄWindowsÓ¦ÓóÌÐò¼¸ºõ¶¼Ê¹ÓÃͼ±ê¡¢Í¼Æ¬¡¢¹â±ê¡¢ÉùÒôµÈ£¬ÎÒÃdzÆËüÃÇΪ×ÊÔ´£¨Resource£©¡£×î¼òµ¥µÄʹÓÃ×ÊÔ´µÄ°ì·¨ÊÇ°ÑÕâЩ×ÊÔ´µÄÔ´Îļþ´òÈëÈí¼þ°ü£¬ÒÔ·½±ã³ÌÐòÐèÒªµÄʱºòµ÷Óá£×ÊÔ´ÊdzÌÐòµÄÒ»²¿·Ö£¬³ÌÐòÒªÕý³£ÔËÐоÍÀë²»ÁË×ÊÔ´Îļþ¡£µ«ÊÇËüÊDz»¿ÉÖ´ÐдúÂë¡£
ΪÁ˸üºÃµØ¹ÜÀí×ÊÔ´£¬DelphiÖÐÌṩÁËÒ»ÖÖ.RESÀàÐ ......

ÓÃPLSQL×Ô¶¯Éú³ÉÊý¾Ý¿â±íµÄDelphi¶ÔÏó

 DECLARE
  TYPE TY_QUECUR IS REF CURSOR;
  CUR_COLUMNS  TY_QUECUR;
  SQLCMD  VARCHAR(500);
  TABNAME VARCHAR(20);
  COLNAME VARCHAR(50);
  COLTYPE VARCHAR(20);
  COLCOMMENT VARCHAR2(50);
  COLLENGTH INTEGER;
  COLPRECISION INTEGER; ......

delphi»ñµÃÍø¿¨µÄMACµØÖ·


 
»ñµÃÍø¿¨µÄMACµØÖ·ÔںܶàµØ·½¶¼ÓкܴóµÄÓô¦,ÏÂÃæµÄº¯ÊýÒÔXX-XX-XX-XX-XX-XX µÄ¸ñʽ·µ»ØÔ¶³Ì»ò±¾µØ»úÆ÷µÄMACµØÖ·¡£
Function to return the MAC address of a remote or local machine in the format XX-XX-XX-XX-XX-XX
·µ»ØµÄMACµØÖ·ÊÇÒ»¸öÄÜÓÃÔÚ¶à¸ö·½ÃæµÄΨһ±êʶ¡£Ê¹Ó÷½·¨£º
ShowMessage(GetMacAddress( ......

delphiº¯Êý²Î¿¼ÊÖ²á(±È½ÏÔçµÄ°æ±¾)

Ãû³Æ    ÀàÐÍ   ˵Ã÷
abort º¯Êý ÒýÆð·ÅÆúµÄÒâÍâ´¦Àí
abs º¯Êý ¾ø¶ÔÖµº¯Êý
addexitproc º¯Êý ½«Ò»¹ý³ÌÌí¼Óµ½ÔËÐÐʱ¿âµÄ½áÊø¹ý³Ì±íÖÐ
addr º¯Êý ·µ»ØÖ¸¶¨¶ÔÏóµÄµØÖ·
adjustlinebreaks º¯Êý ½«¸ø¶¨×Ö·û´®µÄÐзָô·ûµ÷ÕûΪcr/lfÐòÁÐ
align ÊôÐÔ Ê¹¿Ø¼þλÓÚ´°¿Úij²¿·Ö
alignment ÊôÐÔ ¿ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ