简体   繁体   English

在Eclipse MAT的OQL中:如何从长整数构造日期?

[英]In Eclipse MAT's OQL: how to construct a date from a long integer?

I'm doing some investigation in a core dump via Eclipse MAT. 我正在通过Eclipse MAT在核心转储中进行一些调查。 I've got some OQL that gets me pretty close to the information I want about web client sessions that haven't been collected (and are holding onto a LOT of memory). 我有一些OQL,可以使我非常接近我想要的关于尚未收集(并占用大量内存)的Web客户端会话的信息。

The session data has a date, in long integer format. 会话数据具有长整数格式的日期。

This is a small thing (or should be) but I've not figured out how to convert that long integer into a meaningful date object inside the OQL, but doing so would help me filter the harmless live sessions from the potential leaks. 这是一件小事(或者应该是),但是我还没有弄清楚如何将这个长整数转换为OQL内部的有意义的日期对象,但是这样做将有助于我从潜在的泄漏中筛选出无害的实时会话。

So, what is the trick for converting long to date or timestamp in MAT's OQL? 那么,在MAT的OQL中转换长日期或时间戳的诀窍是什么?

As an alternative to MAT you can use visualvm 作为MAT的替代方法,您可以使用visualvm

JavaScript expressions can be used as a filter in an OQL query, in your case to restrict all the sessions to the meaningful ones. JavaScript表达式可用作OQL查询中的过滤器,以将所有会话限制为有意义的会话。

For instance: 例如:

select o  from java.util.Date o 
   where new java.util.Date(o.fastTime).getYear() > 114 
      && new java.util.Date(o.fastTime).getMonth() == 7

I Hope this could help you. 希望对您有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM