Modern oracle jvms (java 1.7, java 1.6) are bundled with couple of tools that allow watching to the heartbeat of your jvm during the run-time. One of the prominent is of course VisualVM which evolves even independently of jvm releases. If you didn’t used it before try right now. VisualVM allows relative deep analysis and its comprehensive enough furthermore it’s open source tool.
However it reaches limitats when you have to work with java version prior to 1.5. (in a real world sometimes thing changes slowly Also it’s often the case that its not easy to connect over RMI remotely to productive machines, therefore its never a bad thing to be familiar with console tools modern jdk and jvm’s providing. Furthermore console tools are often very handy, focused on one or few tasks, they are low resource consuming and you can build chains of such tools and reuse them in your way. So let’s look on them.
Read more »
This post shows how to clean JPA entities out of Persistence Context overhead when you need to use them outside of container, serialize them and send them over RMI, SOAP and other protocols to another JVMs.
You may found yourself in a situation where you don’t have DTO’s, there existing object-graph is a bit wide-spreading but you need to use entity objects outside of the managed scope. So where is a problem? In case of Hibernate first problem appears is huge object footprint you’ll have to serialize by default even if you send just one detached entity. I found that at some circumstances nearly the whole Hibernate Context is still connected to your detached entities. If you serializes such an huge but useless object graph every time, you slows down your client, last your network, creates huge RMI/Web Service marshalling overhead, wastes client memory which even can provokes out of memory problems. All that you don’t need in your application.
So how to avoid this? We need a simple way to purify given entities at “low cost”. Which means the solution has to be simple for developers, with minimal boilerplate code and also performant at run-time. The output should contain clearly detached and as much as possible purified entities. It’s very important to cut any possible references to technical baground object of (hibernate) persistent context.
Before you start you have to be clear about that such cleaning makes sense only outside of transaction scope. Then at the end of transaction all participated entities have to maintain their persistent state, so of course they cannot be detached before that point. Otherwise detached and pruned entities cannot be persist by entity manager anymore and have to be refreshed first.
However you don’t have to weak transactional behavior, just do cleaning outside of transactional scope. In container managed transaction environment it simply achieved by annotations. Read more »
This post was began for more than a 2 years ago and because i was to busy to finish it. But now here is it, better late than never.
The goal is simple. There is a need of having a central storage of shared and private documents for small (rarely changing) user group. We have windows and Linux PC that have to access this centralized file storage. A user-friendly access as well minimum of maintenance are also goals here. Furthermore base level of security is a goal here as well.
However the peresented configuration as I think is quite suituable for private use, small working groups and even kinds of small businesses.
It think it’s not a bad idea to have two different data spaces: private and shared. An this separation leads to simple rules of usage:
- Every user can read own documents and documents of other users in the shared place.
- write and delete is only permitted in user’s private directory.
Read more »
This post is attended to everyone who is creating Java applications with Eclipse Rich Client Platform. This article describes a working tycho configuration on working project (demo) project. That project can be build fully automatically with tycho on your CI server e.g. Jenkins.
If you have developed Eclipse RCP, you maybe also come to the conclusion that PDE-Build out of Eclipse IDE is not really an apropriate and stable way to build serious, production ready applications. But also automatization of PDE Build was not straightforward task, and a such is still not well documented (IMHO).
Furthermore maybe you heard about some alternatives like buckminister approach or athena. There is also a couple more approaches, but my focus yet is on tycho because i believe it has bright feature.
So again this post describe kick stat tycho approache the next topic may cover, artifact repository, CI Server or, advanced tycho tasks, fill fre to comment…
Let me introduce tycho in few words here. Technically tycho is a set of maven plugins. But let it be said at the beginning, tycho tries to use all the eclipse PDE/JDT metadata first, everywhere it’s possible and therefore one of the goals of tycho project is to minimise configuraton duplication in maven artefacts. I try to show how this works on a working example.
But first here is the self-speaking list of tychos packaging types, i will covers here some of them more detailed.
- eclipse-plugin result in Eclipse Plug-In bundle
- eclipse-test-plugin result in a test Plugin
- eclipse-feature wich eclipse feature as Result
- eclipse-application builds Eclipse Applicaton
- eclipse-repository builds repository an executables
- eclipse-update-site responisble for update-sites
Tycho current release is 0.13.0 and is used in my example.
Read more »
Looking on my block at the end of the year i see than nearly two years ago i wrote about extracting archives under Linux but not about putting files in to archives. Now a have some time to continue.
Here are some common way to create your archives.
#Creates simple targetfile.tar without compression.
tar cvf targetfile.tar sourcedir/*
#Zip everything beneath sourcedir to targetfile.tar.gz
tar cvzf targetfile.tar.gz sourcedir/*
#Bzip2 everything beneath sourcedir to targetfile.tar.bz2
tar cvjf targetfile.tar.bz2 sourcedir/*
- c or –create create a new archive
- v or –verbose verbosely list files processed
- z or –gzip usage of gzip compression (or also decompression, context dependent)
- j or –bzip2 usage of bzip2 compression
- f or –file use archive file
Alternative with pipe usage:
tar -cf - sourcedir | gzip -c > filename.tar.gz
#Zip every file in current directroy to file.zip.
#But hidden files like (.htaccess) are not included.
zip file.zip sourcedir/*
#also includes hidden files.
zip file.zip sourcedir/*.*
The above examples include directories but still not their content recursively, -r option is required.
#Adds all files and directories recursivly.
zip file.zip -r /sourcedir/*
#Same as abowe with addtional enryption and password lock.
#Password is prompted on the terminal.
zip file.zip -re /sourcedir/*
#Splitts creted archive to parts not bigger than 2 Gigabytes.
zip -s 2g -r test.zip ./*
Hope that helps someone.
Happy new year!!!
This is a short step by step explanation of the setup of JBoss 7.0.2 on your Linux (explicit debian). Nowadays there is still no official Debian package for JBoss 7 out there, so we have to do a couple of steps manually. First i describe how to download and to prepare the jboss. Secondly we do some basic configuration that you’ll be needed and at the end i will show you one of the ways to register JBoss as a service.
1. download and prepare.
Start by download currently available version (7.0.2) of the JBoss 7.
#Web Profile version download.
Extracting files to the final location using tar.
Read more »
Here is just an example of how to install java 7 on your linux.
I use current Debian and oracle (former sun) java 7.
First i had to download the latest java from oracle site and then extract it. I have to do it because at the moment the is no official debian package for java 7.
So we are not able to do it with apt-get as we can it for java 6.
Read more »
What is your favorite Free or Open-Source UML Plug-in?
Every year i try some of them and remove them after few hours. As i remember, they where resource-hungry or just bad in reverse engineering
Some weeks ago i tried ObjectAid UML Explorer Class Diagram and liked it. It could quick and easy create simple class Diagrams – just by Drag & Drop. And i had no problems with static constructors or inner classes and other stuff in the code which causes problems to another Plug-ins.
Unfortunately Object Aid Sequence Diagram are not free but cost not much for private usage. Maybe i’ll try it soon.
But first i would ask you what is your favorite Eclipse IDE Plug-in for fast and easy (e.g. partly) revers engineered UML diagrams which can be used to show some architectural details to your colleagues?
Thank you for comments!
The pictureon the right (klick to enrange) shows how Ubunto boot process is going on my 5 years old Thinkpad T60. Bootchart utility does such charts automatically. If you interestiong how easy it it to enable such bootcharting read below.
See how to install bootchart logger on ubuntu, and other linux distributions.
Yo need bootchart and, pybootchartgui
apt-get install bootchart
apt-get install pybootchartgui
Read more »
I want to share with you some thoughts on GIT because I think that was a right invention to the right time and place.
(This article should be finished half year ago right after i wrote about svn server installation, but unfortunatelly i didn’t find any time to finish it untill now.)
My first version control system (VCS) was CVS and i used it with eclipse 2.0 for programming in java. I found CVS quite impressive and liked it a lot. It was also quite reliable and moderatelly fast.
Then someone at the university told us to use SVN, because it has “plenty” of advantages. Somehow i found SVN not bad even if the eclipse svn plugin quality was never quite good. However SVN matured and became powerful source control system and many many people and companies started using it. I think it’s the most used version control system.
I like SVN for easy branching and tagging (with good eclipse plugin support), for global version numbers, for understanding “http://” (with Web-Dav) as well as for more comfortable managing tools and easy installation and configuration.
But that’s all what i like… There is no more practical advantages over CVS and moreover there are even some disadvantages also in comparison to cvs.
- SVN is slow and double slow over HTTP. It may not be critical if you do your changes on several files and them commits ‘em. I’m doing so in my java project and it’s ok. But there could be also other scenarios e.g. if you deal with such “monsters” like magento, performance gain very fast on importance
- Folder movement is a nightmare. With the subversion you have to know what you do when you start move around your folders.
- Ugly .svn folders in the folder tree of your project. O course cvs had them too. But do we really need them? Sometimes i just wanna to copy my project tree without that stuff.
- Not closed connection (don’t know if it is an server or eclipse plugin bug). Sometimes svn commits leave not closed connection. Eclipse hangs.
- SVN consumesa lot of space, more than cvs local and on the server.
- You need to be online if you want to commit.
All of these disadvantages i mentioned above are fixed in GIT. Git is much faster, flexible. So let install it! Read more »