首页 \ 问答 \ 获取正在运行的JVM的参数(Getting the parameters of a running JVM)

获取正在运行的JVM的参数(Getting the parameters of a running JVM)

有没有办法获取正在运行的JVM的参数? 有没有像jstat一样的命令行工具,它将JVM的pid作为输入,并返回其起始参数? 我对启动JVM时给出的-Xmx和-Xms值特别感兴趣。 谢谢。

编辑 :澄清我的限制。 我们要检查的JVM正在生产服务器上运行。 这就是为什么我们更喜欢最小的破坏。 我们可以使用jstat来监视JVM,所以我们希望有一个类似的简单解决方案来访问这些参数。

编辑 :我们也尝试使用jvisualvm获取参数。 但为了连接到远程jvm,我们需要运行jstatd并修改JVM的安全设置,我们发现它们在生产服务器上是非常具有破坏性和危险性的。


Is there a way to get the parameters of a running JVM? Is there a command line tool like jstat which takes as input the pid of the JVM and returns its starting parameters? I am particularly interested in the -Xmx and -Xms values that were given when starting the JVM. Thank you.

Edit: To clarify my constraints. The JVM we would like to check is running on a production server. That's why, we prefer the minimum disruption. We are able to monitor the JVM using jstat, and so we hope there's a similar simple solution to access the parameters.

Edit: We also tried to get the parameters using jvisualvm. But in order to connect to a remote jvm, we need to run jstatd and modify the security settings of the JVM, which we found to be very disruptive and risky on a production server.


原文:https://stackoverflow.com/questions/5317152
更新时间:2023-06-07 07:06

最满意答案

感谢Neil Slater,我终于找到了正确的解决方案。 我需要在最终结果中结合使用 DstIn + Over的复合操作

  def watermark(opacity = 0.99, size = 'm')
    manipulate! do |img|
      logo = Magick::Image.read("#{Rails.root}/app/assets/images/watermark#{size}.png").first
      logo.alpha(Magick::ActivateAlphaChannel) 

      white_canvas = Magick::Image.new(logo.columns, logo.rows) { self.background_color = "none" }
      white_canvas.alpha(Magick::ActivateAlphaChannel)
      white_canvas.opacity = Magick::QuantumRange - (Magick::QuantumRange * opacity)

      # Important: DstIn composite operation (white canvas + watermark)
      logo_opacity = logo.composite(white_canvas, Magick::NorthWestGravity, 0, 0, Magick::DstInCompositeOp)
      logo_opacity.alpha(Magick::ActivateAlphaChannel)

      # Important: Over composite operation (original image + white canvas watermarked)
      img = img.composite(logo_opacity, Magick::NorthWestGravity, 0, 0, Magick::OverCompositeOp)
    end
  end

Thanks to Neil Slater, I finally found the right solution. I need a combination of composite operation of DstIn + Over in my finalt result:

  def watermark(opacity = 0.99, size = 'm')
    manipulate! do |img|
      logo = Magick::Image.read("#{Rails.root}/app/assets/images/watermark#{size}.png").first
      logo.alpha(Magick::ActivateAlphaChannel) 

      white_canvas = Magick::Image.new(logo.columns, logo.rows) { self.background_color = "none" }
      white_canvas.alpha(Magick::ActivateAlphaChannel)
      white_canvas.opacity = Magick::QuantumRange - (Magick::QuantumRange * opacity)

      # Important: DstIn composite operation (white canvas + watermark)
      logo_opacity = logo.composite(white_canvas, Magick::NorthWestGravity, 0, 0, Magick::DstInCompositeOp)
      logo_opacity.alpha(Magick::ActivateAlphaChannel)

      # Important: Over composite operation (original image + white canvas watermarked)
      img = img.composite(logo_opacity, Magick::NorthWestGravity, 0, 0, Magick::OverCompositeOp)
    end
  end

相关问答

更多
  • 感谢Neil Slater,我终于找到了正确的解决方案。 我需要在最终结果中结合使用 DstIn + Over的复合操作 : def watermark(opacity = 0.99, size = 'm') manipulate! do |img| logo = Magick::Image.read("#{Rails.root}/app/assets/images/watermark#{size}.png").first logo.alpha(Magick::Activ ...
  • 是的,透明度只能在顶级窗口上工作。 它使用视频适配器的硬件功能,不支持子窗口,如Panel。 Winforms中唯一的顶级Control派生类是Form。 几个“纯”Winform控件,那些做自己的绘画,而不是让本地Windows控件做这个工作,但是支持一个透明的BackColor。 面板是其中之一。 它使用一个技巧,它要求父母绘制自己以产生背景像素。 这个技巧的一个副作用是重叠控件不起作用,只能看到父像素,而不是重叠控件。 此样本表格显示在工作中: public partial class Form1 : ...
  • 我的问题的答案很简单,虽然我花了一天时间才找到它。 我的Ubuntu发行版存储库附带的“普通”ffmpeg抱怨“c:v libx264”参数。 avconv知道这个参数但是有缺陷; 它只是不渲染透明图像。 解决方案就像安装最新的ffmpeg版本一样简单(我选择了静态版本)。 现在它就像一个魅力。 :) The answer to my question is simple, though it took me a day to find it. The "normal" ffmpeg that comes ...
  • Css过滤器是IE特定的。 如果你不使用颜色:rgba(r,g,b,a); 其中a是负责透明度的alpha通道,您必须使用一些不正确的css属性才能在所有浏览器中使用半透明对象。 .semiTransparent { filter:alpha(opacity=50); -moz-opacity:0.5; -khtml-opacity: 0.5; opacity: 0.5; } 以上代码适用于所有浏览器,但无效。 Css filter is IE-specific. If yo ...
  • 你的选择是: 使用CSS3 : background: rgba(255, 255, 255, 0.3) 。 现场演示 绝对将两个
    标签放在彼此的顶部。 其中一个是背景,并具有opacity设置。 第二个包含文本, transparent背景。 正如您在问题中暗示的那样,您可以使用透明度为30%的.png文件。 我知道我已经读过有关使rgba在IE中工作的方法。 请参阅: http : //robertnyman.com/2010/01/11/css-background-transparency- ...
  • 尝试这样的事情 $("#"+ele).animate( { opacity:1, width:"300", height:"300", },2000); 参考 http://api.jquery.com/animate/ 例 $( "#book" ).animate({ ...
  • 为什么这让你感到惊讶? 你期望发生什么? 如果您不想这样做,请不要将这些子图层放在该超级图层中。 把它们放在它上面(也许是在一个单独的超级层)。 编辑:我现在明白你的问题。 您正在进行核心动画优化。 核心动画试图通过在合成之前将不透明度应用于所有子图层来节省时间。 这样它可以复合一次(这让它忽略容器超级层)。 大多数情况下,这可以解决并提高性能。 你想要它做的是超级层中的所有合成,然后应用不透明度,然后将结果与其他所有内容重新组合。 这称为光栅化; 这基本上意味着“在你把我与其他任何东西合成之前,请把我变成 ...
  • 你可以试试rgba颜色 border-color: rgb(255,255,255); /* fallback for IE */ border-color: rgba(255,255,255, 0.4); /* RGBA for the ones supporting it */ 最后一个是(alpha)不透明度。 但它在IE中不受支持,这就是为什么你需要一个后备版本 You may try rgba color border-color: rgb(255,255,255); /* fallback f ...
  • 文本图层可以具有8位颜色说明符。 不透明度是最后两位数。 即,FFFFFF99将是部分透明的白色。 Text layers can have an 8-digit color specifier. Opacity is the last two digit ...
  • 你可以使用@-moz-document url-prefix() {来排除firefox css。 像这样的例子 @-moz-document url-prefix() { .content { opacity: 1 !important; } } you can use @-moz-document url-prefix() { for excluding firefox css. example like this @-moz-document url-prefix() ...

相关文章

更多

最新问答

更多
  • 如何使用自由职业者帐户登录我的php网站?(How can I login into my php website using freelancer account? [closed])
  • 如何打破按钮上的生命周期循环(How to break do-while loop on button)
  • C#使用EF访问MVC上的部分类的自定义属性(C# access custom attributes of a partial class on MVC with EF)
  • 如何获得facebook app的publish_stream权限?(How to get publish_stream permissions for facebook app?)
  • 如何并排放置两个元件?(How to position two elements side by side?)
  • 在MySQL和/或多列中使用多个表用于Rails应用程序(Using multiple tables in MySQL and/or multiple columns for a Rails application)
  • 如何隐藏谷歌地图上的登录按钮?(How to hide the Sign in button from Google maps?)
  • Mysql左连接旋转90°表(Mysql Left join rotate 90° table)
  • 带有ImageMagick和许多图像的GIF动画(GIF animation with ImageMagick and many images)
  • 电脑高中毕业学习去哪里培训
  • 电脑系统专业就业状况如何啊?
  • IEnumerable linq表达式(IEnumerable linq expressions)
  • 如何在Spring测试中连接依赖关系(How to wire dependencies in Spring tests)
  • Solr可以在没有Lucene的情况下运行吗?(Can Solr run without Lucene?)
  • 如何保证Task在当前线程上同步运行?(How to guarantee that a Task runs synchronously on the current thread?)
  • 在保持每列的类的同时向数据框添加行(Adding row to data frame while maintaining the class of each column)
  • 的?(The ? marks in emacs/haskell and ghc mode)
  • 一个线程可以调用SuspendThread传递自己的线程ID吗?(Can a thread call SuspendThread passing its own thread ID?)
  • 延迟socket.io响应,并“警告 - websocket连接无效”(Delayed socket.io response, and “warn - websocket connection invalid”)
  • 悬停时的图像转换(Image transition on hover)
  • IIS 7.5仅显示homecontroller(IIS 7.5 only shows homecontroller)
  • 没有JavaScript的复选框“关闭”值(Checkbox 'off' value without JavaScript)
  • java分布式框架有哪些
  • Python:填写表单并点击按钮确认[关闭](Python: fill out a form and confirm with a button click [closed])
  • PHP将文件链接到根文件目录(PHP Linking Files to Root File Directory)
  • 我如何删除ListView中的项目?(How I can remove a item in my ListView?)
  • 您是否必须为TFS(云)中的每个BUG创建一个TASK以跟踪时间?(Do you have to create a TASK for every BUG in TFS (Cloud) to track time?)
  • typoscript TMENU ATagParams小写(typoscript TMENU ATagParams lowercase)
  • 武陟会计培训类的学校哪个好点?
  • 从链接中删除文本修饰(Remove text decoration from links)