【发布时间】:2026-01-18 20:05:02
【问题描述】:
我开发了一个 JAX-WS webservice 来处理大文件(上传/下载)。 MTOM Attachment + Streaming 功能在 web 服务和客户端都启用。部署在 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 流式传输在上传和下载方面都运行良好,非常棒。问题是在客户端发送大于 4MB 的大附件时上传。基于@StreamingAttachment注解,附件保存到dir="C:/Users/rakesh/Desktop/temp/server"处理完成并响应回客户端后,临时附件文件不会从上面的目录中删除。
即使在 JVM 回收(服务器关闭)之后,临时附件文件也不会被删除。请参阅下面临时目录中的文件图片
我找不到删除这些文件的任何方法。手动删除或批处理/脚本清理目录是不可能的,因为它们被 JVM 锁定。理想的做法是在 webmethod 处理完成后立即删除这些文件。
【问题讨论】:
标签: web-services jax-ws weblogic11g mtom