Archive for the ‘help notes’ Category
where, oh where is the list of all those magic -XX java parameters?
Thursday, January 10th, 2008The master list is here.
But just in case it goes away here is the list (pruned for java 6):
| Option and Default Value | Description |
|---|---|
| -XX:+ExplicitGCInvokes ConcurrentAndUnloadsClasses |
is selected, then in response to an explicit GC request, such as System.gc(), the JVM will run a concurrent collection cycle in which classes eligible for collection are unloaded. This flag implies -XX:+ExplicitGCInvokesConcurrent and is effective only when a concurrent collector is in use. This allows an application to recycle space in the permanent generation on an as-required, schedulable, basis. (ADDED in 1.6u4) |
| -XX:-AllowUserSignalHandlers | Do not complain if the application installs signal handlers. (Relevant to Solaris and Linux only.) |
| -XX:-DisableExplicitGC | Disable calls to System.gc(), JVM still performs garbage collection when necessary. |
| -XX:+FailOverToOldVerifier | Fail over to old verifier when the new type checker fails. (Introduced in 6.) |
| -XX:+HandlePromotionFailure | The youngest generation collection does not require a guarantee of full promotion of all live objects. (Introduced in 1.4.2 update 11) [5.0 and earlier: false.] |
| -XX:+MaxFDLimit | Bump the number of file descriptors to max. (Relevant to Solaris only.) |
| -XX:PreBlockSpin=10 | Spin count variable for use with -XX:+UseSpinning. Controls the maximum spin iterations allowed before entering operating system thread synchronization code. (Introduced in 1.4.2.) |
| -XX:-RelaxAccessControlCheck | Relax the access control checks in the verifier. (Introduced in 6.) |
| -XX:+ScavengeBeforeFullGC | Do young generation GC prior to a full GC. (Introduced in 1.4.1.) |
| -XX:+UseAltSigs | Use alternate signals instead of SIGUSR1 and SIGUSR2 for VM internal signals. (Introduced in 1.3.1 update 9, 1.4.1. Relevant to Solaris only.) |
| -XX:+UseBoundThreads | Bind user level threads to kernel threads. (Relevant to Solaris only.) |
| -XX:-UseConcMarkSweepGC | Use concurrent mark-sweep collection for the old generation. (Introduced in 1.4.1) |
| -XX:+UseGCOverheadLimit | Use a policy that limits the proportion of the VM’s time that is spent in GC before an OutOfMemory error is thrown. (Introduced in 6.) |
| -XX:+UseLWPSynchronization | Use LWP-based instead of thread based synchronization. (Introduced in 1.4.0. Relevant to Solaris only.) |
| -XX:-UseParallelGC | Use parallel garbage collection for scavenges. (Introduced in 1.4.1) |
| -XX:-UseParallelOldGC | Use parallel garbage collection for the full collections. Enabling this option automatically sets -XX:+UseParallelGC. (Introduced in 5.0 update 6.) |
| -XX:-UseSerialGC | Use serial garbage collection. (Introduced in 5.0.) |
| -XX:+UseTLAB | Use thread-local object allocation (Introduced in 1.4.0, known as UseTLE prior to that.) [1.4.2 and earlier, x86 or with -client: false] |
| -XX:+UseSplitVerifier | Use the new type checker with StackMapTable attributes. (Introduced in 5.0.)[5.0: false] |
| -XX:+UseThreadPriorities | Use native thread priorities. |
| -XX:+UseVMInterruptibleIO | Thread interrupt before or with EINTR for I/O operations results in OS_INTRPT. (Introduced in 6. Relevant to Solaris only.) |
Performance Options
| Option and Default Value | Description |
|---|---|
| -XX:+AggressiveOpts | Turn on point performance compiler optimizations that are expected to be default in upcoming releases. (Introduced in 5.0 update 6.) |
| -XX:CompileThreshold=10000 | Number of method invocations/branches before compiling [-client: 1,500] |
| -XX:LargePageSizeInBytes=4m | Sets the large page size used for the Java heap. (Introduced in 1.4.0 update 1.) [amd64: 2m.] |
| -XX:MaxHeapFreeRatio=70 | Maximum percentage of heap free after GC to avoid shrinking. |
| -XX:MaxNewSize=size | Maximum size of new generation (in bytes). Since 1.4, MaxNewSize is computed as a function of NewRatio. [1.3.1 Sparc: 32m; 1.3.1 x86: 2.5m.] |
| -XX:MaxPermSize=64m | Size of the Permanent Generation. [5.0 and newer: 64 bit VMs are scaled 30% larger; 1.4 amd64: 96m; 1.3.1 -client: 32m.] |
| -XX:MinHeapFreeRatio=40 | Minimum percentage of heap free after GC to avoid expansion. |
| -XX:NewRatio=2 | Ratio of new/old generation sizes. [Sparc -client: 8; x86 -server: 8; x86 -client: 12.]-client: 4 (1.3) 8 (1.3.1+), x86: 12] |
| -XX:NewSize=2.125m | Default size of new generation (in bytes) [5.0 and newer: 64 bit VMs are scaled 30% larger; x86: 1m; x86, 5.0 and older: 640k] |
| -XX:ReservedCodeCacheSize=32m | Reserved code cache size (in bytes) - maximum code cache size. [Solaris 64-bit, amd64, and -server x86: 48m; in 1.5.0_06 and earlier, Solaris 64-bit and and64: 1024m.] |
| -XX:SurvivorRatio=8 | Ratio of eden/survivor space size [Solaris amd64: 6; Sparc in 1.3.1: 25; other Solaris platforms in 5.0 and earlier: 32] |
| -XX:TargetSurvivorRatio=50 | Desired percentage of survivor space used after scavenge. |
| -XX:ThreadStackSize=512 | Thread Stack Size (in Kbytes). (0 means use default stack size) [Sparc: 512; Solaris x86: 320 (was 256 prior in 5.0 and earlier); Sparc 64 bit: 1024; Linux amd64: 1024 (was 0 in 5.0 and earlier); all others 0.] |
| -XX:+UseBiasedLocking | Enable biased locking. For more details, see this tuning example. (Introduced in 5.0 update 6.) [5.0: false] |
| -XX:+UseFastAccessorMethods | Use optimized versions of Get<Primitive>Field. |
| -XX:-UseISM | Use Intimate Shared Memory. [Not accepted for non-Solaris platforms.] For details, see Intimate Shared Memory. |
| -XX:+UseLargePages | Use large page memory. (Introduced in 5.0 update 5.) For details, see Java Support for Large Memory Pages. |
| -XX:+UseMPSS | Use Multiple Page Size Support w/4mb pages for the heap. Do not use with ISM as this replaces the need for ISM. (Introduced in 1.4.0 update 1, Relevant to Solaris 9 and newer.) [1.4.1 and earlier: false] |
Debugging Options
| Option and Default Value | Description |
|---|---|
| -XX:-CITime | Prints time spent in JIT Compiler. (Introduced in 1.4.0.) |
| -XX:ErrorFile=./hs_err_pid<pid>.log | If an error occurs, save the error data to this file. (Introduced in 6.) |
| -XX:-ExtendedDTraceProbes | Enable performance-impacting dtrace probes. (Introduced in 6. Relevant to Solaris only.) |
| -XX:HeapDumpPath=./java_pid<pid>.hprof | Path to directory or filename for heap dump. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.) |
| -XX:-HeapDumpOnOutOfMemoryError | Dump heap to file when java.lang.OutOfMemoryError is thrown. Manageable. (Introduced in 1.4.2 update 12, 5.0 update 7.) |
| -XX:OnError=”<cmd args>;<cmd args>” | Run user-defined commands on fatal error. (Introduced in 1.4.2 update 9.) |
| -XX:OnOutOfMemoryError=”<cmd args>; <cmd args>” |
Run user-defined commands when an OutOfMemoryError is first thrown. (Introduced in 1.4.2 update 12, 6) |
| -XX:-PrintClassHistogram | Print a histogram of class instances on Ctrl-Break. Manageable. (Introduced in 1.4.2.) The jmap -histo command provides equivalent functionality. |
| -XX:-PrintConcurrentLocks | Print java.util.concurrent locks in Ctrl-Break thread dump. Manageable. (Introduced in 6.) The jstack -l command provides equivalent functionality. |
| -XX:-PrintCommandLineFlags | Print flags that appeared on the command line. (Introduced in 5.0.) |
| -XX:-PrintCompilation | Print message when a method is compiled. |
| -XX:-PrintGC | Print messages at garbage collection. Manageable. |
| -XX:-PrintGCDetails | Print more details at garbage collection. Manageable. (Introduced in 1.4.0.) |
| -XX:-PrintGCTimeStamps | Print timestamps at garbage collection. Manageable (Introduced in 1.4.0.) |
| -XX:-PrintTenuringDistribution | Print tenuring age information. |
| -XX:-TraceClassLoading | Trace loading of classes. |
| -XX:-TraceClassLoadingPreorder | Trace all classes loaded in order referenced (not loaded). (Introduced in 1.4.2.) |
| -XX:-TraceClassResolution | Trace constant pool resolutions. (Introduced in 1.4.2.) |
| -XX:-TraceClassUnloading | Trace unloading of classes. |
| -XX:-TraceLoaderConstraints | Trace recording of loader constraints. (Introduced in 6.) |
explain this
Monday, August 13th, 2007type parameters of
T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object
In java 1.6u2 running in maven 2.0.7, we started getting this message but in eclipse 3.3.0 we were not. (and in idea we also were failing)
First, what the hell does this message means? Second, why can eclipse handle the issue and not the regular jdk?
Anyhow the problem was caused by this (our example was a little more complex than this):
public <T> T getFoo() {
T result;
result = getBar();
return result;
}
public <T> T getBar() {
return (T) map.get(”bar”);
}
The workaround is casting the line:
result = getBar();
to:
result = (T)getBar();
apache v. tomcat mysteries…
Tuesday, May 29th, 2007So I struggled for hours trying to get apache to connect via the ajp13 worker to tomcat 5.5 We are using a Debian box on the production server. Could not make it happen…. until I set the worker to be ‘ajp13′.
Don’t understand what wierdness is going on but… I do know this. if my /etc/libapache-mod-jk/workers.properties file looks like this (comments removed):
workers.tomcat_home=/usr/share/tomcat5.5
workers.java_home=/usr/local/java
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13
Apache 2 talks very nicely with Tomcat 5.5.20
If it looks like this:
workers.tomcat_home=/usr/share/tomcat5.5
workers.java_home=/usr/local/java
worker.list=amplafi_ajp13
worker.amplafi_ajp13.port=8009
worker.amplafi_ajp13.host=localhost
worker.amplafi_ajp13.type=ajp13
worker.amplafi_ajp13.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=amplafi_ajp13
Everything is broken!
Does anyone have a clue here on why?
why doesn’t tomcat make it possible to not have jsessionid in urls?
Sunday, February 18th, 2007I don’t know either! But fortunately I found this great post.
Hibernate’s event system
Sunday, October 1st, 2006So I just had an interesting realization, Hibernate uses various default listeners in it’s poorly documented event system to do all of its persistence work.
For example, saving an object through a Hibernate Session object quickly goes to the Session.fireSaveOrUpdate, which by default calls DefaultSaveOrUpdateEventListener. DefaultSaveOrUpdateEventListener does all the heavy lifting of checking to see if the object legal to save prior to actually saving the object.
These default listeners also invoke interceptors as briefly described in section 12.1 of the 3.2.0.cr4 manual.
This means that if someone starts adding event listeners of their own, they better make damn sure that they add in Hibernate’s as well. Otherwise Hibernate will very quietly do nothing!
I filed this bug in the hopes that the documentation would get changed:
Please add this (or equivalent) to the bottom of section 12.1. (Interceptors):
===========================================
Interceptors are invoked by Hibernate’s default event listeners. For example, interceptors’ onSave() method is invoked by Hibernate’s DefaultSaveOrUpdateEventListener
===========================================Please add this (or equivalent) to the bottom of section 12.2 (Event System):
===========================================
When changing the event listeners be sure to keep the various Hibernate default listeners. These listeners actually perform much of Hibernate’s persistence work, including invocation of the interceptors. Without those default listeners, Hibernate will quietly do nothing.
===========================================
| Event | Default Hibernate EventListener | Interceptor method called by default listener |
|---|---|---|
| PreLoadEvent | DefaultPreLoadEventListener | onLoad |
| PreInsertEvent (return true to veto the insertion) |
DefaultSaveOrUpdateEventListener (on HSQL EntityIdentityInsertAction - which gets the generated id after the insertion) |
? |
| SaveOrUpdateEvent | DefaultSaveOrUpdateEventListener | onSave |
| PostInsertEvent (called even if the PreInsertEvent vetoed the insertion) |
DefaultSaveOrUpdateEventListener | ? |
some notes on hibernate-annotation
Thursday, September 7th, 2006I am now implementing my persistence layer with a vengence. I decided to take a chance with using the hibernate-annotation to define my persistence objects because of all the work with Seam and Trails that is happening to leverage those annotations.
Unfortunately, I got to experience the joys of being a trailblazer with CR code as opposed to released code. These are some of the issues I ran into with the hibernate-annotation 3.2.cr1 release:
The biggest problem so far is with compound primary keys. (keys that are composed of multiple fields). I wanted to create a @Entity class that had a compound field that was partially generated using the @GenerateValue flag and partially supplied with an application-defined value.
These are the problems I ran into:
- If you have a @Entity that has two or more fields annotated with @Id *and* @IdClass is not used, then only the first one is respected. So the primary key is only the first field. However, all such fields are labeled as requiring a value (as if @NotNull specified). I filed this report about this problem.
- If using you do use @IdClass then the @Ids are respected with regards to the primary key definition. However, @GenerateValue is ignored when placed on @Embeddable’s (supplied in the @IdClass) fields. This makes sense for a bunch of reasons. The best one being that the @Embeddable may be used by multiple @Entity classes. Unfortunately, @GenerateValue is also ignored when placed on the @Entity class’s id fields.
- Using @EmbeddedId doesn’t have any mechanism for specifying a @GeneratedValue. And once again, @GenerateValue is ignored when placed on the @Embeddable class’ fields.
- When using @EmbeddedId, if @Id is used on the @Embeddable class’ fields this causes an error message that is completely wrong. 3.2.0.cr1 reports that the @Embeddable doesn’t have id fields. The problem is solved by removing the @Id’s, not by using them. I filed this report.
Now that I am passed these issues, I still don’t know how to create a compound key with part of it generated. So I posted this on the hibernate forums.
maven 2 dependencies
Tuesday, September 5th, 2006I discovered this neat feature of maven2 that allows a project to specify the minimum version of a dependency but accept any higher version. This allows project writers to not have to hard-coded version dependencies to other projects.
This allows users of those projects to use newer versions of the project’s dependencies automatically. For example, “transparent-politics” depends on “tapestry” which depends on “commons-httpclient”.
If tapestry’s pom.xml specifies its commons-httpclient dependency as:
<dependency> <groupId>commons-httpclient</groupid> <artifactId>commons-httpclient</artifactId> <version>[3.1-alpha1,)</version> </dependency>
Then when a newer version of commons-httpclient comes out, say 3.1-alpha1, the transparent-politics build will pick that up automatically.
tomcat debugging (5.5.13)
Wednesday, December 7th, 2005If you get the following error when starting Tomcat in debug mode:
FATAL ERROR in native method: No transports initialized
Transport dt_socket failed to initialize, rc = 509.
The solution is to copy dt_socket.dll from $JDK14ROOT/jre/bin to $JDK14ROOT/bin. This seems to be fixed in J2SE 5.