This causes your application to freeze for too long and may cause for serious performance problems.
Why is that?
By default, RMI calls System.gc() once every minute. this forces a major collection (full GC) to occur.
a full GC is a collection of type "Stop The World", which means the JVM freezes until the GC is over.
Note that telling the JVM to perform a full GC every minute isn't needed, since your JVM knows by itself when to perform a full GC.
But not only it isn't needed, it also causes your application to freeze for an amount of time ranging from several ms. to a full second
(depending on your heap settings and application load).
In order to avoid unnecessary freezes in your application, you have two options:
1) Disable completely the option to call System.gc() from the code, by using the following JVM parameter:
2) Set the RMI garbage collection intervals (in this example, the RMI collection will occur once an hour):
To conclude: by default, if you're using RMI on Sun JVM, the JVM performs a full GC once a minute.
This can cause performance problem due to the freezes caused by the full GC.
In order to avoid that, you can either disable explicit calls to System.gc(), or tune the RMI GC to perform in a predefined interval.