In this article, we will examine the subtleties of using newly introduced Lock classes in java.util.concurrent.locks package and their advantages over traditional "synchronized" blocks and methods.
Java Concurrency Series- How to use Lock/RentrantLock in Java 5
- sharadjava's blog
- 1 comment
- Read more
- 1820 reads
Java Concurrency Series- How to use Future/FutureTask and Callable
In this article we will discuss how to use the new interface Callable introduced in java.concurrent.util in Java 5. Callable along with another interface Future allows us to obtain a return value from a method executed in a separate thread.
In the second example we will also examine the usage of FutureTask, an implementation of Future.
- sharadjava's blog
- 9 comments
- Read more
- 8407 reads
Java Concurrency Series - another Executor example
In an earlier article on Executor, we looked at how we can create use the executor to create thread pools to manage our multi-threaded program. We shall continue to explore additional features of this class.
Here we will extend the ThreadPooledExecutor class and provide our implementation to replace the empty implementation.
- sharadjava's blog
- 2 comments
- Read more
- 1869 reads
Java Concurrency Series - meaning of volatile variable
One of the least understood aspects of Java Thread model is the "volatile" keyword. The general misconception is that if you make a variable volatile you don't need to provide synchronized access to it.
Let's create a simple class with a integer marked as volatile. There are two methods which increment and decrement the variable in a for loop. To increase interleaving of the threads, we have a call to yield inside the for loop.
Code snippet 1
- public class VolatileExample {
- private volatile int volatileInt=0;
- /** unsynchronized volatile variable being incremented */
- sharadjava's blog
- 4 comments
- Read more
- 1734 reads
Java Concurrency Series - Simple Executor example
With Java 1.5 we have a new way of managing threads or threaded tasks. We no longer need to call start() and join()on our Thread object. The new concurrent package provides us with an elegant Executor class to manage our threads.
Let's go through a simple example given below. We have created a simple ThreadPool with default pool size of 2 and max size of 4. In the method createMultipleConsumerThreads(), we have created an instance of a Runnable task, Consumer and passed it on to the execute() method.
- sharadjava's blog
- Add new comment
- Read more
- 6108 reads
Grails - How to create groovy domain classes from mysql database
Recently I started working with Grails and I am very much impressed with its capabilities and kind of digging deep now.
Being used MyEclipse extensively I started searching for tool to create groovy domain objects from mysql database. But no luck I couldn't able to find any tools or scripts. So I created one which suits my needs presently. Feel free to use it any way you like.
Features
- Converts Plural table names to Singular form
- Removes underscores (_) and capitalizes first letter of every word.
- venkat's blog
- 1 comment
- Read more
- 1073 reads
Java Concurrency Series with examples- Barrier
In this series we will discuss different concurrent structures provided in the new Java 5 Concurrent package.
We will start with a simple parallel processing concept called "barrier" that we have all studied and forgotten. By definition if there are set of independent tasks (T1..Tn) that need to fully completed to initiate another task (Tx) which is dependent on all these tasks (T1...Tn) we can synchronize them using a barrier.
- sharadjava's blog
- Add new comment
- Read more
- 1964 reads
Ubuntu - Using Nautilus File Manager
- Configuration preference in nautilus
- Managing files and folders
- Mounting and correctly unmounting external storage devices (USB sticks and memory cards)
- Dealing with trash
- Bookmarks
- Add new comment
- 501 reads
- 29 min 10 sec
- 503 plays
ADO.NET using C# database access
- Add new comment
- Read more
- 591 reads
- 50 min 5 sec
- 591 plays
django: Web Development for Perfectionists with Deadlines
- Add new comment
- 458 reads
- 1 hour 14 min
- 458 plays
Joomla CMS Jumpstart Tutorial
Joomla! is a free, open source content management system for publishing content on the world wide web and intranets. Joomla! includes features such as page caching to improve performance, RSS feeds, printable versions of pages, news flashes, blogs, polls, website searching, and language internationalization. Joomla! is licensed under the GPL, and is the result of a fork of Mambo. Original Video From : http://video.jumpbox.com/?app=joomla
- Add new comment
- 453 reads
- 22 min 29 sec
- 453 plays
Advanced Python or Understanding Python
- Add new comment
- Read more
- 430 reads
- 1 hour 15 min
- 430 plays
Ubuntu - How to connect a Printer
- Printer auto-detection in Ubuntu 7.10 (Gutsy Gibbon)
- Automatic detection of network printers
- Manually configuring network printers
- Connecting to Windows shared printers.
- Printing test pages
- 1 comment
- 1389 reads
- 13 min 1 sec
- 1391 plays
How to Play DVD / MP3 on Ubuntu
This screencast covers:-
- Playing DVDs
- Adding codecs automatically
- Playing video embedded in a browser
- Installing Flash Player plugin
- Installing Miro video platform
- Add new comment
- 525 reads
- 15 min 39 sec
- 525 plays
Using CakePHP Database Migrations
- Add new comment
- 601 reads
- 18 min 15 sec
- 601 plays