page banner
avatar
'Groovy for Java developer: learning Groovy-specific features' post illustration
Groovy for Java developer: learning Groovy-specific features

Groovy is an object oriented dynamic language for the JVM. Dynamically compiled to a bytecode and interoperable with most Java libraries, Groovy is a perfect candidate for writing lightweight scripts that still can benefit from the Java ecosystem. Also, it is really easy to learn since the good old Java syntax is usually valid in Groovy. There are, however, a few caveats that you should be aware of before start coding. This post shows some specific features, and also gives a few suggestions which will help to write a clear, groovy-style code.

avatar
'Escaping Deadlocks' post illustration
Escaping Deadlocks

Concurrent programs is not a novelty today, almost every modern application executes in multiple threads. But as concurrency brought us better resource utilization and throughput, it also introduced a number of issues nonexistent in serial execution. One of them is deadlocks. A deadlock is a situation where in two or more competing actions are each waiting for the other to finish, and thus neither ever does.

avatar
'Effectively Immutable Objects' post illustration
Effectively Immutable Objects

An immutable object is one whose state cannot be changed after construction. All the beauty in these objects is that they are simple and safe. In multi-threaded applications all concurrency issues boil down to coordinating access to mutable state. The less mutable state, the easier it is to ensure thread safety. That’s why you should always consider making your objects immutable whenever it is feasible. Creating an immutable type is not a complex process, but you should follow a handful of rules to stay away from pitfalls it definitely implies.

avatar
'Synchronizing threads with Java locks' post illustration
Synchronizing threads with Java locks

Java locks often supersede synchronized blocks and methods by allowing to back out from the synchronization attempt. This post shows how to use the feature, and demonstrates some other basic concepts, like the lock fairness and reentrant locks, which should help you to get started with the lock-based synchronization.

avatar
'Authorize.Net CIM With Java SDK: Managing Your Customers' Info' post illustration
Authorize.Net CIM With Java SDK: Managing Your Customers' Info

In the previous post I’ve told how to bill a customer with a minimal fuss. But oftentimes returning customers wish to add or change their billing information or maybe you want to delete the old ones. Let’s dive deeper and see what’s possible to do with Authorize.Net Customer Information Manager by remote procedure calls using, as previously, Java SDK.

avatar
'Building ESME with Logica OpenSMPP Java library' post illustration
Building ESME with Logica OpenSMPP Java library

Short Message Peer to Peer (SMPP) is an open, telecommunications industry protocol for exchanging text messages (SMS) between short message service centers (SMSC) and External Short Messaging Entities (ESMEs). The protocol is often used for connecting to SMS centers in order to send messages to mobile devices.

'Simply about Spring. Inversion of Control (IoC)' post illustration
Simply about Spring. Inversion of Control (IoC)

This week I'll tell you about inversion of control. This is very useful thing if you are going to develop dynamic application in compliance with modern approach to software development.

avatar
'Harnessing JIRA's SOAP API with Java' post illustration
Harnessing JIRA's SOAP API with Java

JIRA is a popular issue tracking and project management software. It can be used and accessed by lots of different means like IDE, email client or a web browser. Also there are many plug-ins for all sorts of other software products. Such an abundance is explained by the fact that JIRA has open and convenient remote procedure call APIs: REST, XML-RPC and SOAP.

So, it is possible to make your application communicate with JIRA through these APIs, too. If correctly integrate a Java API client, issuing a command to JIRA becomes the same as invoking a local subroutine. Let’s create such a little Java program and do some manipulations with an Issue in JIRA.

avatar
'Creating SOAP client from wsdl file' post illustration
Creating SOAP client from wsdl file

Today we’ll talk about writing java client for exchanging data with web service using SOAP protocol specification. Many of the web services that supports SOAP have java libraries that can make this task pretty simple to implement.
But if there is no such feature, then it becomes a little tricky, but in this article I will show you that it's not so hard as it seems.

avatar
'Immutable Collections in Java' post illustration
Immutable Collections in Java

Occasionally, while programming, one may want to create constant sets and store them in final variables for public use. Such a desire can lead to all sorts of problems.

avatar
'Get process list in Unix based systems in Java.' post illustration
Get process list in Unix based systems in Java.

In this article we’ll talk about how to get process list in Java by running standard Unix commands.

avatar
'API Enhancements in Java SE 7' post illustration
API Enhancements in Java SE 7

Recently released Java 7 has a lot of useful API enhancements such as the automatic resource management, multi-catch statements, switch statement with strings, binary literals and improved numeric literals. This post is a quick roundup of the new features, which should help you to get a full picture of Java 7 syntax in a short time.

avatar
'Authorize.Net CIM With Java SDK: How To Bill Your Customers' post illustration
Authorize.Net CIM With Java SDK: How To Bill Your Customers

Authorize.Net is a popular payment gateway service provider allowing merchants to accept credit card and electronic check payments.
Using such a gateway to issue a one-time transactions doesn't raise any great troubles, but serving returning customers or managing complex subscriptions requires you either to be compliant with the Payment Card Industry Data Security Standard (PCI DSS) or to ask your customer to re-enter his or her billing info every time. Neither is always what you want. Well, among other Authorize's features there is a Customer Information Manager (CIM), which targets that particular problem.

avatar
'Designing a log of database queries for MongoDB' post illustration
Designing a log of database queries for MongoDB

The database query log could be a crucial part of a database restoring process required after data corruption caused by either an illegal update operation or a damage of database files. The main task here is to find the right format for storing the queries.

'Simply about Spring' post illustration
Simply about Spring

This article is devoted to very popular framework Spring. It’s very necessary theme for beginners in Java, because Spring is widespread technology.
First of all let's consider wiring - dynamical assembling of separated beans, most important part of Spring framework technology. It's important to keep in mind, that a good understanding of fundamental things is a irreplaceable skill for really cool programmer.

avatar
'MongoDB java driver. The custom builder for update operations.' post illustration
MongoDB java driver. The custom builder for update operations.

Java driver for MongoDB does not provide any utility classes that could help with building update queries. If you want to create a query to update or increment field values, you usually have to use BasicDBObjectBuilder. This is intuitive approach, but queries defined in such a way are quite hard to read and maintain.

avatar
'Lightweight fast persistent queue in Java using Berkley DB' post illustration
Lightweight fast persistent queue in Java using Berkley DB

Recently I had a task to develop the application which will have large work queue and which need to survive the restarts. The application need to be lightweight. After trying several different persistent engines for Java I''ve chosen to stick with Berkley DB Java edition. This persistent engine is pretty lightweight it is fast, optimized for multi-threaded usage and have no problems with reclaiming free space.

As I needed the fast persistent queue at a cost of possible data loss on system crash I've chosen non-transactional API for Berkley DB. With non-transactional API the great speed can be achieved for persistent queue at a price of loss of some data at system crash. The more data you allow to be lost the greater speed of the queue you will have. Though you can opt to sync to disk each operation on the queue and in that case your data loss will be minimal.

avatar
'How to intercept and log stdout and stderr messages with log4j' post illustration
How to intercept and log stdout and stderr messages with log4j

Log4j doesn't allow to catch stdout and stderr messages out of the box. However, you can still intercept them with a custom output stream, which is especially useful when you have to log data that third-party libraries write to the standard streams.

This has already been done by Jim Moore (have a look at the LoggingOutputStream in the log4j source code). The issue is that this LoggingOutputStream requires org.apache.log4j.Category and org.apache.log4j.Priority which are now partially deprecated.