THRIFT-4318 Delphi performance improvements
Client: Delphi
Patch: Jens Geyer
This closes #1348
diff --git a/lib/delphi/src/Thrift.Processor.Multiplex.pas b/lib/delphi/src/Thrift.Processor.Multiplex.pas
index 756daa1..4cd80ba 100644
--- a/lib/delphi/src/Thrift.Processor.Multiplex.pas
+++ b/lib/delphi/src/Thrift.Processor.Multiplex.pas
@@ -68,16 +68,16 @@
// the standard format, without the service name prepended to TMessage.name.
TStoredMessageProtocol = class( TProtocolDecorator)
private
- FMessageBegin : IMessage;
+ FMessageBegin : TThriftMessage;
public
- constructor Create( const protocol : IProtocol; const aMsgBegin : IMessage);
- function ReadMessageBegin: IMessage; override;
+ constructor Create( const protocol : IProtocol; const aMsgBegin : TThriftMessage);
+ function ReadMessageBegin: TThriftMessage; override;
end;
private
FServiceProcessorMap : TDictionary<String, IProcessor>;
- procedure Error( const oprot : IProtocol; const msg : IMessage;
+ procedure Error( const oprot : IProtocol; const msg : TThriftMessage;
extype : TApplicationExceptionSpecializedClass; const etxt : string);
public
@@ -105,14 +105,14 @@
implementation
-constructor TMultiplexedProcessorImpl.TStoredMessageProtocol.Create( const protocol : IProtocol; const aMsgBegin : IMessage);
+constructor TMultiplexedProcessorImpl.TStoredMessageProtocol.Create( const protocol : IProtocol; const aMsgBegin : TThriftMessage);
begin
inherited Create( protocol);
FMessageBegin := aMsgBegin;
end;
-function TMultiplexedProcessorImpl.TStoredMessageProtocol.ReadMessageBegin: IMessage;
+function TMultiplexedProcessorImpl.TStoredMessageProtocol.ReadMessageBegin: TThriftMessage;
begin
result := FMessageBegin;
end;
@@ -141,15 +141,15 @@
end;
-procedure TMultiplexedProcessorImpl.Error( const oprot : IProtocol; const msg : IMessage;
+procedure TMultiplexedProcessorImpl.Error( const oprot : IProtocol; const msg : TThriftMessage;
extype : TApplicationExceptionSpecializedClass;
const etxt : string);
var appex : TApplicationException;
- newMsg : IMessage;
+ newMsg : TThriftMessage;
begin
appex := extype.Create(etxt);
try
- newMsg := TMessageImpl.Create( msg.Name, TMessageType.Exception, msg.SeqID);
+ Init( newMsg, msg.Name, TMessageType.Exception, msg.SeqID);
oprot.WriteMessageBegin(newMsg);
appex.Write(oprot);
@@ -163,7 +163,7 @@
function TMultiplexedProcessorImpl.Process(const iprot, oprot : IProtocol; const events : IProcessorEvents = nil): Boolean;
-var msg, newMsg : IMessage;
+var msg, newMsg : TThriftMessage;
idx : Integer;
sService : string;
processor : IProcessor;
@@ -204,7 +204,7 @@
// Create a new TMessage, removing the service name
Inc( idx, Length(TMultiplexedProtocol.SEPARATOR));
- newMsg := TMessageImpl.Create( Copy( msg.Name, idx, MAXINT), msg.Type_, msg.SeqID);
+ Init( newMsg, Copy( msg.Name, idx, MAXINT), msg.Type_, msg.SeqID);
// Dispatch processing to the stored processor
protocol := TStoredMessageProtocol.Create( iprot, newMsg);