Posted on Leave a comment

Provide different implementations of an interface

Use @Qualifier

@Qualifier
@Documented
@Retention(RUNTIME)
public @interface Named {
    /** The name. */
    String value() default "";
}
@Inject
@Named("Database")
Storage storageDB;

@Inject
@Named("Cache")
Storage storageCache;
@Module
public class AppModule {

    @Provides
    @Singleton
    @Named("Database")
    public Storage provideDatabaseStorage() {
        return new Database();
    }

    @Provides
    @Singleton
    @Named("Cache")
    public Storage provideCacheStorage() {
        return new Cache();
    }
}
Posted on Leave a comment

GIT: merge vs rebase

dzone

rebase for dummies

While merging and rebasing are similar in Git, they serve two different functions. Here’s what you should know to keep your histories as clean or as complete as you like.

The git rebase command has a reputation for being magical Git voodoo that beginners should stay away from, but it can actually make life much easier for a development team when used with care. In this article, we’ll compare git rebase with the related git merge command and identify all of the potential opportunities to incorporate rebasing into the typical Git workflow.

pdf

Posted on Leave a comment

Multithreading in java

dzone

Multi-threading represents a very intriguing topic, even after years of research and development for high quality, robust, and efficient software. With equal emphasis on hardware improvements and the software that runs on it – we have newer paradigms for parallelism. The most important yet basic concepts are the ones which I present here. I then explain the intricacies of multi-threading in the Java programming language. Some of these are newer features and supported only from the Java Platform Standard Edition 5.0. Let us start with a quick overview and understanding of the core concepts.

Continue reading Multithreading in java