<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1963153121522749234</id><updated>2016-06-03T11:07:55.319-07:00</updated><category term="development"/><category term="java"/><category term="MySQL"/><category term="Database"/><category term="GrinderStone"/><category term="Eclipse"/><category term="Grinder"/><category term="Jython"/><category term="Linux"/><category term="Performance"/><category term="Performance Testing"/><category term="spring"/><category term="Ubuntu"/><category term="AOP"/><category term="AspectJ"/><category term="Eclipse Marketplace"/><category term="Google Gadget"/><category term="Hibernate"/><category term="JVM internals"/><category term="Jboss tools"/><category term="Kernel"/><category term="Management"/><category term="OpenOffice"/><category term="clear"/><category term="concurrency"/><category term="gwt"/><category term="jbpm"/><category term="locking"/><category term="more space"/><category term="race"/><category term="richfaces"/><category term="scalability"/><category term="video"/><title type='text'>Technical blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Borislav Andruschuk</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>31</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-7150398520255669976</id><published>2011-06-05T13:46:00.001-07:00</published><updated>2011-06-05T23:53:23.251-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="race"/><title type='text'>Poor man&#39;s approach in practice</title><content type='html'>One day we ran into problem when an application was randomly starting using more CPU resources as usual. It continued picking more and more CPU resources from time to time. Thread dump showed many threads though we couldn&#39;t understand wich of them is problematic...and I remembered about &lt;a href=&quot;http://poormansprofiler.org/&quot;&gt;poor man&#39;s profiler&lt;/a&gt; and its approach: the stack that&#39;s all we need to!&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Htop is awesome&lt;/b&gt;&lt;br /&gt;At first we simply caught problematic thread using &lt;a href=&quot;http://en.wikipedia.org/wiki/Htop&quot;&gt;htop&lt;/a&gt; (you just need to remember about tree process view, type &lt;b&gt;t&lt;/b&gt;-button, or anyway you need to see all forked java processes with its identifiers and CPU usage). We just obtained a java thread wich took more CPU than others. We got an identifier of native OS thread, let it be &lt;b&gt;3256&lt;/b&gt;, but what&#39;s next?&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Jstack&lt;/b&gt;&lt;br /&gt;I like &lt;a href=&quot;http://download.oracle.com/javase/1.5.0/docs/tooldocs/share/jstack.html&quot;&gt;jstack&lt;/a&gt;, it helps me all the time I deal with spontaneous problems. If you look thru the content of &lt;i&gt;jstack&lt;/i&gt; output you&#39;ll see some thread identifiers and all of them are hexadecimal. Thus we converted our native thread id into hex representation &lt;b&gt;0xcb8&lt;/b&gt;. Lazy guys can use &lt;i&gt;Integer.toHexString&lt;/i&gt; ;)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The final step&lt;/b&gt;&lt;br /&gt;We searched by our hexadecimal string in &lt;i&gt;jstack&lt;/i&gt; output (don&#39;t forget about leading zeros, therefore just search by value, i.e. &lt;b&gt;cb8&lt;/b&gt; in our case). Matched &lt;b&gt;nid&lt;/b&gt; thread attribute value (suppose stands for native id) was our problematic thread with its stack. In fact we were getting infinite loop. The problem is localized and will be fixed soon.</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/7150398520255669976/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=7150398520255669976' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/7150398520255669976'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/7150398520255669976'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2011/06/poor-mans-approach-in-practice.html' title='Poor man&#39;s approach in practice'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>1</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-6126912892042431461</id><published>2011-05-22T09:22:00.002-07:00</published><updated>2011-05-22T10:40:16.866-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database"/><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>MySQL: ON DUPLICATE KEY UPDATE breaks generated key list of extended INSERT</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: justify;&quot; trbidi=&quot;on&quot;&gt;When extended &lt;i&gt;INSERT&lt;/i&gt; (insert with several tuples in one query) is used with &lt;i&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.5/en/insert-on-duplicate.html&quot;&gt;ON DUPLICATE KEY UPDATE&lt;/a&gt;&lt;/i&gt; clause and there&#39;re unique key conflict the Connector/J&#39;s &lt;a href=&quot;http://www.docjar.com/docs/api/com/mysql/jdbc/StatementImpl.html&quot;&gt;Statement&lt;/a&gt; will return incorrect list of generated identifiers that cannot be matched with tuples from &lt;i&gt;INSERT&lt;/i&gt; query at all. There are steps to reproduce this issue:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;create a table with auto increment primary key and unique key: &lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;create table TEST_TABLE(&lt;br /&gt;        id int auto_increment, &lt;br /&gt;        test_field varchar(255), &lt;br /&gt;        primary key (id), &lt;br /&gt;        unique key(test_field)&lt;br /&gt;) engine=InnoDB;&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;insert the following row:&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;insert into TEST_TABLE(id, test_field) values(100, &#39;test1&#39;);&lt;/pre&gt;&lt;br /&gt;&lt;li&gt;perform an extended insert with &lt;i&gt;ON DUPLICATE KEY UPDATE&lt;/i&gt; clause via JDBC driver:&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;insert into TABLE(test_field) values(&#39;test2&#39;),(&#39;test1&#39;),(&#39;test3&#39;) &lt;br /&gt;on duplicate key update id=LAST_INSERT_ID(id);&lt;/pre&gt;&lt;/ol&gt;and check returned generated keys:  &lt;ul&gt;&lt;li&gt;at first, you&#39;ll get &lt;b&gt;4&lt;/b&gt; values instead of 3: [1, 2, 3, 4]&lt;br /&gt;&lt;li&gt;at second, there&#39;s &lt;b&gt;no&lt;/b&gt; correct id for &lt;i&gt;test1&lt;/i&gt; row in returned list&lt;br /&gt;&lt;/ul&gt;Thus only for the first row returned id will be correct, if &lt;i&gt;test1&lt;/i&gt; will be first in a query whole list will be incorrect and cannot be matched with inserted rows. The only workaround is to use separate query to retrive generated identifiers to reduce count of Data Base access and avoid the split of this extended insert in separate queries.  I&#39;ve looked thru the code in &lt;a href=&quot;http://www.docjar.com/docs/api/com/mysql/jdbc/StatementImpl.html&quot;&gt;com.mysql.jdbc.StatementImpl&lt;/a&gt; and found that It retrieves count of affected rows and just &lt;u&gt;increments&lt;/u&gt; the value of &lt;i&gt;LAST_INSERT_ID&lt;/i&gt; for each update and gets sequential list of identifiers. But in fact it can be nonsequential: for my case I expect the result set: [1, 100, 3] &lt;-- 3 is here because of the 2nd value, or even [1, NULL, 3] will be normal. But current result: [1, 2, 3, 4] is very confused and cannot be matched with inserted rows.&lt;br /&gt;&lt;br /&gt;In fact MySql returns unexpected count of updated rows in such case because of this &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.5/en/mysql-affected-rows.html&quot;&gt;behavior&lt;/a&gt;:  &lt;blockquote&gt;For INSERT ... ON DUPLICATE KEY UPDATE statements, the affected-rows value is 1 if the row is inserted as a new row and 2 if an existing row is updated.&lt;/blockquote&gt;I&#39;ve reported new &lt;a href=&quot;http://bugs.mysql.com/bug.php?id=61213&quot;&gt;#61213&lt;/a&gt; issue for MySQL Connector/J and according to &lt;a href=&quot;http://bugs.mysql.com/bug.php?id=61213#c363848&quot;&gt;Mark Matthews&lt;/a&gt; the fix raises a modification in MySQL server protocol because there&#39;s currently no way to get generated keys for whole data set though &lt;i&gt;LAST_INSERT_ID&lt;/i&gt; returns only the first one. Thus be aware of this issue.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/6126912892042431461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=6126912892042431461' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6126912892042431461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6126912892042431461'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2011/05/mysql-on-duplicate-key-update-breaks.html' title='MySQL: ON DUPLICATE KEY UPDATE breaks generated key list of extended INSERT'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>2</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-8383582495437483127</id><published>2011-04-30T11:49:00.002-07:00</published><updated>2011-04-30T12:01:59.100-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="concurrency"/><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="JVM internals"/><category scheme="http://www.blogger.com/atom/ns#" term="locking"/><title type='text'>How does JVM handle locks</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As we are talking about the latest version of Sun Hotspot Java Virtual Machine 1.6 there&#39;re the following three types of locks performed by JVM when you try to acquire lock from &lt;i&gt;java.util.concurrent.locks.Lock&lt;/i&gt; implementation or enter synchronized block:&lt;/div&gt;&lt;ul&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;biased&lt;/b&gt;: sometimes even in concurrent systems there&#39;s no contention and JVM shouldn&#39;t borrow mutex from OS for perform locking in this case. Hotspot can operate with its own internal data structures to simulate locking in more effective way. For example, if synchronized part of code is &lt;i&gt;not&lt;/i&gt; executed concurrently in real time, JVM assigns an owner thread id to an object used as mutex in your Java code using CAS operation and additionally stores the reentrancy count if CAS is passed. It is &lt;i&gt;biased lock&lt;/i&gt; - the &#39;lightest&#39; type of locks done by JVM. Reentrancy count will be updated by lock owner thread just as usual local variable without CAS. If CAS fails it means another thread already gets this lock and in this case JVM &lt;i&gt;stops&lt;/i&gt; the mutex owner thread, &lt;i&gt;flushes&lt;/i&gt; thread context into the main memory and checks the reentrancy count. If it&#39;s 0 JVM escalates lock to &lt;i&gt;thin&lt;/i&gt; type otherwise to &lt;i&gt;fat&lt;/i&gt; (I assume the main purpose is the wait time, it should be very small if lock is thin). &lt;i&gt;Note&lt;/i&gt; Hotspot uses the same field for storing owner thread id in mutex object as for caching identity hash code. Thus if you retrieve identity hash code on you mutex once then it will be unavailable for biased locking even it was already used as biased. More info about biased locks is described in David Dice&#39;s &lt;a href=&quot;http://blogs.sun.com/dave/entry/biased_locking_in_hotspot&quot; target=&quot;_blank&quot;&gt;blog&lt;/a&gt;.&lt;br /&gt;&lt;/li&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;thin&lt;/b&gt;: it&#39;s a simple &lt;a href=&quot;http://en.wikipedia.org/wiki/Spinlock&quot; target=&quot;_blank&quot;&gt;spin&lt;/a&gt; lock. It helps to save time for thread context switching when time for spinning is quite small. When one thread tries to acquire an occupied mutex it spins some time until the lock will be freed. The count of spins is based on internal JVM resolution and may depend from different factors: statistics gathered by JVM about your application, count of used threads, CPU and so forth. JVM determines when thin lock becomes inefficient and escalates it to &lt;i&gt;fat&lt;/i&gt; lock.&lt;br /&gt;&lt;/li&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;fat&lt;/b&gt;: the &#39;strongest&#39; type of lock when JVM requests for an OS mutex and uses OS scheduler engine for threads parkings and wake ups. It is much costly than previous types because in this case JVM should directly interact with OS every time when thread acquires and frees the lock.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/8383582495437483127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=8383582495437483127' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/8383582495437483127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/8383582495437483127'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2011/04/how-does-jvm-handle-locks.html' title='How does JVM handle locks'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>3</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-3240405438490038977</id><published>2011-02-02T14:43:00.000-08:00</published><updated>2011-02-02T14:43:26.365-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="GrinderStone"/><title type='text'>The GrinderStone is nominated for Eclipse Community Awards</title><content type='html'>&lt;div style=&quot;clear:left; float:left;margin-right:1em; margin-bottom:1em&quot;&gt;&lt;img border=&quot;0&quot; style=&quot;border:none;&quot; src=&quot;http://www.eclipse.org/org/foundation/eclipseawards/images/EclipseAwardsLogo.png&quot; /&gt;&lt;/div&gt;&lt;br /&gt;The &lt;a href=&quot;http://code.google.com/p/grinderstone/&quot;&gt;GrinderStone&lt;/a&gt;, an IDE for &lt;a href=&quot;http://grinder.sourceforge.net/&quot;&gt;Grinder&lt;/a&gt; load testing scripts development, is nominated for &lt;a href=&quot;http://www.eclipse.org/org/foundation/eclipseawards/index.php&quot;&gt;Eclipse Community Awards 2011&lt;/a&gt; in &lt;a href=&quot;http://marketplace.eclipse.org/nominations/best-developer-tool&quot;&gt;Best Developer Tool&lt;/a&gt; section. Any comments will be appreciated on GrinderStone &lt;a href=&quot;http://marketplace.eclipse.org/nominations/product/grinderstone&quot;&gt;nominee page&lt;/a&gt;. We thank our users and give them unique Grinder scripts development features based on Eclipse platform.</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/3240405438490038977/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=3240405438490038977' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/3240405438490038977'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/3240405438490038977'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2011/02/grinderstone-is-nominated-for-eclipse.html' title='The GrinderStone is nominated for Eclipse Community Awards'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-5981992380883564361</id><published>2011-01-25T11:14:00.001-08:00</published><updated>2011-01-25T11:18:18.879-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>MySQL 5.5 won&#39;t start on Mac OS 10.6</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Modify the mysql.server script file using the following command : &lt;br /&gt;&lt;pre&gt;sudo /Applications/TextEdit.app/Contents/MacOS/TextEdit /usr/local/mysql/support-files/mysql.server &lt;br /&gt;&lt;/pre&gt;Locate the configuration defining the basedir and set the following : &lt;br /&gt;&lt;pre&gt;basedir=/usr/local/mysql &lt;br /&gt;datadir=/usr/local/mysql/data &lt;br /&gt;&lt;/pre&gt;Save the file and start the mysql server in the system preferences or terminal.&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: xx-small;&quot;&gt;from &lt;a href=&quot;http://forums.mysql.com/read.php?11,399397,399606#msg-399606&quot;&gt;MySQL Developer Zone&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/5981992380883564361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=5981992380883564361' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5981992380883564361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5981992380883564361'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2011/01/mysql-55-wont-start-on-mac-os-106.html' title='MySQL 5.5 won&#39;t start on Mac OS 10.6'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-5503158417007782194</id><published>2010-11-07T13:18:00.004-08:00</published><updated>2011-05-01T01:44:47.378-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database"/><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>InnoDB: strange deadlock</title><content type='html'>One time I&#39;ve noticed that some concurrent threads that perform inserts into one simple table can cause deadlock in MySQL. I don&#39;t have auto increment primary key in a table and generate id on application level. So let concurrent inserts are performed into this table in separate transactions with default isolation level (repeatable-read): &lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;insert into TEST values(...);&lt;br /&gt;insert into TEST values(...);&lt;br /&gt;insert into TEST values(...);&lt;br /&gt;.....&lt;/pre&gt;&lt;br /&gt;I got deadlock! Why?! As I understand according to &lt;a href=&quot;http://forums.mysql.com/read.php?22,386646,386646&quot;&gt;this discussion&lt;/a&gt; if two different concurrent inserts try to lock the same gap at the end of a table at the same time (i.e. concurrently set X lock) we will get deadlock (I think it should be livelock but not deadlock...it&#39;s a bit strange). In a case if primary key is auto increment we will have lock by auto_inc index and all inserts will wait for granting lock - so no deadlock here can happen, only livelock and InnoDB successfully handles this case.&lt;br /&gt;&lt;br /&gt;I think InnoDB should lock the primary key index during insert in a case if it is not auto increment. &lt;s&gt;I think there&#39;s a problem with locks granularity in InnoDB - I&#39;ll try to research this problem and submit it to Oracle.&lt;/s&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;UPDATE&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;One guy &lt;a href=&quot;http://thushw.blogspot.com/2010/11/mysql-deadlocks-with-concurrent-inserts.html&quot;&gt;told&lt;/a&gt; me the reason of this deadlock. It was the reason in inserts performed from separate threads that became not ordered and InnoDB locked some necessary gaps in indexes - I missed that I had an index in a table - for record insertions (some threads, some monitors, not ordered actions...potential deadlock...it&#39;s classic). See detailed explanation &lt;a href=&quot;http://thushw.blogspot.com/2010/11/mysql-deadlocks-with-concurrent-inserts.html&quot;&gt;here&lt;/a&gt;. Thus I was wrong when told you that InnoDB has a problem with locks granularity...</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/5503158417007782194/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=5503158417007782194' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5503158417007782194'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5503158417007782194'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/11/innodb-strange-deadlock.html' title='InnoDB: strange deadlock'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-7515038144567646295</id><published>2010-10-18T14:00:00.002-07:00</published><updated>2011-05-01T02:38:09.759-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="jbpm"/><title type='text'>JBPM concurrency issue: Action altered id</title><content type='html'>I&#39;ve been working for several days on problem when some concurrent threads create process instances from one process definition. In my environment I deploy one process definition on application startup and use this instance during whole application lifecycle. It means that this instance becomes detached and is used in all JBPM related places. The error was:&lt;br /&gt;&lt;br /&gt;org.hibernate.HibernateException: identifier of an instance of org.jbpm.graph.def.Action was altered from 532 to 533&lt;br /&gt;&lt;br /&gt;After data base dumps analysis I&#39;ve obtained a problematic place. It was in jobs processing (or in other definitions - timers) persistence. JBPM performs manual cascade persistence of Action from ProcessDefinition called by this timer. The following code snippet from &lt;i&gt;org.jbpm.db.JobSession&lt;/i&gt; is problematic:&lt;br /&gt;&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: java&quot;&gt;public void saveJob(Job job) {&lt;br /&gt;    session.saveOrUpdate(job);&lt;br /&gt;&lt;br /&gt;    if (job instanceof Timer) {&lt;br /&gt;        Timer timer = (Timer) job;&lt;br /&gt;        Action action = timer.getAction();&lt;br /&gt;&lt;br /&gt;        if (action != null &amp;&amp; !session.contains(action)) {&lt;br /&gt;            session.save(action);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;As process definition is detached - linked Action also is detached so Session will always persist Action as new instance (note: they call save and not merge). I don&#39;t know why JBMP do that because we cannot create timer without process instance and we cannot create process instance without fully persisted process definition (may be process definition can be changed on the fly? don&#39;t think that it&#39;s correct behavior). I created &lt;a href=&quot;https://jira.jboss.org/browse/JBPM-2950&quot;&gt;JBPM-2950&lt;/a&gt; but hadn&#39;t got any response. The same with &lt;a href=&quot;http://opensource.atlassian.com/projects/hibernate/browse/HHH-4309&quot;&gt;HHH-4309&lt;/a&gt; - we created it more than one year ago but anyone responded. I don&#39;t know why these problems stay ranked as Major and Critical - may be JBoss doesn&#39;t wanna see them? Comparing this approach with Spring Issue tracking where I always get a responses in a few days or even hours.&lt;br /&gt;&lt;br /&gt;In any case I would like to share the patch fixing this problem.&lt;br /&gt;At first we should correct check Action existence in Persistence Context: I replaced it with id nullabillity check, because when Action is persisted and Session is flushed we will get non zero id and we don&#39;t need to update this Action because we don&#39;t change it.&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;public class JbpmJobSession&lt;br /&gt;    extends JobSession {&lt;br /&gt;&lt;br /&gt;    private Session session;&lt;br /&gt;&lt;br /&gt;    public JbpmJobSession(Session session) {&lt;br /&gt;        super(session);&lt;br /&gt;        this.session = session;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public void saveJob(Job job) {&lt;br /&gt;        session.saveOrUpdate(job);&lt;br /&gt;&lt;br /&gt;        if (job instanceof Timer) {&lt;br /&gt;            Timer timer = (Timer) job;&lt;br /&gt;            Action action = timer.getAction();&lt;br /&gt;&lt;br /&gt;            // action already persisted? &lt;br /&gt;            if ((action != null) &amp;&amp; (action.getId() == 0L)) {&lt;br /&gt;                session.save(action);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Then we should correct JBPM DB persistence service to allow saving jobs via our modified session:&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: java&quot;&gt;public class JbpmDbPersistenceService&lt;br /&gt;    extends DbPersistenceService {&lt;br /&gt;&lt;br /&gt;    public JbpmDbPersistenceService(&lt;br /&gt;           DbPersistenceServiceFactory persistenceServiceFactory) {&lt;br /&gt;        super(persistenceServiceFactory);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public JobSession getJobSession() {&lt;br /&gt;&lt;br /&gt;        if (jobSession == null) {&lt;br /&gt;            Session session = getSession();&lt;br /&gt;&lt;br /&gt;            if (session != null) {&lt;br /&gt;                jobSession = new JbpmJobSession(session);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        return jobSession;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Then create corresponding factory:&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: java&quot;&gt;public class JbpmPersistenceServiceFactory&lt;br /&gt;    extends DbPersistenceServiceFactory {&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public Service openService() {&lt;br /&gt;        return new JbpmDbPersistenceService(this);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;And one step to finish: modify persistence service to yours in jbpm.cfg.xml&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;brush: java&quot;&gt;&lt;jbpm-configuration&gt;&lt;br /&gt;    .....&lt;br /&gt;    &lt;jbpm-context&gt;&lt;br /&gt;        &lt;service name=&quot;persistence&quot; factory=&#39;JbpmPersistenceServiceFactory&#39; /&gt;&lt;br /&gt;        ....&lt;br /&gt;    &lt;/jbpm-context&gt;&lt;br /&gt;    ....&lt;br /&gt;&lt;/jbpm-configuration&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;That&#39;s it.</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/7515038144567646295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=7515038144567646295' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/7515038144567646295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/7515038144567646295'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/10/jbpm-concurrency-issue-action-altered.html' title='JBPM concurrency issue: Action altered id'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-5194563115859651262</id><published>2010-10-09T13:35:00.003-07:00</published><updated>2011-05-01T02:28:06.782-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>Fibonacci numbers built with SQL</title><content type='html'>I&#39;ve been at work today and my friend Eugene has told me that he read somewhere about one guy who calculated &lt;a href=&quot;http://en.wikipedia.org/wiki/Fibonacci_number&quot;&gt;Fibonacci numbers&lt;/a&gt; using SQL. He asked me to do the same... and after 5-10 minutes I&#39;ve got the following query:&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;select N from (&lt;br /&gt;       select @f0 N, @fn:=@f1+@f0, @f0:=@f1, @f1:=@fn &lt;br /&gt;       from   (select @f0:=0, @f1:=1, @fn:=1) x, &lt;br /&gt;       information_schema.COLUMNS p limit 10) y; &lt;br /&gt;&lt;/pre&gt;The result is:&lt;br /&gt;&lt;div align=&quot;center&quot;&gt;|    0 |&lt;br /&gt;|    1 |&lt;br /&gt;|    1 |&lt;br /&gt;|    2 |&lt;br /&gt;|    3 |&lt;br /&gt;|    5 |&lt;br /&gt;|    8 |&lt;br /&gt;|   13 |&lt;br /&gt;|   21 |&lt;br /&gt;|   34 |&lt;/div&gt;The length of sequence can be adjusted with the limit clause.&lt;br /&gt;Or the same more friendly result in one line is:&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;select concat(group_concat(N),&#39;,...&#39;) from (&lt;br /&gt;       select @f0 N, @fn:=@f1+@f0, @f0:=@f1, @f1:=@fn &lt;br /&gt;       from   (select @f0:=0, @f1:=1, @fn:=1) x, &lt;br /&gt;       information_schema.COLUMNS p limit 10) y; &lt;br /&gt;&lt;/pre&gt;Than you should see:&lt;br /&gt;&lt;div align=&quot;center&quot;&gt;| 0,1,1,2,3,5,8,13,21,34,...     |&lt;/div&gt;Instead of &lt;i&gt;&lt;b&gt;information_schema.COLUMNS&lt;/b&gt;&lt;/i&gt; table any table with many rows can be used.</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/5194563115859651262/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=5194563115859651262' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5194563115859651262'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5194563115859651262'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/10/fibonacci-numbers-built-with-sql.html' title='Fibonacci numbers built with SQL'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-3358134409197156067</id><published>2010-09-26T06:21:00.001-07:00</published><updated>2011-05-01T02:39:56.280-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="Grinder"/><category scheme="http://www.blogger.com/atom/ns#" term="Performance Testing"/><title type='text'>GrinderStone 2.5.3</title><content type='html'>I&#39;ve released new GrinderStone 2.5.3 version. It has come with the following features:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;redirect for all Grinder outputs to Eclipse terminal (feature &lt;a href=&quot;http://code.google.com/p/grinderstone/issues/detail?id=9&quot;&gt;#9&lt;/a&gt;)&lt;br /&gt;&lt;/li&gt;&lt;li&gt;compatibility with latest version of PyDev (issue &lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=1963153121522749234#26 http://code.google.com/p/grinderstone/issues/detail?id=26&quot;&gt;#26&lt;/a&gt;) &lt;br /&gt;&lt;/li&gt;&lt;li&gt;ability to debug Grinder scripts using nano time calculation (issue &lt;a href=&quot;http://www.blogger.com/post-create.g?blogID=1963153121522749234#27 http://code.google.com/p/grinderstone/issues/detail?id=27&quot;&gt;#27&lt;/a&gt;) &lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;As usual release can be downloaded from official &lt;a href=&quot;http://code.google.com/p/grinderstone&quot;&gt;project site&lt;/a&gt; or using &lt;a href=&quot;http://grinderstone.googlecode.com/svn/update/site.xml&quot;&gt;Eclipse Update&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/3358134409197156067/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=3358134409197156067' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/3358134409197156067'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/3358134409197156067'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/09/grinderstone-253.html' title='GrinderStone 2.5.3'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-7562808206052008433</id><published>2010-09-13T15:23:00.002-07:00</published><updated>2011-05-01T02:54:29.255-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="scalability"/><title type='text'>Transparent clustering solutions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;I&#39;ve spent these weekends to research and compare two transparent clustering solutions: &lt;a href=&quot;http://terracotta.org/&quot;&gt;Terracotta&lt;/a&gt; and &lt;a href=&quot;http://www.hazelcast.com/&quot;&gt;Hazelcast&lt;/a&gt;. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;As a result I would choose Terracotta, a proven solution for clustering second-level cache, http sessions and distributed locks, but the Hazelcast solution seems pretty fresh, interesting and more explicit than Terracotta. &lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;I always choose explicit solutions comparing with implicit during software architecting. It simplifies understanding and source code support, reduces the number of problems and as a result increases application stability. The main arguments in support of Terracotta I would pick:&lt;/div&gt;&lt;ol&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;data consistency&lt;/i&gt;&lt;/b&gt;: Terracotta is a client-server solution which ensures the safety backups and the actual state (compatibility) of all cluster nodes. In Hazelcast (it&#39;s solution without master server) all nodes are equivalent excepting super client. If both nodes will fail at the same moment, then status of the various nodes in the cluster will be inconsistent, because each node keeps a backup for only one its neighbor. It is configured and the maximum number of backups is 3 but anyway it doesn&#39;t guarantee that we won&#39;t get the situation when three adjacent nodes will fail at the same time. Thus it can lead to stale data on different nodes in a cluster&lt;/li&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;network latency&lt;/i&gt;&lt;/b&gt;: network load in case of Terracotta is less than during Hazelcast usage, because it sends only the changed data (delta), in Hazelcast full object tree is serialized and is sent to necessary node(s)&lt;/li&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;real world clustering solutions&lt;/i&gt;&lt;/b&gt;: as already mentioned above, ready-made solution for clustering http sessions (although this is done by Hazelcast, but there&#39;s no session state visualization) and second-level cache (&lt;a href=&quot;http://ehcache.org/&quot;&gt;Ehcache&lt;/a&gt;)&lt;br /&gt;&lt;/li&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;persistent data&lt;/i&gt;&lt;/b&gt;: Terracotta storage engine doesn&#39;t need any further elaboration if we need to store persistent data, in Hazelcast we have to develop our own storage (for example providing the MapStore implementation)&lt;/li&gt;&lt;/ol&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;The minuses I can evolve (somebody can discuss about these points, but for me they are more negative than positive):&lt;/div&gt;&lt;ol&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;implicit solution&lt;/i&gt;&lt;/b&gt;: Terracotta lets you do application clustering implicitly for an application itself (though this point is less neutralized by the fact of annotations existence that allows you to do this declaratively)&lt;/li&gt;&lt;li style=&quot;text-align: justify;&quot;&gt;&lt;b&gt;&lt;i&gt;instrumentation&lt;/i&gt;&lt;/b&gt;: bytecode instrumentation already ensures that the application won&#39;t work as written in the source code, another implicit element of the Terracotta solution implementation. Thus sometimes you have to write your code that already assumes that it will be instrumented and used by Terracotta&lt;/li&gt;&lt;/ol&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/7562808206052008433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=7562808206052008433' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/7562808206052008433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/7562808206052008433'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/09/transparent-clustering-solutions.html' title='Transparent clustering solutions'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>3</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-3659885731578521386</id><published>2010-09-04T14:03:00.003-07:00</published><updated>2011-05-01T02:41:49.178-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><title type='text'>The best development strategy</title><content type='html'>&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;When I met my old friend in Nederlands&amp;nbsp;he sad me that in the company he was working for they follow one general rule:&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;i&gt;Perform many small changes because they cause small problems instead of big changes that in any case cause big problems&lt;/i&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style=&quot;margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;&quot;&gt;I think it&#39;s the best strategy of software development.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/3659885731578521386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=3659885731578521386' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/3659885731578521386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/3659885731578521386'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/09/best-development-strategy.html' title='The best development strategy'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-274435413423222296</id><published>2010-08-15T11:41:00.002-07:00</published><updated>2011-05-01T10:51:09.952-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Spring: case when mix of plain JDBC and Hibernate JPA will fail</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I suppose it&#39;s a new problem in Spring connection management related to all 3.X versions:&lt;br /&gt;when you executes query in RowMapper the next query outside of this RowMapper will fail with HibernateException.&lt;br /&gt;&lt;br /&gt;I&#39;ve created &lt;a href=&quot;https://jira.springsource.org/browse/SPR-7393&quot;&gt;SPR-7393&lt;/a&gt;&amp;nbsp;related to this issue and it successfully fixed now.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/274435413423222296/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=274435413423222296' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/274435413423222296'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/274435413423222296'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/08/spring-case-when-mix-of-plain-jdbc-and.html' title='Spring: case when mix of plain JDBC and Hibernate JPA will fail'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-1559646237200733865</id><published>2010-07-19T11:12:00.001-07:00</published><updated>2011-05-01T03:00:36.506-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Performance"/><title type='text'>MySQL batch queries processing</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;I was very surprised when we&#39;ve got an issue with batch queries execution via MySQL JDBC driver: in our project we have to save big chunk of data to one table - approximately 1.5K records as one batch. It takes more than 1 minute - 86320ms - for loaded server! And...&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;The reason is that MySQL does not support batches!&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Enabling profiling in mysql session I&#39;ve seen that &lt;i&gt;freeing items&lt;/i&gt; operation (in a case of INSERT statement it means table cache flush) takes ~0.12sec for each row so if you multiply this time on count of records you&#39;ll get my 86seconds. Instead of batches MySQL supports extended INSERT statement (multiple rows insertion in one query). In a case of extended INSERT table cache is flushed at once for all 1.5k rows instead of flushing rows one by one. It is equivalent of batch but you have to:&lt;/div&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;1st way&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;rewrite query to look like&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);&lt;br /&gt;&lt;/pre&gt;see &lt;a href=&quot;http://dev.mysql.com/doc/refman/5.1/en/insert.html&quot;&gt;MySQL INSERT syntax&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;i&gt;2nd way&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;enable rewritable batch statements in ConnectorJ MySQL JDBC driver specifying &lt;b&gt;rewriteBatchedStatements=true&lt;/b&gt; in connection URL. In this case driver will parse sql statement and rewrite it as extended INSERT.&lt;br /&gt;&lt;br /&gt;We&#39;ve chosen 1st way to avoid performance degradation on SQL modification in driver and rewrited query takes 128ms now (instead of 86320ms).&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;...MySQL is a database just like no other.&lt;/b&gt;&lt;/i&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/1559646237200733865/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=1559646237200733865' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/1559646237200733865'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/1559646237200733865'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/07/mysql-batch-queries-processing.html' title='MySQL batch queries processing'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-6186526133253625970</id><published>2010-07-06T13:50:00.000-07:00</published><updated>2010-07-06T13:50:35.815-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="OpenOffice"/><title type='text'>OpenOffice: Concatenate cells with separator</title><content type='html'>In OO you cannot concatenate even range of cells so I&#39;ve obtained solution, at first go to menu:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Tools &amp;gt; Macros &amp;gt; Organize &amp;gt; Basic... Container:&#39;MyMacros&#39;, Library:&#39;Standard&#39;&lt;/li&gt;&lt;li&gt;create new module&lt;/li&gt;&lt;li&gt;create new Macros with the following body:&lt;/li&gt;&lt;/ul&gt;&lt;pre&gt;Function VVJOIN(v(), optional sep)&lt;br /&gt;REM join a *v*ertical *v*vector with optional separator (default &quot;&quot;)&lt;br /&gt;REM use with TRANSPOSE for horizontal vectors&lt;br /&gt;On Error Goto NullErr&lt;br /&gt;   If isMissing(sep) then sep = &quot;&quot;&lt;br /&gt;   iLB = lBound(v(), 1)&lt;br /&gt;   iUB = uBound(v(), 1)&lt;br /&gt;REM convert from 2D array to flat array:&lt;br /&gt;   Dim a(iLB to iUB)&lt;br /&gt;   For i = iLB to iUB&lt;br /&gt;      a(i) = v(i, 1)&lt;br /&gt;   next&lt;br /&gt;   VVJOIN = join(a(), sep)&lt;br /&gt;exit function&lt;br /&gt;NullErr:&lt;br /&gt;REM return #VALUE&lt;br /&gt;   VVJOIN = Null&lt;br /&gt;End Function&lt;/pre&gt;&lt;br /&gt;&lt;i&gt;Examples:&lt;/i&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;=VVJOIN(A1:A9) - concatenates vertical vector&lt;/li&gt;&lt;li&gt;=VVJOIN(TRANSPOSE(A1:G1)) - concatenates horizontal vector&lt;/li&gt;&lt;li&gt;=VVJOIN(A1:A9;&quot;, &quot;) - concatenates vertical vector with separator&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;got it info from &lt;/span&gt;&lt;a href=&quot;http://user.services.openoffice.org/en/forum/viewtopic.php?f=9&amp;amp;t=5438&amp;amp;start=0&quot;&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-size: x-small;&quot;&gt;OO Community Forum&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/6186526133253625970/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=6186526133253625970' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6186526133253625970'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6186526133253625970'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/07/openoffice-concatenate-cells-with.html' title='OpenOffice: Concatenate cells with separator'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>1</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-9201378729629024950</id><published>2010-06-28T12:19:00.000-07:00</published><updated>2010-06-28T12:19:44.713-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="Management"/><title type='text'>Leadership in self-organization team</title><content type='html'>Completely agree with Michael:&lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;I don&#39;t believe in self-organization without leadership. It is a myth.&lt;br /&gt;&lt;br /&gt;Michael Dubakov, CEO Target Process, from his &lt;a href=&quot;http://twitter.com/mdubakov/status/17078385064&quot;&gt;Twitter&lt;/a&gt;&lt;/i&gt;&lt;/blockquote&gt;any process cannot head people in the right direction (development, requirement&amp;nbsp;analysis, management etc.)&lt;br /&gt;&lt;blockquote&gt;&lt;i&gt;The Self-Organizing Team is a myth because it communicates an absolute.  What is more real is an appropriate level of direction coupled with suitable delegation and trust.  In order to make our project teams effective, I must provide guidance and a behavioral framework for the team to operate in.  Within these somewhat strict guidelines, all other decisions are delegated, and I trust them to make the right choices.  This balance between directing and delegating has proved to be the appropriate balance between self-organization and dictated-organization.  The team members are very happy as well because they are pushed in the direction of success.&lt;br /&gt;&lt;br /&gt;Jeffrey Palermo, CTO Headspring Systems, from his &lt;a href=&quot;http://jeffreypalermo.com/blog/the-myth-of-self-organizing-teams/&quot;&gt;blog&lt;/a&gt;&lt;/i&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/9201378729629024950/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=9201378729629024950' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/9201378729629024950'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/9201378729629024950'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/06/leadership-in-self-organization-team.html' title='Leadership in self-organization team'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-6082554500991087582</id><published>2010-06-27T12:44:00.000-07:00</published><updated>2010-06-27T12:44:30.204-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><title type='text'>Estimations vs Support expenses</title><content type='html'>According to&amp;nbsp;&lt;b&gt;&lt;a href=&quot;http://www.amazon.com/AntiPatterns-Refactoring-Software-Architectures-Projects/dp/0471197130&quot;&gt;AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis&lt;/a&gt;&lt;/b&gt;:&lt;blockquote&gt;&lt;i&gt;approximately 70% of cost of software is a&amp;nbsp;time of&amp;nbsp;delivery and&amp;nbsp;support&lt;/i&gt;&lt;/blockquote&gt;&lt;div&gt;Think about it when you give your estimations to produce more qualitative solutions.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/6082554500991087582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=6082554500991087582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6082554500991087582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6082554500991087582'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/06/estimations-vs-support-expenses.html' title='Estimations vs Support expenses'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-1610901733081709188</id><published>2010-06-26T05:44:00.004-07:00</published><updated>2011-05-01T11:06:38.483-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Performance"/><title type='text'>Replace subselect queries with constants in Hibernate</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Let&#39;s see the case of parent and child entities (one to many association) using Hibernate&lt;/div&gt;&lt;br /&gt;&lt;b&gt;PARENT_TABLE (ID,...)&lt;/b&gt;&lt;br /&gt;&lt;b&gt;CHILDREN_TABLE (PARENT_ID,...)&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;For example we want to load parent and children using eager load fetch type and of course in this case we have to use subselect strategy to avoid duplicates of parent entities in result list (because join strategy is used by default).&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;When you try to load list of parents Hibernate will load parent entities using filter condition&lt;/div&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;SELECT ID from PARENT_TABLE WHERE ...filter condition...&lt;br /&gt;&lt;/pre&gt;and then it will do the following ugly subselect for children:&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;SELECT * FROM CHILDREN_TABLE where PARENT_ID in (&lt;br /&gt;       SELECT ID from PARENT_TABLE WHERE ...filter condition...&lt;br /&gt;)&lt;br /&gt;&lt;/pre&gt;instead of using in clause with constants keys for parent entities (it already loaded parents and know its ids):&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;SELECT * FROM CHILDREN_TABLE where PARENT_ID in (&lt;br /&gt;...constants got from query to PARENT_TABLE, i.e.: 1,2,3,4,5...&lt;br /&gt;)&lt;br /&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;Looking back to one of my previous &lt;a href=&quot;http://slava-technical.blogspot.com/2010/06/mysql-indexes-on-subqueries.html&quot;&gt;posts about MySQL indexes&lt;/a&gt; the query with subselect will be very slow and inefficient because MySQL iterates over the whole table! We got that equivalent queries were running more than 60 sec in production! I suppose any Data Base will process queries with IN clause with constants much more faster than query with subselect, so I don&#39;t know why this feature is turned off by default in Hibernate.&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;To replace this subselect with PARENT_ID constants from previous query to parent table you should change fetch mode from &lt;i&gt;SUBSELECT&lt;/i&gt; to &lt;i&gt;&lt;b&gt;SELECT&lt;/b&gt;&lt;/i&gt; (in a case of eager fetch type) and add &lt;i&gt;&lt;b&gt;batch size&lt;/b&gt;&lt;/i&gt; (we set it to 100). Otherwise you can setup batch size for all entities at once in SessionFactory (or EntityManagerFactory, i.e. to whole Persistence Unit) using &lt;i&gt;&lt;b&gt;hibernate.default_batch_fetch_size&lt;/b&gt;&lt;/i&gt; property.&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/1610901733081709188/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=1610901733081709188' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/1610901733081709188'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/1610901733081709188'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/06/replace-subselect-queries-with.html' title='Replace subselect queries with constants in Hibernate'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-8211286636898007709</id><published>2010-06-23T14:02:00.001-07:00</published><updated>2010-06-23T14:02:50.244-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Database"/><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><title type='text'>MySQL table size query</title><content type='html'>The following query calculates table size in currently used database:&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;SELECT table_schema,&lt;br /&gt;       table_name,&lt;br /&gt;       ROUND(data_length / 1024 / 1024,2) total_size_mb&lt;br /&gt;FROM   information_schema.tables&lt;br /&gt;WHERE  table_schema = database()&lt;br /&gt;&lt;/pre&gt;&lt;div class=&quot;zemanta-pixie&quot; style=&quot;height: 15px; margin-top: 10px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;zemanta-pixie-img&quot; src=&quot;http://img.zemanta.com/pixy.gif?x-id=fd2cf38a-872d-4b92-85d5-f0b2e2a0e701&quot; style=&quot;border: none; float: right;&quot; /&gt;&lt;span class=&quot;zem-script more-related pretty-attribution&quot;&gt;&lt;script defer=&quot;defer&quot; src=&quot;http://static.zemanta.com/readside/loader.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/8211286636898007709/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=8211286636898007709' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/8211286636898007709'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/8211286636898007709'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/06/mysql-table-size-query.html' title='MySQL table size query'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-5913841384336537447</id><published>2010-06-17T12:53:00.003-07:00</published><updated>2011-05-01T11:13:05.578-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="MySQL"/><category scheme="http://www.blogger.com/atom/ns#" term="Performance"/><title type='text'>MySQL indexes on subqueries</title><content type='html'>I was surprised when I got a problem that MySQL doesn&#39;t honor indexes when subquery used in &lt;b&gt;IN&lt;/b&gt; clause! Problematic query was:&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;SELECT A, B FROM TABLE_1 WHERE A IN (SELECT A FROM TABLE_2)&lt;br /&gt;&lt;/pre&gt;If &lt;b&gt;TABLE_1&lt;/b&gt; has index on &lt;b&gt;A&lt;/b&gt; then it won&#39;t be used by outer query. Problem is caused by missed subquery optimization in MySQL 5.x, outer query won&#39;t use indexes if subquery is used:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://bugs.mysql.com/bug.php?id=9021&quot;&gt;http://bugs.mysql.com/bug.php?id=9021&lt;/a&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://bugs.mysql.com/bug.php?id=18826&quot;&gt;http://bugs.mysql.com/bug.php?id=18826&lt;/a&gt;&lt;br /&gt;&lt;li&gt;&lt;a href=&quot;http://bugs.mysql.com/bug.php?id=9090&quot;&gt;http://bugs.mysql.com/bug.php?id=9090&lt;/a&gt;&lt;br /&gt;&lt;/ul&gt;&lt;div&gt;Thus there are two ways to fix indices issue:  1. use &lt;b&gt;&lt;a class=&quot;zem_slink&quot; href=&quot;http://en.wikipedia.org/wiki/Join_%28SQL%29&quot; rel=&quot;wikipedia nofollow&quot; title=&quot;Join (SQL)&quot;&gt;JOIN&lt;/a&gt;&lt;/b&gt; instead of subselect where it&#39;s possible, i.e.&lt;/div&gt;&lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;SELECT A, B FROM TABLE_1 t1 INNER JOIN TABLE_2 t2 ON t1.A=t2.A&lt;br /&gt;&lt;/pre&gt;2. use &lt;b&gt;EXISTS&lt;/b&gt; for subqueries, i.e. &lt;pre class=&quot;brush: sql&quot; name=&quot;code&quot;&gt;SELECT A, B FROM TABLE_1 t1 WHERE EXISTS &lt;br /&gt;(SELECT 1 FROM TABLE_2 t2 &amp;nbsp;WHERE t1.A=t2.A)&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;In both approaches we force to use index on &lt;b&gt;A&lt;/b&gt; from &lt;b&gt;TABLE_1&lt;/b&gt;. These described features are really performed tweaks and they work well in production for us.&lt;/div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Article from MySQL Reference Manual about &lt;b&gt;IN&lt;/b&gt; subqueries optimization&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.1/en/in-subquery-optimization.html&quot;&gt;http://dev.mysql.com/doc/refman/5.1/en/in-subquery-optimization.html&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div&gt;Problems with subqueries are fixed only in 6.0&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://forge.mysql.com/wiki/6.0_Subquery_Optimization_Cheatsheet&quot;&gt;http://forge.mysql.com/wiki/6.0_Subquery_Optimization_Cheatsheet&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div class=&quot;zemanta-pixie&quot; style=&quot;height: 15px; margin-top: 10px;&quot;&gt;&lt;img alt=&quot;&quot; class=&quot;zemanta-pixie-img&quot; src=&quot;http://img.zemanta.com/pixy.gif?x-id=50c91710-be10-4c39-92b7-d7525f4ce6fe&quot; style=&quot;border: none; float: right;&quot; /&gt;&lt;span class=&quot;zem-script more-related pretty-attribution&quot;&gt;&lt;script defer=&quot;defer&quot; src=&quot;http://static.zemanta.com/readside/loader.js&quot; type=&quot;text/javascript&quot;&gt;&lt;/script&gt;&lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/5913841384336537447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=5913841384336537447' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5913841384336537447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5913841384336537447'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/06/mysql-indexes-on-subqueries.html' title='MySQL indexes on subqueries'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-5402657747473330421</id><published>2010-06-13T12:42:00.004-07:00</published><updated>2011-05-01T11:26:01.960-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Spring: Classpath resource resolving from jars using wildcards</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;When I tried to setup load for Spring context files using infinitive nesting of packages in jars, i.e. using &lt;b&gt;**&lt;/b&gt; as wildcards, I noticed that Spring couldn&#39;t load my files from jar files and started silently without any errors. After some investigations I noticed a problem in resolution of the pattern &lt;b&gt;classpath:**/ac-*.xml&lt;/b&gt;. The fastest fix for me was in providing another way to load these context files:&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;1. At first I changed the pattern &lt;i&gt;classpath:**/ac-*.xml&lt;/i&gt; to relative application root&lt;br /&gt;&lt;div style=&quot;text-align: center;&quot;&gt;&lt;b&gt;WEB-INF/lib/*.jar!/&lt;/b&gt;&lt;i&gt;**/ac-*.xml&lt;/i&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;2. I introduced ability to process this pattern in Spring&#39;s &lt;i&gt;ServletContextResourcePatternResolver&lt;/i&gt; extending it:&lt;/div&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;public class ServletContextResourcePatternResolverImpl extends&lt;br /&gt;    org.springframework.web.context.support.ServletContextResourcePatternResolver {&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Constructor from superclass.&lt;br /&gt;   */&lt;br /&gt;  public ServletContextResourcePatternResolverImpl(ServletContext servletContext) {&lt;br /&gt;    super(servletContext);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Constructor from superclass.&lt;br /&gt;   */&lt;br /&gt;  public ServletContextResourcePatternResolverImpl(ResourceLoader resourceLoader) {&lt;br /&gt;    super(resourceLoader);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * {@inheritDoc}&lt;br /&gt;   */&lt;br /&gt;  @SuppressWarnings(&quot;unchecked&quot;)&lt;br /&gt;  protected void doRetrieveMatchingServletContextResources(ServletContext &lt;br /&gt;                 servletContext, String fullPattern, String dir, Set result) &lt;br /&gt;                 throws IOException {&lt;br /&gt;    Set candidates = servletContext.getResourcePaths(dir);&lt;br /&gt;    if (candidates != null) {&lt;br /&gt;      boolean dirDepthNotFixed = (fullPattern.indexOf(&quot;**&quot;) != -1);&lt;br /&gt;      for (Iterator it = candidates.iterator(); it.hasNext();) {&lt;br /&gt;        String currPath = (String) it.next();&lt;br /&gt;        if (!currPath.startsWith(dir)) {&lt;br /&gt;          // Returned resource path does not start with relative&lt;br /&gt;          // directory:&lt;br /&gt;          // assuming absolute path returned -&amp;gt; strip absolute path.&lt;br /&gt;          int dirIndex = currPath.indexOf(dir);&lt;br /&gt;          if (dirIndex != -1) {&lt;br /&gt;            currPath = currPath.substring(dirIndex);&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;        if (currPath.endsWith(&quot;/&quot;)&lt;br /&gt;            &amp;amp;&amp;amp; (dirDepthNotFixed ||&lt;br /&gt;                        StringUtils.countOccurrencesOf(currPath, &quot;/&quot;) &amp;lt;&lt;br /&gt;                        StringUtils.countOccurrencesOf(fullPattern, &quot;/&quot;))) {&lt;br /&gt;          // Search subdirectories recursively:&lt;br /&gt;          // ServletContext.getResourcePaths&lt;br /&gt;          // only returns entries for one directory level.&lt;br /&gt;          doRetrieveMatchingServletContextResources(servletContext, &lt;br /&gt;                                                   fullPattern, currPath, result);&lt;br /&gt;        }&lt;br /&gt;        // START FIX&lt;br /&gt;        // In this place I have to delegate jars processing to my own method&lt;br /&gt;        if (currPath.endsWith(&quot;.jar&quot;)) {&lt;br /&gt;          doRetrieveMatchingJarEntries(servletContext, currPath,&lt;br /&gt;              org.apache.commons.lang.StringUtils.substringAfter(fullPattern,&lt;br /&gt;                  ResourceUtils.JAR_URL_SEPARATOR), result);&lt;br /&gt;        }&lt;br /&gt;        // END FIX&lt;br /&gt;        if (getPathMatcher().match(fullPattern, currPath)) {&lt;br /&gt;          result.add(new ServletContextResource(servletContext, currPath));&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Method extracts entries from the given jar by pattern. &lt;br /&gt;   * I&#39;ve introduced it to resolve patterns&lt;br /&gt;   * related to jars relative application root.&lt;br /&gt;   * &lt;br /&gt;   * @param servletContext servlet context&lt;br /&gt;   * @param subPattern wildcards to obtain resources from jar&lt;br /&gt;   * @param jarFilePath path to jar file&lt;br /&gt;   * @param result collection with resources&lt;br /&gt;   * @throws IOException if jar cannot be opened&lt;br /&gt;   */&lt;br /&gt;  @SuppressWarnings(&quot;unchecked&quot;)&lt;br /&gt;  private void doRetrieveMatchingJarEntries(ServletContext servletContext, &lt;br /&gt;      String jarFilePath, String subPattern, Set result) throws IOException {&lt;br /&gt;&lt;br /&gt;    if (org.apache.commons.lang.StringUtils.isNotBlank(subPattern)) {&lt;br /&gt;&lt;br /&gt;      String absoluteJarPath = servletContext.getRealPath(jarFilePath);&lt;br /&gt;      JarFile jarFile = new JarFile(absoluteJarPath);&lt;br /&gt;&lt;br /&gt;      for (Enumeration entries = jarFile.entries(); entries.hasMoreElements();) {&lt;br /&gt;        JarEntry entry = (JarEntry) entries.nextElement();&lt;br /&gt;        String entryPath = entry.getName();&lt;br /&gt;        if (getPathMatcher().match(subPattern, entryPath)) {&lt;br /&gt;          result.add(new UrlResource(ResourceUtils.URL_PROTOCOL_JAR + &quot;:&quot;&lt;br /&gt;              + ResourceUtils.URL_PROTOCOL_FILE + &quot;:&quot; + absoluteJarPath&lt;br /&gt;              + ResourceUtils.JAR_URL_SEPARATOR + entryPath));&lt;br /&gt;        }&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;3. I redefined this resolver in my own &lt;i&gt;XmlWebApplicationContext&lt;/i&gt; in the following way: &lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;public class XmlWebApplicationContextImpl extends XmlWebApplicationContext {&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * Default constructor.&lt;br /&gt;   */&lt;br /&gt;  public XmlWebApplicationContextImpl() {&lt;br /&gt;    super();&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /**&lt;br /&gt;   * {@inheritDoc}&lt;br /&gt;   */&lt;br /&gt;  @Override&lt;br /&gt;  protected ResourcePatternResolver getResourcePatternResolver() {&lt;br /&gt;    return new ServletContextResourcePatternResolverImpl(this);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;and specified this class in &lt;i&gt;web.xml&lt;/i&gt; in case of Spring MVC usage &lt;br /&gt;&lt;pre class=&quot;brush: xml&quot; name=&quot;code&quot;&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt; &amp;lt;servlet-name&amp;gt;ApplicationServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt; &amp;lt;servlet-class&amp;gt;org.springframework.web.servlet.DispatcherServlet&lt;br /&gt; &amp;lt;/servlet-class&amp;gt;&lt;br /&gt; &amp;lt;init-param&amp;gt;&lt;br /&gt;  &amp;lt;param-name&amp;gt;contextConfigLocation&amp;lt;/param-name&amp;gt;&lt;br /&gt;  &amp;lt;param-value&amp;gt;WEB-INF/lib/*.jar!/**/ac-*.xml&amp;lt;/param-value&amp;gt;&lt;br /&gt; &amp;lt;/init-param&amp;gt;&lt;br /&gt; &amp;lt;init-param&amp;gt;&lt;br /&gt;  &amp;lt;param-name&amp;gt;contextClass&amp;lt;/param-name&amp;gt;&lt;br /&gt;  &amp;lt;param-value&amp;gt;com.test.context.XmlWebApplicationContextImpl&lt;br /&gt;  &amp;lt;/param-value&amp;gt;&lt;br /&gt; &amp;lt;/init-param&amp;gt;&lt;br /&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;All context files matched to lookup pattern are loaded fine now. I posted this problem to Spring JIRA as new issue &lt;a href=&quot;http://jira.springframework.org/browse/SPR-7198&quot;&gt;SPR-7198&lt;/a&gt; and my changes from &lt;b&gt;ServletContextResourcePatternResolverImpl&lt;/b&gt; were successfully merged into Spring sources by Juergen Hoeller. He confirmed that main problem is in resolving &lt;b&gt;**&lt;/b&gt; if they are exactly in start of resource name, read his comment:&lt;/div&gt;&lt;blockquote&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&quot;classpath*:&quot; unfortunately has a fundamental limitation in that it requires as base path to search from. For example, &quot;classpath*:META-INF/*/context.xml&quot; or classpath:com/mycompany/**/context.xml&quot; should work fine. JVM ClassLoaders are able to resolve such base packages at runtime, for further traversal down the package hierarchy, but &lt;u&gt;do not resolve classpath roots in jar files&lt;/u&gt;, unfortunately - which is why specifying the base package makes a difference. Going through WEB-INF/lib jar files directly, as you do, is a fine workaround for that limitation&lt;/div&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/5402657747473330421/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=5402657747473330421' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5402657747473330421'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5402657747473330421'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/06/spring-classpath-resource-resolving.html' title='Spring: Classpath resource resolving from jars using wildcards'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>1</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-5908017572978767196</id><published>2010-06-01T15:05:00.003-07:00</published><updated>2011-05-01T11:32:51.754-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="Jboss tools"/><category scheme="http://www.blogger.com/atom/ns#" term="richfaces"/><title type='text'>JBoss Tools Richfaces breaks Eclipse</title><content type='html'>When I tried to use new version of &lt;i&gt;JBoss Tools &lt;b&gt;3.1.0.GA&lt;/b&gt;&lt;/i&gt; I was surprised that &lt;i&gt;RichFaces&lt;/i&gt; plugin breaks Eclipse: when I tried to build project or just open any JSF (xhtml) page I saw high CPU usage and increase of occupied memory in heap status monitor and...after some times Eclipse failed with OutOfMemory. I figured out that it was &lt;i&gt;KB (Knowledge Base) Builder&lt;/i&gt; which was running at this time. I discovered that KB builder was refactored to use tag library descriptors (tld), schemas and others from referenced resources in autocomplete. After some investigations using jstack I saw the following traces related to KB:&lt;br /&gt;&lt;pre&gt;at org.jboss.tools.common.model.filesystems.impl.JarAccess.getContent(JarAccess.java:201) &lt;br /&gt;at org.jboss.tools.common.model.filesystems.impl.JarFolderImpl.createFileObject(JarFolderImpl.java:92) &lt;br /&gt;at org.jboss.tools.common.model.filesystems.impl.JarFolderImpl.loadChildren(JarFolderImpl.java:74) &lt;br /&gt;at org.jboss.tools.common.model.impl.RegularObjectImpl.getChildren(RegularObjectImpl.java:58) &lt;br /&gt;at org.jboss.tools.jst.web.kb.internal.scanner.LibraryScanner.parseInPackages(LibraryScanner.java:104)&lt;/pre&gt;and&lt;br /&gt;&lt;pre&gt;at java.lang.String.intern(Native Method) &lt;br /&gt;at org.jboss.tools.common.model.impl.XModelObjectImpl.set(XModelObjectImpl.java:135) &lt;br /&gt;at org.jboss.tools.common.model.impl.RegularObjectImpl.set(RegularObjectImpl.java:103) &lt;br /&gt;at org.jboss.tools.common.model.filesystems.impl.FileAnyImpl.set(FileAnyImpl.java:181) &lt;br /&gt;at org.jboss.tools.common.meta.impl.adapters.XAdapterModelElement.setProperty(XAdapterModelElement.java:26) &lt;br /&gt;at org.jboss.tools.common.model.impl.XModelObjectImpl.set_0(XModelObjectImpl.java:146) &lt;br /&gt;at org.jboss.tools.common.model.impl.XModelImpl.createModelObject(XModelImpl.java:264) &lt;br /&gt;at org.jboss.tools.common.model.filesystems.impl.JarFolderImpl.createFileObject(JarFolderImpl.java:96) &lt;br /&gt;at org.jboss.tools.common.model.filesystems.impl.JarFolderImpl.loadChildren(JarFolderImpl.java:74) &lt;br /&gt;at org.jboss.tools.common.model.impl.RegularObjectImpl.getChildren(RegularObjectImpl.java:58) &lt;br /&gt;at org.jboss.tools.jst.web.kb.internal.scanner.LibraryScanner.parseInPackages(LibraryScanner.java:104)&lt;/pre&gt;I tried to resolve this issue disabling validation but It didn&#39;t help me. I couldn&#39;t disable KB builder at all because I actually used only autocomplete from &lt;i&gt;Jboss Tools Richfaces&lt;/i&gt; which depends to KB. I supposed the main problem was in big workspace that I used: it contains approximately 120 java projects generated by eclipse maven plugin and 1500 xhtml pages.&lt;br /&gt;&lt;br /&gt;Thus I got all investigated information and posted new bug into &lt;i&gt;Jboss Tools Jira&lt;/i&gt; &lt;a href=&quot;https://jira.jboss.org/browse/JBIDE-6372&quot;&gt;JBIDE-6372&lt;/a&gt;. I was very surprised when after some discussions and investigations this problem was fixed! I&#39;ve checked it out!&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Thanks to Jboss Tools development team for this hot fix!&lt;/i&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/5908017572978767196/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=5908017572978767196' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5908017572978767196'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/5908017572978767196'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/06/jboss-tools-richfaces-breaks-eclipse.html' title='JBoss Tools Richfaces breaks Eclipse'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-6173861960845131956</id><published>2010-05-30T13:02:00.002-07:00</published><updated>2011-05-01T11:34:18.067-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Grinder"/><category scheme="http://www.blogger.com/atom/ns#" term="GrinderStone"/><category scheme="http://www.blogger.com/atom/ns#" term="Jython"/><title type='text'>New Release: GrinderStone 2.5.2</title><content type='html'>&lt;a href=&quot;http://code.google.com/p/grinderstone/&quot;&gt;GrinderStone&lt;/a&gt; 2.5.2 is a new release with the following list of improvements: &lt;br /&gt;&lt;ol&gt;&lt;li&gt;fix for debugging using new version of Grinder 3.4 (issue &lt;a href=&quot;http://code.google.com/p/grinderstone/issues/detail?id=25&quot;&gt;#25&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;ability to reference Java projects from Jython projects (issue &lt;a href=&quot;http://code.google.com/p/grinderstone/issues/detail?id=24&quot;&gt;#24&lt;/a&gt;)&lt;/li&gt;&lt;li&gt;support for Eclipse 3.6 (Helios)&lt;br /&gt;&lt;li&gt;impoved Eclipse Update Site to allow discovery PyDev site out of the box, i.e. you don&#39;t need install PyDev manually before GrinderStone installation - our Eclipse Update Site does it for you automatically. Just specify the new &lt;a href=&quot;http://grinderstone.googlecode.com/svn/update/site.xml&quot;&gt;URL&lt;/a&gt; in Eclipse update manager.&lt;/li&gt;&lt;br /&gt;&lt;br /&gt;&lt;/ol&gt;As usual you can download binary and source packages from official &lt;a href=&quot;http://code.google.com/p/grinderstone/&quot;&gt;GrinderStone site&lt;/a&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/6173861960845131956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=6173861960845131956' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6173861960845131956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6173861960845131956'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/05/new-release-grinderstone-252.html' title='New Release: GrinderStone 2.5.2'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-6923850373401558183</id><published>2010-05-28T14:06:00.001-07:00</published><updated>2011-05-01T11:35:32.880-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="AspectJ"/><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><title type='text'>Cool class name in AspectJ</title><content type='html'>I&#39;ve noticed cool class name in &lt;i&gt;AspectJ&lt;/i&gt; sources in &lt;i&gt;org.aspectj.weaver.patterns&lt;/i&gt; package:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HasThisTypePatternTriedToSneakInSomeGenericOrParameterizedTypePatternMatchingStuffAnywhereVisitor&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;He-he, is it long? Yes, but it&#39;s clear what this class does ;)</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/6923850373401558183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=6923850373401558183' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6923850373401558183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6923850373401558183'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/05/cool-class-name-in-aspectj.html' title='Cool class name in AspectJ'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-6652985179429764772</id><published>2010-05-18T15:49:00.002-07:00</published><updated>2011-05-01T11:38:49.016-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Linux"/><category scheme="http://www.blogger.com/atom/ns#" term="Ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="video"/><title type='text'>Problem with video during dual monitor usage in Ubuntu solved!</title><content type='html'>When I setupped dual monitors in my Ubuntu (additional monitor for my notebook) I got a problem that any video players showed blank or black screen during video processing. Solution was:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;ALT+F2&lt;/li&gt;&lt;li&gt;enter gstreamer-properties&lt;/li&gt;&lt;li&gt;go to &lt;i&gt;Video&lt;/i&gt; tab&lt;/li&gt;&lt;li&gt;choose &lt;i&gt;No Xv&lt;/i&gt; option in &lt;i&gt;Plugin&lt;/i&gt; selectbox&lt;/li&gt;&lt;/ol&gt;And video is shown fine now, but It takes more CPU resources.</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/6652985179429764772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=6652985179429764772' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6652985179429764772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/6652985179429764772'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/05/problem-with-video-during-dual-monitor.html' title='Problem with video during dual monitor usage in Ubuntu solved!'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry><entry><id>tag:blogger.com,1999:blog-1963153121522749234.post-421124882935391791</id><published>2010-05-13T04:41:00.008-07:00</published><updated>2011-05-01T12:35:43.821-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="development"/><category scheme="http://www.blogger.com/atom/ns#" term="gwt"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>The easiest way to integrate Spring with GWT</title><content type='html'>There are so many articles how to integrate GWT and Spring but I think the following described solution is the easiest. I used to develope one appllication approximately one year ago and used this solution, so I can recommend it now.&lt;br /&gt;&lt;br /&gt;At first let&#39;s create an abstract class which integrates Spring with GWT on RemoteService level. I&#39;ve included transaction management into this integration because it simplifies and clarifies Tx management in GWT services, i.e. all remote service methods will be transactional out of the box in this case.&lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;public abstract class SpringIntegratedTransactionalGWTService extends &lt;br /&gt;                RemoteServiceServlet&lt;br /&gt;                implements ServletConfigAware, InitializingBean {&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * UID.&lt;br /&gt;     */&lt;br /&gt;    private static final long serialVersionUID = -985899061621516290L;&lt;br /&gt;&lt;br /&gt;    protected final Log logger = LogFactory.getLog(getClass());&lt;br /&gt;&lt;br /&gt;    /** Transaction holder. */&lt;br /&gt;    private static final ThreadLocal&amp;lt;transactionstatus&amp;gt; txStatus = new ThreadLocal&amp;lt;transactionstatus&amp;gt;();&lt;br /&gt;&lt;br /&gt;    /** Transaction manager. */&lt;br /&gt;    private transient PlatformTransactionManager txManager;&lt;br /&gt;&lt;br /&gt;    /** Spring servlet&#39;s configuration. */&lt;br /&gt;    private transient ServletConfig config;&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Overridden for transaction management. Method tries to start transaction.&lt;br /&gt;     */&lt;br /&gt;    @Override&lt;br /&gt;    protected void onBeforeRequestDeserialized(String serializedRequest) {&lt;br /&gt;        startUserTransaction();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Overridden for transaction management. &lt;br /&gt;     * Method tries to roll back transaction and fill&lt;br /&gt;     * response data.&lt;br /&gt;     */&lt;br /&gt;    @Override&lt;br /&gt;    protected void doUnexpectedFailure(Throwable e) {&lt;br /&gt;        logger.error(e.getLocalizedMessage(), e);&lt;br /&gt;        resolveUserTransaction(false);&lt;br /&gt;        respondWithFailure(getThreadLocalResponse(), e);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Overridden for transaction management. &lt;br /&gt;     * Method tries to complete transaction depends on&lt;br /&gt;     * returned data.&lt;br /&gt;     */&lt;br /&gt;    @Override&lt;br /&gt;    protected void onAfterResponseSerialized(String serializedResponse) {&lt;br /&gt;        resolveUserTransaction(isResponseSuccessfull(serializedResponse));&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Method notify force commit to TX manager.&lt;br /&gt;     */&lt;br /&gt;    protected void forceCommitUserTransaction() {&lt;br /&gt;        resolveUserTransaction(true);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Method fills response data for unexpected error occurring.&lt;br /&gt;     * &lt;br /&gt;     * @param response response&lt;br /&gt;     * @param ex error&lt;br /&gt;     */&lt;br /&gt;    private void respondWithFailure(HttpServletResponse response, Throwable ex) {&lt;br /&gt;        try {&lt;br /&gt;            response.setContentType(&amp;quot;text/plain&amp;quot;);&lt;br /&gt;            response.setStatus(HttpServletResponse.SC_OK);&lt;br /&gt;            response.getWriter().write(ex.getLocalizedMessage());&lt;br /&gt;        } catch (IOException e) {&lt;br /&gt;            logger.error(&amp;quot;respondWithFailure failed while sending&amp;quot;&lt;br /&gt;                            + &amp;quot; the previous failure to the client&amp;quot;, e);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Method tries to start transaction.&lt;br /&gt;     */&lt;br /&gt;    private void startUserTransaction() {&lt;br /&gt;        TransactionStatus status = txManager.getTransaction(new DefaultTransactionDefinition());&lt;br /&gt;        if (!status.isNewTransaction()) {&lt;br /&gt;            logger.warn(&amp;quot;Transaction is not new. Check your services workflow.&amp;quot;);&lt;br /&gt;        }&lt;br /&gt;        txStatus.set(status);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Method checks serialized response for correctness.&lt;br /&gt;     * &lt;br /&gt;     * @param serializedResponse response&lt;br /&gt;     * @return &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; if response processed correctly, otherwise &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt;&lt;br /&gt;     */&lt;br /&gt;    private boolean isResponseSuccessfull(String serializedResponse) {&lt;br /&gt;        boolean result = true;&lt;br /&gt;        if (serializedResponse == null) {&lt;br /&gt;            result = false;&lt;br /&gt;        } else if (serializedResponse.startsWith(&amp;quot;//OK&amp;quot;)) {&lt;br /&gt;            result = true;&lt;br /&gt;        } else if (serializedResponse.startsWith(&amp;quot;//EX&amp;quot;)) {&lt;br /&gt;            result = false;&lt;br /&gt;        }&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Method resolves transaction for current thread.&lt;br /&gt;* &amp;lt;b&amp;gt;NOTE:&amp;lt;/b&amp;gt; we have single threaded transactions here.&lt;br /&gt;     * &lt;br /&gt;     * @param isResponseSuccessfull value indicates response correctness&lt;br /&gt;     */&lt;br /&gt;    private void resolveUserTransaction(boolean isResponseSuccessfull) {&lt;br /&gt;        TransactionStatus status = txStatus.get();&lt;br /&gt;        try {&lt;br /&gt;            if (status != null &amp;amp;&amp;amp; !status.isCompleted()) {&lt;br /&gt;                if (!isResponseSuccessfull || status.isRollbackOnly()) {&lt;br /&gt;                    txManager.rollback(status);&lt;br /&gt;                    if (logger.isDebugEnabled()) {&lt;br /&gt;                        logger.debug(&amp;quot;Transaction is rolled back.&amp;quot;);&lt;br /&gt;                    }&lt;br /&gt;                } else {&lt;br /&gt;                    try {&lt;br /&gt;                        txManager.commit(status);&lt;br /&gt;                        if (logger.isTraceEnabled()) {&lt;br /&gt;                            logger.trace(&amp;quot;Transaction is commited.&amp;quot;);&lt;br /&gt;                        }&lt;br /&gt;                    } catch (Throwable e) {&lt;br /&gt;                        if(!status.isCompleted()){&lt;br /&gt;                            txManager.rollback(status);&lt;br /&gt;                        }&lt;br /&gt;                        if (logger.isDebugEnabled()) {&lt;br /&gt;                            logger.debug(&amp;quot;Transaction is rolled back.&amp;quot;);&lt;br /&gt;                        }&lt;br /&gt;                        throw e;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            } else {&lt;br /&gt;                if (logger.isTraceEnabled()) {&lt;br /&gt;                    logger.trace(&amp;quot;Transaction is not present or completed&amp;quot;&lt;br /&gt;                                    + &amp;quot; after service work completion.&amp;quot;);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        } catch (RuntimeException e) {&lt;br /&gt;            throw e;&lt;br /&gt;        } catch (Throwable e) {&lt;br /&gt;            throw new RuntimeException(e.getLocalizedMessage(), e);&lt;br /&gt;        } finally {&lt;br /&gt;            txStatus.remove();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Autowired&lt;br /&gt;    public void setTransactionManager(@Qualifier(&amp;quot;transactionManager&amp;quot;)&lt;br /&gt;                                             PlatformTransactionManager manager) {&lt;br /&gt;        this.txManager = manager;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * {@inheritDoc}&lt;br /&gt;     */&lt;br /&gt;    public void setServletConfig(ServletConfig servletConfig) {&lt;br /&gt;        this.config = servletConfig;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    @Override&lt;br /&gt;    public ServletConfig getServletConfig() {&lt;br /&gt;        if (config != null) {&lt;br /&gt;            return config;&lt;br /&gt;        }&lt;br /&gt;        return super.getServletConfig();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * {@inheritDoc}&lt;br /&gt;     */&lt;br /&gt;    public void afterPropertiesSet() throws Exception {&lt;br /&gt;        validateInitialization(txManager);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Method validates the given collection of properties and &lt;br /&gt;     * if it contains &amp;lt;code&amp;gt;null&amp;lt;/code&amp;gt;&lt;br /&gt;     * {@link BeanInitializationException} will be thrown.&lt;br /&gt;     * &lt;br /&gt;     * @param properties properties to validate&lt;br /&gt;     */&lt;br /&gt;    protected void validateInitialization(Object... properties) {&lt;br /&gt;        // org.apache.commons.lang.ArrayUtils&lt;br /&gt;        if (ArrayUtils.contains(properties, null))&lt;br /&gt;            throw new BeanInitializationException(getClass().getSimpleName()&lt;br /&gt;                            + &amp;quot; bean is not initialized correctly. &amp;quot;&lt;br /&gt;                            + &amp;quot;Initialize all properties before usage.&amp;quot;);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    /**&lt;br /&gt;     * Performs deserialization.&lt;br /&gt;     */&lt;br /&gt;    private void readObject(ObjectInputStream aInputStream) throws ClassNotFoundException,&lt;br /&gt;                    IOException {&lt;br /&gt;        aInputStream.defaultReadObject();&lt;br /&gt;        // I store Spring application context in separate class&lt;br /&gt;        ApplicationContext context = ApplicationContextHolder.getContext();&lt;br /&gt;        if (context == null) {&lt;br /&gt;            logger.error(&amp;quot;Spring is not initialized yet but system tries to deserialize &amp;quot;&lt;br /&gt;                            + &amp;quot;Spring dependent component.\n &amp;quot;&lt;br /&gt;                            + &amp;quot;It can be system error in a case of cluster &amp;quot;&lt;br /&gt;                            + &amp;quot;or smth else.\n But it also can be a &amp;quot;&lt;br /&gt;                            + &amp;quot;simple warning in a case of system restart when &amp;quot;&lt;br /&gt;                            + &amp;quot;Servlet container tries to restore &amp;quot;&lt;br /&gt;                            + &amp;quot;previous state of Http servlets\n &amp;quot;&lt;br /&gt;                            + &amp;quot;In this case just skip this error.&amp;quot;);&lt;br /&gt;        } else {&lt;br /&gt;            context.getAutowireCapableBeanFactory().autowireBean(this);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;where ApplicationContextHolder looks like:&lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;@Component&lt;br /&gt;public final class ApplicationContextHolder implements ApplicationContextAware {&lt;br /&gt;    /** Spring application context. */&lt;br /&gt;    private static ApplicationContext context;&lt;br /&gt;&lt;br /&gt;    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {&lt;br /&gt;        ApplicationContextHolder.context = applicationContext;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public static ApplicationContext getContext() {&lt;br /&gt;        return context;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;Include the following lines into Spring XML configuration file to allow handling HTTP requests by annotated HTTP servlets:&lt;br /&gt;&lt;pre class=&quot;brush: xml&quot; name=&quot;code&quot;&gt;&amp;lt;bean class=&amp;quot;org.springframework.web.servlet.handler.SimpleServletHandlerAdapter&amp;quot; /&amp;gt;&lt;br /&gt;&lt;/pre&gt;and do not forget mapping of Spring Dispatcher servlet in web.xml for each GWT module:&lt;br /&gt;&lt;pre class=&quot;brush: xml&quot; name=&quot;code&quot;&gt;&amp;lt;servlet&amp;gt;&lt;br /&gt; &amp;lt;servlet-name&amp;gt;ApplicationServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt; &amp;lt;servlet-class&amp;gt;&lt;br /&gt;  org.springframework.web.servlet.DispatcherServlet&lt;br /&gt; &amp;lt;/servlet-class&amp;gt;&lt;br /&gt;&amp;lt;/servlet&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;servlet-mapping&amp;gt;&lt;br /&gt; &amp;lt;servlet-name&amp;gt;ApplicationServlet&amp;lt;/servlet-name&amp;gt;&lt;br /&gt; &amp;lt;url-pattern&amp;gt;&lt;br /&gt;  /com.test.gwt.Module/dispatcher/*&lt;br /&gt; &amp;lt;/url-pattern&amp;gt;&lt;br /&gt;&amp;lt;/servlet-mapping&amp;gt;&lt;br /&gt;&lt;/pre&gt;Example of Spring annotated GWT servlet (and of course you can Autowire any field of this class using Spring):&lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;@Controller&lt;br /&gt;@RequestMapping(value = &amp;quot;/**/test&amp;quot;)&lt;br /&gt;public class TestServiceImpl extends SpringIntegratedTransactionalGWTService implements ITestService {&lt;br /&gt;&lt;br /&gt;    public void test(){&lt;br /&gt;        System.out.println(&amp;quot;Tx GWT Service called.&amp;quot;);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;where &lt;i&gt;ITestService&lt;/i&gt; is:&lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;public interface ITestService extends RemoteService {&lt;br /&gt;    public void test();&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;and corresponding async service:&lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;public interface ITestServiceAsync {&lt;br /&gt;     public void test(AsyncCallback&amp;lt;Void&amp;gt; callback);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;Let&#39;s create void async callback (for testing purposes):&lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;public class VoidAsyncCallback implements AsyncCallback&amp;lt;Void&amp;gt; {&lt;br /&gt;&lt;br /&gt;    public void onFailure(Throwable caught) {&lt;br /&gt;        GWT.log(&amp;quot;Void Request processing fails&amp;quot;, caught);&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public void onSuccess(Void result) {&lt;br /&gt;        GWT.log(&amp;quot;Void Request processed successfully&amp;quot;, null);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;And example of GWT remote service usage:&lt;br /&gt;&lt;pre class=&quot;brush: java&quot; name=&quot;code&quot;&gt;IAdministrationServiceAsync service = GWT.create(IAdministrationService.class);&lt;br /&gt;ServiceDefTarget endpoint = (ServiceDefTarget) service;&lt;br /&gt;String moduleRelativeURL = GWT.getModuleBaseURL() + &amp;quot;dispatcher/test&amp;quot;;&lt;br /&gt;endpoint.setServiceEntryPoint(moduleRelativeURL);&lt;br /&gt;&lt;br /&gt;service.test(new VoidAsyncCallback());&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://slava-technical.blogspot.com/feeds/421124882935391791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1963153121522749234&amp;postID=421124882935391791' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/421124882935391791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1963153121522749234/posts/default/421124882935391791'/><link rel='alternate' type='text/html' href='http://slava-technical.blogspot.com/2010/05/easiest-way-to-integrate-spring-with.html' title='The easiest way to integrate Spring with GWT'/><author><name>Borislav Andruschuk</name><uri>https://plus.google.com/101881418013737611388</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh6.googleusercontent.com/-n8i7fd-i5VA/AAAAAAAAAAI/AAAAAAAAow4/ENLADZ5lpLU/s512-c/photo.jpg'/></author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></entry></feed>