我在哪里可以找到Java中的以下类

时间:2022-07-02 15:08:22

I am a .NET dev learning Java. As a result, I understand all the fundamentals of programming like loops, variables, functions, etc. My biggest bottleneck is that I don't know my way around Java's packages like I do with .NET's.

我是一名学习Java的.NET开发人员。因此,我理解了编程的所有基础知识,比如循环,变量,函数等。我最大的瓶颈是我不知道我的方式,就像我使用.NET一样。

This is the reason for this thread - where do I find the following functionality in Java?:

这就是这个线程的原因 - 我在哪里可以找到Java中的以下功能?:

System.Diagnostics - where can I use things like stopwatch, programmatic breakpoints and loggers?

System.Diagnostics - 我在哪里可以使用秒表,程序断点和记录器等东西?

Is there a Java equivalent of .NET performance counters?

是否有Java等效的.NET性能计数器?

What are weak keys in Java? I just came across a collection which uses weak keys in Java so am asking here. :)

什么是Java中的弱键?我刚刚遇到了一个在Java中使用弱键的集合,所以我在这里问。 :)

Thanks

7 个解决方案

#1


JAMon is one possible open-source Java Monitoring library that might fit your requirements.

JAMon是一个可能符合您要求的开源Java监控库。

In addition, any performance/management counters are exposed through Java Management Extensions (JMX)

此外,任何性能/管理计数器都通过Java Management Extensions(JMX)公开

Then you have a number of monitoring consoles:

然后你有许多监控控制台:

  • jconsole comes with bundled with the Java installation (Swing based)
  • jconsole附带Java安装(基于Swing)

  • MC4J open-source console (Swing based)
  • MC4J开源控制台(基于Swing)

  • eclipse-jmx console within Eclipse (SWT based)
  • Eclipse中的eclipse-jmx控制台(基于SWT)

  • Most application servers will come with a web-based JMX console (eg: JBoss)
  • 大多数应用程序服务器都带有基于Web的JMX控制台(例如:JBoss)

Alternatively, take a look at this other posting for ideas on how to monitor JMX statistics in Perfmon.

或者,请查看此其他帖子,了解如何监视Perfmon中的JMX统计信息。

Hope this helps.

希望这可以帮助。

#2


A dictionary which uses weak keys only keeps a weak reference to each key, so if the key is otherwise eligible for garbage collection, it may be collected and the dictionary will effectively lose the entry. See the docs for WeakReference for more about weak references.

使用弱密钥的字典仅保留对每个密钥的弱引用,因此如果密钥有资格进行垃圾收集,则可以收集它并且字典将有效地丢失条目。有关弱引用的更多信息,请参阅WeakReference的文档。

System.Diagnostics: I don't know of any equivalent for stopwatches and programmatic breakpoints. For logging, look in java.util.logging or a 3rd party package such as log4j.

System.Diagnostics:我不知道任何等效的秒表和程序断点。要进行日志记录,请查看java.util.logging或第三方软件包,例如log4j。

Performance counters: There may be some way of hooking some JVMs into Windows Performance Counters, but I've never seen them. There's VisualVM which you may find useful for some of the same things though.

性能计数器:可能有一些方法将一些JVM连接到Windows性能计数器,但我从未见过它们。虽然VisualVM可能对某些相同的东西很有用。

#3


If you just want to time something, you can use System.nanoTime().

如果您只是想要时间,可以使用System.nanoTime()。

long start = System.nanoTime();

// a bunch of code

long end = System.nanoTime();

System.out.println("Elapsed time in seconds: " + (end-start)/1000000000.0);

#4


As for loggers the package is:

至于记录器,包装是:

java.util.loogging

import java.util.loggin.Logger;

...

Logger logger = Logger.getLogger( this.getClass().getName() );

logger.fine( "Hello" );

logger.severe(" Oh oh ");

Here are some useful links:

以下是一些有用的链接:

http://java.sun.com/javase/6/docs/api/java/util/logging/Logger.html

http://java.sun.com/javase/6/docs/api/

http://java.sun.com/javase/6/docs/api/allclasses-noframe.html

#5


The concept of "weak keys" comes from encryption. Perhaps you were thinking of weak references? Both .NET and Java support weak references.

“弱密钥”的概念来自加密。也许你在想弱参考? .NET和Java都支持弱引用。

#6


You should check out http://commons.apache.org/ for a lot of your other queries. Java 1.4.2 and above have java.util.logging

你应该查看http://commons.apache.org/了解很多其他问题。 Java 1.4.2及更高版本具有java.util.logging

#7


I've noticed that common .NET classes reside in Java.Util (date is one of those common classes - something I and I'm sure every dev uses often in programming).

我注意到常见的.NET类驻留在Java.Util中(日期是这些常见类之一 - 我和我确信每个开发人员经常在编程中使用它)。

Ah so weak keys is related to weak references - a concept I'm familiar of in .NET. That ends that question as it's answered now. Thanks guys!

啊,所以弱键与弱引用有关 - 这是我在.NET中熟悉的一个概念。这就结束了这个问题,因为现在已经回答了。多谢你们!

As for performance monitoring (counters), looks like there's no built in functionality into Java. Then again, performance counters is a Windows feature and not just a class in .NET I guess? I am developing on Windows.

至于性能监视(计数器),看起来Java中没有内置的功能。再说一次,性能计数器是一个Windows功能,而不仅仅是.NET中的一类我猜?我在Windows上开发。

#1


JAMon is one possible open-source Java Monitoring library that might fit your requirements.

JAMon是一个可能符合您要求的开源Java监控库。

In addition, any performance/management counters are exposed through Java Management Extensions (JMX)

此外,任何性能/管理计数器都通过Java Management Extensions(JMX)公开

Then you have a number of monitoring consoles:

然后你有许多监控控制台:

  • jconsole comes with bundled with the Java installation (Swing based)
  • jconsole附带Java安装(基于Swing)

  • MC4J open-source console (Swing based)
  • MC4J开源控制台(基于Swing)

  • eclipse-jmx console within Eclipse (SWT based)
  • Eclipse中的eclipse-jmx控制台(基于SWT)

  • Most application servers will come with a web-based JMX console (eg: JBoss)
  • 大多数应用程序服务器都带有基于Web的JMX控制台(例如:JBoss)

Alternatively, take a look at this other posting for ideas on how to monitor JMX statistics in Perfmon.

或者,请查看此其他帖子,了解如何监视Perfmon中的JMX统计信息。

Hope this helps.

希望这可以帮助。

#2


A dictionary which uses weak keys only keeps a weak reference to each key, so if the key is otherwise eligible for garbage collection, it may be collected and the dictionary will effectively lose the entry. See the docs for WeakReference for more about weak references.

使用弱密钥的字典仅保留对每个密钥的弱引用,因此如果密钥有资格进行垃圾收集,则可以收集它并且字典将有效地丢失条目。有关弱引用的更多信息,请参阅WeakReference的文档。

System.Diagnostics: I don't know of any equivalent for stopwatches and programmatic breakpoints. For logging, look in java.util.logging or a 3rd party package such as log4j.

System.Diagnostics:我不知道任何等效的秒表和程序断点。要进行日志记录,请查看java.util.logging或第三方软件包,例如log4j。

Performance counters: There may be some way of hooking some JVMs into Windows Performance Counters, but I've never seen them. There's VisualVM which you may find useful for some of the same things though.

性能计数器:可能有一些方法将一些JVM连接到Windows性能计数器,但我从未见过它们。虽然VisualVM可能对某些相同的东西很有用。

#3


If you just want to time something, you can use System.nanoTime().

如果您只是想要时间,可以使用System.nanoTime()。

long start = System.nanoTime();

// a bunch of code

long end = System.nanoTime();

System.out.println("Elapsed time in seconds: " + (end-start)/1000000000.0);

#4


As for loggers the package is:

至于记录器,包装是:

java.util.loogging

import java.util.loggin.Logger;

...

Logger logger = Logger.getLogger( this.getClass().getName() );

logger.fine( "Hello" );

logger.severe(" Oh oh ");

Here are some useful links:

以下是一些有用的链接:

http://java.sun.com/javase/6/docs/api/java/util/logging/Logger.html

http://java.sun.com/javase/6/docs/api/

http://java.sun.com/javase/6/docs/api/allclasses-noframe.html

#5


The concept of "weak keys" comes from encryption. Perhaps you were thinking of weak references? Both .NET and Java support weak references.

“弱密钥”的概念来自加密。也许你在想弱参考? .NET和Java都支持弱引用。

#6


You should check out http://commons.apache.org/ for a lot of your other queries. Java 1.4.2 and above have java.util.logging

你应该查看http://commons.apache.org/了解很多其他问题。 Java 1.4.2及更高版本具有java.util.logging

#7


I've noticed that common .NET classes reside in Java.Util (date is one of those common classes - something I and I'm sure every dev uses often in programming).

我注意到常见的.NET类驻留在Java.Util中(日期是这些常见类之一 - 我和我确信每个开发人员经常在编程中使用它)。

Ah so weak keys is related to weak references - a concept I'm familiar of in .NET. That ends that question as it's answered now. Thanks guys!

啊,所以弱键与弱引用有关 - 这是我在.NET中熟悉的一个概念。这就结束了这个问题,因为现在已经回答了。多谢你们!

As for performance monitoring (counters), looks like there's no built in functionality into Java. Then again, performance counters is a Windows feature and not just a class in .NET I guess? I am developing on Windows.

至于性能监视(计数器),看起来Java中没有内置的功能。再说一次,性能计数器是一个Windows功能,而不仅仅是.NET中的一类我猜?我在Windows上开发。