Where can I find the following classes in Java

I am learning Java Java. As a result, I understand all the basics of programming like loops, variables, functions, etc. My biggest bottleneck is that I don't know how I can bypass Java packages as it does with .NET.

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

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

Is there a Java equivalent for .NET performance counters?

What are weak keys in Java? I just stumbled upon a collection that uses weak keys in Java, so I ask here. :)

thank

0


source to share


7 replies


JAMon is one of the possible open source Java monitoring libraries that might suit your requirements.

Also, any performance / management counters are exposed via Java Management Extensions (JMX)

Then you have multiple control consoles:



  • jconsole

    comes bundled with Java installation (Swing based)
  • MC4J open source console (Swing based)
  • eclipse-jmx console in Eclipse (SWT based)
  • Most application servers come with a JMX console on the web (ex: JBoss )

Alternatively, consider this other post for ideas on how to track JMX statistics in Perfmon.

Hope it helps.

+1


source


A dictionary that uses weak keys maintains a weak reference to each key, so if the key is otherwise eligible for garbage collection, it can be collected and the dictionary will effectively lose its entry. See the docs for WeakReference for more on weak references .

System.Diagnostics: I don't know of any equivalent for stopwatches and software breakpoints. For logging, take a look at java.util.logging or a third party package like log4j .



Performance Counters: There might be some way to connect some JVMs to Windows performance counters, but I've never seen one. There's VisualVM , which can be useful for some of the same things.

+3


source


If you just want something time, you can use 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);

      

+1


source


Regarding registrars, the package:

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

0


source


You can check http://commons.apache.org/ for many of your other requests. Java 1.4.2 and above have java.util.logging

0


source


Weak keys derive from encryption. Have you been thinking about weak links? Both .NET and Java support weak links.

0


source


I noticed that the regular .NET classes are in Java.Util (date is one of those common classes - I and I'm sure every developer uses it a lot in programming).

And such weak keys are associated with weak links - this is a concept that I know in .NET. This ends this question as he answered now. Thanks guys!

As far as performance monitoring (counters) goes, it looks like Java has no built-in functionality. Again, performance counters are a Windows feature, not just a .NET class. I am developing on Windows.

0


source







All Articles