I am using Spring Integration for FTP/File poller. FTp/File poller polls every 5sec.
When i analyze the heap memory i can see ErrorHandlingTaskExecutor$1 filling up the heap memory.How to solve this issue.Below the code
<!-- Default Poller -->
<int:poller id="csvPoller" fixed-rate="${csv.poll.timeinterval}" max-messages-per-poll="3" default="true" error-channel="csvErrorChannel"/>
<!-- ToDO Include Header TimeStamp+ corilation id? in the File Name -->
<int-ftp:inbound-channel-adapter id="csvFtpInbound"
channel="csvFtpChannel"
session-factory="ftpClientFactory"
auto-create-local-directory="true"
delete-remote-files="true"
remote-directory="/"
local-filename-generator-expression="new java.text.SimpleDateFormat('yyyy-MM-dd-hhmmssSSS').format(new java.util.Date()) + '.'+ #this"
local-directory="${ftp.sync.folder}"
remote-file-separator="/"
filename-regex="[\s\S]*(\.txt|\.csv)">
</int-ftp:inbound-channel-adapter>
<!-- Re Try For the failed filed Polled? - -->
<int:channel id="csvFtpChannel" >
<int:queue />
</int:channel>
<int-file:outbound-channel-adapter id="procesingFolderAdapter" channel="csvFtpChannel" delete-source-files="true" directory="${csv.processing.folder}"/>
<int-file:inbound-channel-adapter id="fileInBound"
channel="csvFileProcessingChannel"
directory="${csv.processing.folder}"
prevent-duplicates="true"
filename-regex="[\s\S]*(\.txt|\.csv)">
</int-file:inbound-channel-adapter>
<int:channel id="csvFileProcessingChannel" datatype="java.io.File" >
<int:interceptors>
<bean class="com.ws.interceptor.CSVFileAndSecurityValidationInterceptor"></bean>
</int:interceptors>
</int:channel>
<int:transformer id="csvTransformer" input-channel="csvFileProcessingChannel" output-channel="csvTransformedChannel" ref="csvTransformerBean"/>
<bean id="csvTransformerBean" class="com.ws.transformer.CSVTransformer"></bean>
<!-- Transformed Data Channel-->
<int:channel id="csvTransformedChannel">
</int:channel>
<!-- Routing to the CommonMessageRouter from here it routes to the Correct EndPoints i.e Service-activator -->
<int:router input-channel="csvTransformedChannel"
ref="CommonMessageRouter" />
<bean id="CommonMessageRouter" class="com.ws.router.CommonMessageRouter" />
<!-- All CSV output from Endpoint's use this channel -->
<int:channel id="csvEnpointOutputChannel">
</int:channel>
<!-- Output Router based on responsecode from CSVResponse -->
<int:recipient-list-router id="outPutRouter" input-channel="csvEnpointOutputChannel">
<int:recipient channel="csvErrorChannel" selector-expression="payload.responseCode != 0"/>
<int:recipient channel="csvOutputChannel" selector-expression="payload.responseCode == 0"/>
</int:recipient-list-router>
<!-- CSV Error Channel -->
<int:channel id="csvErrorChannel">
</int:channel>
<!-- CSV Output Channel -->
<int:channel id="csvOutputChannel">
</int:channel>
<!-- CSV Service Activators -->
<!-- Result Processing CSV Service Activator -->
<int:service-activator input-channel="csvErrorChannel" output-channel="nullChannel">
<bean class="com.ws.endpoint.csv.CSVErrorHandlerEndpoint"></bean>
</int:service-activator>
<int:service-activator input-channel="csvOutputChannel" output-channel="nullChannel">
<bean class="com.ws.endpoint.csv.CSVOutputHandlerEndpoint"></bean>
</int:service-activator>
<!-- CSV Export Component Start-->
<!-- File/FTP Out Channel -->
<int-file:inbound-channel-adapter directory="${ftp.export.sync.folder}" channel="csvExportFileChannel" filename-pattern="*.csv" id="fileOutBond">
<int:poller id="csvExportPoller" fixed-rate="${csv.poll.timeinterval}" default="false" error-channel="csvErrorChannel"/>
</int-file:inbound-channel-adapter>
<int:channel id="csvExportFileChannel">
</int:channel>
<!-- Move the file to FTP Location and delte the source file located in local server -->
<int-ftp:outbound-channel-adapter session-factory="ftpClientFactoryOutBond" channel="csvExportFileChannel"
remote-directory-expression="'/CSV/' + getPayload().getName().substring(21).substring(0,getPayload().getName().substring(21).indexOf('_'))"
auto-create-directory="true">
<int-ftp:request-handler-advice-chain>
<bean class="org.springframework.integration.handler.advice.ExpressionEvaluatingRequestHandlerAdvice">
<property name="onSuccessExpression" value="payload.delete()" />
<property name="successChannel" ref="nullChannel" />
</bean>
</int-ftp:request-handler-advice-chain>
</int-ftp:outbound-channel-adapter>
Heap Reference Tree
(1)org.springframework.integration.util.ErrorHandlingTaskExecutor@0x10a545c8 (16 bytes)
References to this object:
(2)org.springframework.integration.util.ErrorHandlingTaskExecutor$1@0x4c05820
... n number
(keep increasing everytime polling)
Now(2)
org.springframework.integration.util.ErrorHandlingTaskExecutor$1@0x4c05820
has
task (L) : (3)org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1@0x4c05810 (12 bytes)
and References to this object:
java.util.concurrent.SynchronousQueue$TransferStack$SNode@0x4c05830 (28 bytes) :
Now (3)org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1@0x4c05810 (12 bytes)
has Instance of
(4)org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller@0x10a3f690 (16 bytes)
which refers to n.no of org.springframework.integration.endpoint.AbstractPollingEndpoint$Poller$1@0x4b4e718 (12 bytes)
(keep increasing every time polls i.e every 3sec)
and (3)
References to this object:
org.springframework.integration.util.ErrorHandlingTaskExecutor$1@0x4c05820 (16 bytes) : field val$task