I have developed a JAX-WS webservice to deal with large file (upload / download). MTOM Attachment + Streaming feature is enabled on the webservice and the client both. Deployed in Weblogic 10.3.6 JDK 1.7
// Enable attachment streaming feature
// dir - attachment above memoryThreshold are stored in this directory
// parseEagerly - Streaming attachments are to be parsed eagerly (read or write the complete attachment)
// memoryThreshold - Memory threshold set to 4MB. Attachments under 4MB are stored in memory.
@StreamingAttachment(dir="C:/Users/rakesh/Desktop/temp/server", parseEagerly=true, memoryThreshold=40000L)
//Enable MTOM (Message Transmission Optimization Mechanism) feature for xs:binary64 data over 10KB (10240 bytes)
@MTOM(enabled=true, threshold=10240)
@WebService
public class ImagingStreamingWebService {
...
}
MTOM streaming is working fine in both upload and download which great. Issue is in case of upload when client sending a large attachment bigger than 4MB. Based on the @StreamingAttachment annotation attachment is saved to dir="C:/Users/rakesh/Desktop/temp/server"
After processing is done and response is sent back to client, temp attachment file is not deleted from dir above.
Temp attachment files are not deleted even after JVM recycle (shutdown of server). See the picture of files in temp dir below
I can not find any way to delete these files. Manually deleting or batch/script to cleanup dir is not possible because these are locked by JVM. Ideal is to deleted theses files as soon as webmethod processing is done.