I have an app distributed in multiple tomcats and using a hazel cast to share data. In the app, I use map that needs to be consistent throughout all the Tomcats. Is there any reason why one should prefer using the message distribution mechanism (ITop
If I have a List[HugeObjects] with numerous elements that I have to iterate only once and no operations are made on it (e.g. appending, prepending, etc), does it make sense that I convert that List into an Iterator, so when I iterate it the elements
Consider the program: public class Test { public static void main(String[] args) { if (Arrays.asList(args).contains("--withFoo")) { use(new Foo()); } } static void use(Foo foo) { // do something with foo } } Is Foo required in the runtime classp
There are many ways to analyze jvm memory usage offline, like MAT, jmap. However, is there any way to measure the memory usage inside the code during the runtime? Any advice will be much appreciated.Please refer to the official Java documentation, i.
Background: We have an Oracle 11g database running a Java Virtual Machine with JRE version 1.6.0_43. Our user interface is hosted on an Apache webserver which interfaces with the database through mod-plsql. We have some PLSQL procedures calling Java
I've heard that JIT automatically inlines small methods, like getters (they have about 5 bytes). What is the boundary? Is there any JVM flag?HotSpot JIT inlining policy is rather complicated. It involves many heuristics like caller method size, calle
I have a working code that loads dynamically different Class Implementations with different Class Names. The class files are loaded into the in-memory database (Apache Derby Db), and classloader retrieve the .class file from the BLOB columns. What I
I am facing with a strange case. I'd be glad if you could share your comments. We have solution running on Java 1.6.085 and sometimes Java process is getting hang in production. The solution is running on Linux server. I investigated GC logs, there i
In android studio in the new sub-project has, as I understand this integration tests that run on the device or emulator, checks the functionality of the application depends on the SDK android. But I do have methods do not depend on android. Their tes
I'm looking at this Java code: while (n-- != 0) { if (searchMe.charAt(j++) != substring.charAt(k++)) { continue test; } } I am confused about when, exactly, the n-- operation takes place. Is it after the if statement?The n-- operation happens each ti
When I was executing a Java program I noticed that the Java compiler is case-insensitive with respect to file names whereas the Java interpreter is case-sensitive. The Java interpreter being case-sensitive is very much understandable as, the name of
i'm call this method several times: private static void writeFile(double val, String myFile) throws IOException { FileWriter file = new FileWriter(myFile, true); file.write(val + "\n"); file.close(); } After a periode i have this exception : Exc
I am running 64-bit windows 7 with 4GB of RAM. I have 32-bit java I am trying to run a graph search algorithm in eclipse. I commented absolutely everything out except for a simple println("Hello World") After a lot of tinkering, I found that I c
Why does Java have much better performance compared to other interpreted languages like Python? I know this probably has something to do with the fact that it's compiled beforehand, but what about concurrency? How is the JVM able to perform so much b
I am looking to set the VM argument Djava.library.path programmatically. If this can't be done, what are the alternatives (if there are any)?take a look at this java doc http://docs.oracle.com/javase/6/docs/api/java/lang/System.html#setProperty(java.
My OS version is Windows 7 64 bit and the JDK is 32 bit version. I started my JBoss Wrapper Application successfully, but after it ran for a while the JVM failed and restarted. The message in the JVM dump log is: # # There is insufficient memory for
Is it possible in OQL to retrieve all the objects that belongs to a package? Or can I query with wildcards? As @haridsv suggested I tried: SELECT * from "com.example.*" and SELECT a from "com\.example\..*" but in VisualVM it complaints
I've got a method in an enumeration that is called by many threads running at same time. Because the JVM allows only one instance of an enumeration to be allocated in memory, I guess there are some optimisation being done somewhere either by the comp
http://www.oracle.com/technetwork/java/javase/tech/g1-intro-jsp-135488.html seems to be the official docs for the G1 garbage collector. There are two options mentioned: -XX:+G1ParallelRSetUpdatingEnabled -XX:+G1ParallelRSetScanningEnabled When config
I have an app server process that's constantly at 100% CPU. By constantly I mean hours, or even days. I know how to generate a heap/thread dump, but I'm looking for more dynamic information. I would like to know what is using so much CPU in there. Th
Some of you probably know that some of core java APIs make explicit calls to System.gc(). I know two cases when this happens: NIO. I believe that is done to do some cleanup for direct ByteBuffers, when system runs out of "direct" memory. RMI. He
Following my question on whether the CLR could use compressed pointers, the answer was that it's pretty pointless. Still, some JVMs are implementing it, so what are the concrete benefits of this optimization, since gaining 4 bytes doesn't seem worth
The Tomcat Manager reports a different thread count than ThreadMXBean. The number of threads reported by ThreadMXBean is the same as the number of threads reported in the YourKit profiler as well. Is there a difference between Tomcat threads and JVM
Why does Java , running in -server mode, say that the version is "mixed-mode" ? When I see that, does it mean that the JVM didn't truly load in pure server mode?server mode does not mean "not mixed". Those are different settings. Mixed
How does one obtain the location of the executable of the currently running JVM during runtime? I would like to instantiate another JVM as a subprocess using the ProcessBuilder class. I am aware that there is the java.home System property, but this d
Imagine a setup of 6-7 servers all identical with identical java version "1.6.0_18" OpenJDK Runtime Environment (IcedTea6 1.8) (fedora-36.b18.fc11-i386) OpenJDK Server VM (build 14.0-b16, mixed mode) each running a program (memory and CPU intens
I want to ask which piece of code is more efficient in Java? Code 1: void f() { for(int i = 0 ; i < 99999;i++) { for(int j = 0 ; j < 99999;j++) { //Some operations } } } Code 2: void f() { int i,j; for(i = 0 ; i < 99999;i++) { for(j = 0 ; j <
Parrot is the virtual machine originally designed for Perl 6. What technical capabilities does the Parrot VM offer that competing virtual machines such as the Java Virtual Machine (JVM)/Hotspot VM and Common Language Runtime (CLR) lack?The following
if we implement java interpreter in hardware then how we can achieve architecture neutrality of java bytecode... does java uses JIT(just in time interpreter) ? and how all this is related to Virtual Machine concept of operating system and java virtua
What language is Sun's JVM written in?Sun actually has multiple JVMs. The HotSpot JVM is written largely in C++, because HotSpot is heavily based on the Animorphic Smalltalk VM which is written in C++. More interesting than HotSpot is IMHO the Maxine