How to remove a file that was used by a Send HTTP Request activity without stopping the BusinessWorks engine.

How to remove a file that was used by a Send HTTP Request activity without stopping the BusinessWorks engine.

book

Article ID: KB0089014

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Description:
We have configured a Send HTTP Request to send a file using mimeparts. After sending the file. we would like to remove the file, but there is a lock on the file held by the BusinessWorks (BW) engine. How can to remove the file without stopping BW?

Issue/Introduction

How to remove a file that was used by a Send HTTP Request activity without stopping the BusinessWorks engine.

Resolution

Unable to delete a file after sending its content by a "Send HTTP Request ".

Additional Information

This happens because BW has created a Java object which still references the file in memory. After sending has completed, the object is not instantly garbage collected. There are two options.

1). You can try repeatedly removing the file after certain time intervals in the hope that the Java object will garbage collected (GC), as part of normal processing.

or

2). If you are unable to wait, you can explicitly request the BW engine to do a full GC. This can be achieved by adding "System.gc();" to a Java Code activity anywhere before the 'Remove File' activity in your project. As indicated by the Java documentation, System.gc() does not guarantee a GC straight away.