Home » Java (page 606)

Java

EJB Programmatic Lookup

java-interview-questions-answers

In our previous post we learnt about EJB references and EJB injection. Even though EJB injection is a powerful container facility that eases modular application development, sometimes performing a programmatic EJB lookup is instead desirable. Let’s suppose, for example, that a set of distinct EJBs implement a common strategy, defined by a common business interface. Depending on the result of ...

Read More »

The Perfect Singleton

From time to time I met Java programmers that are not really sure how they should implement Singleton pattern properly. (if you don’t have an idea what Singleton is just try Wikipedia: Singleton pattern). And I’m not talking about proper implementation in threaded environment. But using the most common implementation you can find over internet you can easily create as ...

Read More »

Basic EJB References, Injection and Lookup

java-interview-questions-answers

In the first part of this series we’ve introduced the mechanisms provided by the Enterprise JavaBeans v. 3.0 Specification to define EJB components, declare a reference to an EJB and wiring them up both by dependency injection or programmatic JNDI lookup. In this blog post we’ll examine some basic examples to understand how to use the EJB API. A Basic ...

Read More »

An Introduction to EJB 3.0 Injection and Lookup

java-interview-questions-answers

Introduction The Enterprise JavaBeans Specification v. 3.0 introduces a simplified, annotation based API for EJB injection and lookup. EJB 3.0 are now POJOs and can be injected in other components (such as EJBs and Servlets) using simple annotations. EJB 3.0 is one of many other POJO-based specifications that made it to Java EE 6, such as JSR-229 “Contexts and Dependency ...

Read More »

Hibernate Gotchas to Watch out

I’ve been using Hibernate for some time now and when I don’t work on a hibernate project for a while I find myself doing the same mistakes I did the previous times. So here is a sort of watch list for my self hopefully will be useful to someone else as well. Implement hashCode and equals You should always implement ...

Read More »

C++ or Java, which is faster for high frequency trading?

Overview There are conflicting views as to what is the best solution for high frequency trading. Part of the problem is that what is high frequency trading varies more than you might expect, another part is what is meant by faster. My View If you have a typical Java programmer and typical C++ programmer, each with a few years experience ...

Read More »

Java and Memory Leaks

Overview The term “memory leak” is used in Java in a manner which is different to how it is used in other languages. What does a “memory leak” mean in general terminology and how is it used in Java? Wikipedia definition A memory leak, in computer science (or leakage, in this context), occurs when a computer program consumes memory but ...

Read More »

How to get C like performance in Java

Overview Java has many areas which can be slow. However for every problem there is a solution. Many solutions/hacks require working around Java’s protections but if you need low level performance it is still possible. Java makes high level programming simpler and easier at the cost of making low level programming much harder. Fortunately most applications follow the rule of ...

Read More »

JVM options: -client vs -server

Have you ever wonder what is this -client or -server switch when you run your java app? e.g.: javaw.exe -client com.blogspot.sdoulger.LoopTest that are also displayed in the Help of the java.exe e.g. where options include: -client to select the “client” VM -server to select the “server” VM What’s the difference between the -client and -server systems? These two systems are ...

Read More »