Java Pub House

In this podcast we air our first question/feedback from our listener and dive a little into it (related to Dependency Injection). We also talk about how to create Thread Safe objects (There is the easy way, and the hard way). And at last! we have a Google group where you can add/post comments and open discussions.

Our new Google Groups
http://groups.google.com/group/javapubhouse/

Questions, feedback or comments! comments@javapubhouse.com

Subscribe to our podcast! (http://javapubhouse.libsyn.com/rss)
ITunes link (http://itunes.apple.com/us/podcast/java-pub-house/id467641329)

Direct download: JPHE11.mp3
Category:Multithreading -- posted at: 8:40pm CST

Testing, Testing, 1.2.3! (All about Unit Testing, And Dependency Injection)

For those Unit Testers out there (and those who want to do more unit tests), this podcast is for you! We cover JUnit in general, and explain how to shoe-in unit tests in current (and legacy code). We talked about Dependency Injection (and the Concern of Creation), and Mocking (what it is, and how is it used). In all, if you ever wondered why creating unit tests in your current code is hard, or why are people talking about Dependency Injection (DI), come in, and listen!

Questions, feedback or comments! comments@javapubhouse.com

Subscribe to our podcast! (http://javapubhouse.libsyn.com/rss)
ITunes link (http://itunes.apple.com/us/podcast/java-pub-house/id467641329)
Java 7 Recipes book! (http://www.amazon.com/Java-7-Recipes-Problem-Solution-Approach/dp/1430240563)

Direct download: JPHE10.mp3
Category:Testing -- posted at: 7:57pm CST

In this episode we talk about the Decorator pattern and how it is applied. We cover a couple of caveats (especially when combined with the Observer pattern) and learn how to not be afraid of its verboseness. In all, it's the season of decorating, so let's decorate!

Questions, feedback or comments! comments@javapubhouse.com

Subscribe to our podcast!
ITunes link
Java 7 Recipes book!

Direct download: JPHE9.mp3
Category:Patterns -- posted at: 7:56pm CST

In this episode we go over Aspects (and AspectJ), what really is, and when to use them. It turns out, that there is nothing misterious about them! We also cover how to set-up Aspects for J2SE so you can start using them immediately!

Questions, feedback or comments! comments@javapubhouse.com

VM Parameter
-javaagent:dep/aspectjweaver.jar

Example Aspect

@Aspect

public class OrderAspect {

@Before("execution(* *.*(Order))") // must qualify
public void anyCall() {
System.out.println("Was called from anywhere");
}
}

Example aop.xml file

          <aspectj>
<aspects>
<aspect name="OrderAspect"/>
</aspects>
<weaver options="-verbose -showWeaveInfo">
</weaver>
</aspectj>

Example Folder Structure

src
|
|-META-INF
|
|-aop.xml

References:

http://www.eclipse.org/aspectj/doc/released/adk15notebook/ataspectj-pcadvice.html

http://www.eclipse.org/aspectj/doc/next/quick5.pdf

http://blog.espenberntsen.net/2010/03/20/aspectj-cheat-sheet/

(Using aspects with annotations)
http://stackoverflow.com/questions/2011089/aspectj-pointcut-for-all-methods-of-a-class-with-specific-annotation

Direct download: JPHE8.mp3
Category:general -- posted at: 3:00pm CST

In this episode we talk about Threads and Threading, the difference between Daemon and User Threads, and why changing priorities is not for the weak of heart. Also we cover Swing's golden Threading rule (with the Event Dispatching Thread). If you ever typed new Thread(), or if you heard to be careful about Swing and Threading, this episode is for you!

Direct download: JPHE7.mp3
Category:Multithreading -- posted at: 9:43pm CST

In this week's podcast we talk about Design Patterns (and the Grand Dads of the Software Patterns, the Gang-of-four), and dive into our first design pattern (of many), the Observer pattern. We discussed how to implemented (within Java), and went to describe its use in Java Swing, and why anonymous inner classes for Listeners doesn't create memory leaks (most of the time anyways). In all a great introduction to a first pattern (see what they are all about!)

Direct download: JPHE6.mp3
Category:Patterns -- posted at: 5:40pm CST

In this podcast we dive into the age-old producer and consumer problem, talked about the different aspects of it (what does it really solve?), and explain the difference between throughput vs latency. Lastly we discuss the ThreadPoolExecutor and how to fine tune it for your particular project needs!

Direct download: JPHE5.mp3
Category:Multithreading -- posted at: 8:33pm CST

In this episode we describe the most used collections in the Java framework, and how can they help you out. We also talk about maps (and the importance of immutable keys), and the equals/hashcode contract (why are these anyways? :). Finally we discuss how to safely access these collections/maps from different threads (and cover the check-then-act operations in maps). If you used a map, or ever got a ConcurrentModificationException, this episode is for you!

Direct download: JPHE4.mp3
Category:Multithreading -- posted at: 9:12pm CST

This episode goes deep into memory in Java, understanding how memory leaks happen (and how to solve them!), also how to design to avoid memory leaks, weak and soft references, and how the Garbage collector works (Eden, Tenured, Perm). This podcast will help everyone that needs to take care of a memory leak!

Kudos to VisualVM and VisualGC!

Direct download: JPHE3.mp3
Category:Memory -- posted at: 9:08pm CST

In this episode of Java pub house, we talk about Deadlocks, livelocks (and other spooky things). Most importantly we talk on how to spot them (using jstack, or visualvm), and how to program defensively against them. We also talk about escaped locks (the source of most deadlocks), and the wait/notify language construct. Finally we describe the unfairness of the lock (locks are not "fair" by default), and why is it so.

Direct download: JPHE2.mp3
Category:general -- posted at: 12:04pm CST

On this Episode, we talk about the keyword "volatile", and what does it really mean. Even if you are a multithreading guru, this chapter goes in deep of the different things that volatile protects you from, including L2 caches and code re-ordering. We also cover the use of synchronized, and why, even though is convenient, it might create more headache than it actually solves.

Direct download: JavaPubHouseEpisode1b.mp3
Category:Multithreading -- posted at: 10:46am CST

1