Skip to main content

Posts

Java primitive types

Just to remember... nothing more :

byteShort numerical from -128 to +1271 byteshortShort numerical from -32768 to +327672 bytesintNumerical from -2 147 483 648 to +2 147 483 6474 byteslongLong numerical from -263 to +263 -18 bytesfloatDecimal from -1.4 * 10-45 to +3.4 * 10384 bytesdoubleLong decimal from 4.9 * 10-324 to +1.7 * 103088 bytescharUnicode character (65536 possible characters)2 bytesbooleanBoolean (true or false)1 byte

Let's work in full screen mode

One of the greats features offered by Java is its capability to switch in full screen mode. The following article is a sun's tutorial on this subject :

http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html

To illustrate how it is benefit to use this mode, I want to opposite it to web based applications that impose the display of unusefull navigator toolbars (taking 25% of the screen workspace).

I will implement full screen mode in Violet UML Editor.

Inside the Sun's JVM memory

Yesterday, my manager asked me about a problem concerning the eden space memory. So, this is a summary of JVM's memory management.
Heap Size
The allocation of memory for the JVM is specified using -X options when starting ColdFusionJVM option Meaning
-Xms initial java heap size
-Xmx maximum java heap size
-Xmn the size of the heap for the young generation
(extended options)
-XX:MaxPermSize maximum permanent generation size (for creating object instances)
For efficient garbage collection, the -Xmn value should be lower than the -Xmx value.Heap size does not determine the amount of memory your process uses
If you monitor your java process with an OS tool like top or taskmanager, you may see the amount of memory you use exceed the amount you have specified for -Xmx. -Xmx limits the java heap size, java will allocate memory for other things, including a stack for each thread. It is not unusual for the total memory consumption of the VM to exceed the value of -Xmx.Garba…

Batch processing in Hibernate

I read this article that is very interesting (thank you very much Marco) :

Suppose you need to insert 200,000 records into a database in Hibernate. You'll need to adjust the following settings:
//set the JDBC batch size (it is fine somewhere between 20-50)
hibernate.jdbc.batch_size 30

//disable second-lavel cache
hibernate.cache.use_second_level_cache false

//and now do your job like this
Session S=SF.openSession(); //SF = SessionFactory object
Transaction T=S.beginTransaction();

for (int i=0;i<200000;i++)
{
record r=new record(...);
S.save(record);
if(i % 30==0)
{ //30, same as the JDBC batch size
//flush a batch and release memory
session.flush();
session.clear();
}
}

//clean
T.commit();
S.close();
(Author : Anghel Leonard)

First Step

Humm... Well it's done! I don't want to spam Marco's blog (javacomptoir) anymore with dailly messages. On this blog, I will write about my readings, about articles I found on the web. In many cases, I will be about Java. But sometimes, It will be about related technologies such as databases, global software architecture and... my favorite activity during spare times : Violet, THE Very Intuitive Object modeling software that I develop behind Cay S. Horstmann.

Thus, this blog will be a sort of bookmark with some experience feedbacks