Archive for the ‘Java’ Category

Java Technologies at Yahoo!

Tuesday, August 5th, 2008

Yesterday, I attended a talk at SDForum presented by Dean Yu and Joshua Blatt of the Java platform team at Yahoo! The Java platform team centralizes the Java efforts for Yahoo’s non-open source efforts. I say non-open source as the platform team covers everything except things like Hadoop, etc. which are in the public domain.

Java as a technology is not native to Yahoo! The platform at Yahoo! was primarily C/C++ and PHP at the frontend (mostly). Java came through several acquisitions which were running Java stack, notably:

  • 1998 Classic Games, Sprtasy
  • 2002 Hotjobs
  • 2003 Overture (Altavista)
  • 2004 Kelkoo, Musimatch

Here are the raw bytes from the session:

  • Tomcat + jboss efforts for securing them
  • Mostly LAMP stack at Yahoo!
  • Rate limiting using Apache modules 
  • Runs apache in multiple process mode
  • Y! data streams for keeping application specific stores and pushing data around (Yahoo’s proprietary message bus like implementation)
  • Integration using JNI to C++ code using Swig for wrapper generation
  • All security related code is in C++; helps maintain a single language code-base. Hence, wide JNI use from app tier
  • Uses IPC Bridge for coarse grained calls to non-thread safe libraries (JNI has multi-threading issues)
  • Group dedicated to creating JNI wrappers of native code
  • JNI performance FUD
  • Java to Native C++ code via JNI < 20 nano seconds (Cool!) compare this with Java to Java < 1 nano seconds. Big difference but nano seconds compared to network latencies of seconds
  • String functions to native code via JNI take > 3ms coz of UTF-16 to UTF-8 character conversion issues
  • JNI Multi-threading issues are solved by IPC bridge shared memory and TCP over loopback
  • JSVC Apache commons daemon for loading privileged data during Tomcat startup and then running in low privilege mode
  • Like Multi-process Apache, a new architecture for multi-process Tomcat being baked
  • Software project management using Maven (Maven — awww!)
  • Automatic builds using Cruise control and Hudson
  • RPM-based software deployment to 100s of nodes



Java Generics: Taking the fun away from writing code in Java

Friday, November 16th, 2007

Coding in Java was simple until Java 5 (or Java 1.5 — 1.5 is the developer version and Java 5 is the marketing version as Sun calls it!). Learning generics in Java 1.5 is like learning Microsoft COM programming, it would take at least 5 passes to absorb it right.

Look at this simple call, before generics

1 List myIntList = new LinkedList(); 
2 myIntList.add(new Integer(0)); 
3 Integer x = (Integer) myIntList.iterator().next(); 

How about now:

1 List<Integer> myIntList = new LinkedList<Integer>(); 
2 myIntList.add(new Integer(0)); 
3 Integer x = myIntList.iterator().next(); 

Here is the source snippet of java.util.Collection class from the 1.5 version. Makes me wipe the sweat.

1 public interface Collection<E> extends Iterable<E> {
2 <T> T[] toArray(T[] a);
3 boolean containsAll(Collection<?> c);
4 boolean addAll(Collection<? extends E> c);
5 Iterator<E> iterator();
6 }

Yeah, yeah. The fans of C++ would love it, it looks like the C++ templates, compile-time type checking, etc. — Well, programmers shall figure out other ways of making mistakes like working on a null object :D)
No way out, I need to learn it ‘coz 1.6 is already out and I was still hanging on to 1.4 till yesterday!

Open Source Java: What it means to an average Java developer

Tuesday, November 14th, 2006

Sun announced that Java is now Open Sourced. It’s business as usual to the rest of the 4m Java developers. All we (yeah!) care is when I write “java” on the command line, the new version of Java has all the required classes to complete that task.
What I fear from this open-sourcing is hundreds of forks doing their own thing and going the route of Unix and Linux. Choice is good, confusion is not — In the end, RedHat, SuSe, etc. are making money on the work done by 100s of open source developers. Although, proprietary forks are not possible due to GPL v2, what we can clearly see is that multiple options would lead to non-concentrated effort in VM optimization and future development. Will the Open Sourcing lead to incompatibilities? Only time will tell.
The biggest winner from this initiative would be availability of Java RPMs and packages for installation on Linux straight from vendors and community supported distros. Right now, it’s a pain installing Java on Debian.

J2SE5: Getting ready for the Tiger (Part II)

Sunday, July 18th, 2004

Continuing (Part I) with the remaining features of Tiger release of J2SE:

  • varargs–C-style argc, argv.No count though, argv is an implicit array when defined in the specified notation
  • Concurrency–Semaphores, thread locks, thread safe queues, et al. Dijkstra would be pleased. But, Java took close to 10 years to have these constructs
  • New Profiling API–Byte code instrumentation, native profiling
  • Desktop Client–New Ocean theme
  • java.xml–XML is now a core part of the standard edition

J2SE5: Getting ready for the Tiger (Part I)

Saturday, July 3rd, 2004

Java 2 Platform, Standard Edition (J2SE) version 1.5 (“Tiger”) is the next major revision to the Java platform and language; it is currently slated to contain 15 component JSRs with nearly 100 other significant updates developed through the Java Community Process (JCP).
New features:

  • Metadata–Annotation along side the classes, metadata within a class to generate helper files, documentation, deployment descriptors and even java code!
  • Generic Types– The Collection API can now hold non-Object objects.Anybody remembers templates in MFC?
  • Autoboxing and Auto-Unboxing of Primitive Types–Automatic conversion of primitive types to their object counterparts. Less coding!
  • Enumerated Types–public enum Fruit { mango, apple, orange }; 🙂
  • Static Import–Import static constants without inheriting

Rest of the features in Part II of this entry.

Kitty Hawk: SOA takes-off

Thursday, July 1st, 2004

Sun announces a new initiative to help people buy into Service-Oriented Architecture (SOA).
Find, assemble and deliver applications based on a services-oriented architecture using Java Web services. As part of Kitty Hawk, Java Enterprise System is intended to simplify administration, management, security, and provisioning of services in an SOA. For example, a Java Enterprise System registry will provide centralized control of services, versioning, metadata management, services registration, and lookup, according to Sun.
Featured components in Java Enterprise System are identity services, Web and application services, portal, communication and collaboration, availability services, and security.

JDesktop Network Components (JDNC):Java technology innovation on the desktop

Tuesday, June 29th, 2004

Sun announced the JDNC at 2004 JavaOne Conference.
via JDNC
The goal of the JDesktop Network Components (JDNC) project is to significantly reduce the effort and expertise required to build rich, data-centric, Java desktop clients for J2EE-based network services. These clients are representative of what enterprise developers typically build, such as SQL database frontends, forms-based workflow, data visualization applications, and the like.
JDNC leverages the power of J2SE and Swing while providing a higher level API, as well as an optional XML markup language, which enables common user-interface functionality to be constructed more quickly, without requiring extensive Swing or GUI programming skill. Additionally, JDNC simplifies the task of connecting a rich client to a J2EE backend, including JDBC and WebServices.
Recognizing the broad range of developer skill-sets and predilections, JDNC has been constructed in 3 distinct layers that can be used independently or together. These layers are reflected as JDNC sub-projects so that each can evolve at its own pace. From bottom to top:
Swing Extensions: APIs which extend Swing to provide key features required by data-centric applications (sorting, filtering, data-binding, asynchronous data-loading, etc); makes life easier for Swing developers. The APIs are defined in the org.jdesktop.swing package.
JDNC API: Higher level Swing based components that leverage the Swing Extensions, but provide a simplified JavaBeans API for common functions, provide attractive default visuals, usability features, and data-binding out of the box; usable by developers who may not know Swing. These component APIs are contained in the org.jdesktop.jdnc package.
JDNC Markup Language: A simple, extensible XML-based markup language that enables developers to configure JDNC based clients using XML and deploy them either as Java Web Start applications or as applets in a standard browser. The XML markup language is specified using a Schema (.xsd) and the tag library API used to implement the schema is defined in the org.jdesktop.jdnc.markup package.