The Artima Developer Community
Sponsored Link

Java Buzz Forum
Ant Is Not a Shell, ClassLoaders Are Not Processes

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Weiqi Gao

Posts: 1808
Nickname: weiqigao
Registered: Jun, 2003

Weiqi Gao is a Java programmer.
Ant Is Not a Shell, ClassLoaders Are Not Processes Posted: Aug 27, 2004 6:18 AM
Reply to this message Reply

This post originated from an RSS feed registered with Java Buzz by Weiqi Gao.
Original Post: Ant Is Not a Shell, ClassLoaders Are Not Processes
Feed Title: Weiqi Gao's Weblog
Feed URL: http://www.weiqigao.com/blog/rss.xml
Feed Description: Sharing My Experience...
Latest Java Buzz Posts
Latest Java Buzz Posts by Weiqi Gao
Latest Posts From Weiqi Gao's Weblog

Advertisement

Coming off Java for a little while after six years of immersion offered me an opportunity to look at Java from a different perspective. In particular, I got to look at some of Java's deficiencies from a non-defensive perspective.

Take this post: Static: friend or foe?, for example. Cedric pointed out that the java task in Ant, if not "fork"ed, leaves the invoked classes loaded and any of their one time (static) initializations done. Thus if two non-forked java tasks are run in the same Ant invocation, the first can affect the second in surprising ways.

His advice, avoid static variables as a rule of thumb, though good in intention, and sound in principle, does not address the root of the problem:

Ant is not a shell. It a build tool with its own wrinkles.

Now take a look at a proposed remedy for the problem. It essentially want Ant to use a different classloader for each non-forked java task. This will fix the symptom in Cedric's example, but it doesn't go far enough. For example, classes loaded by other tasks (including custom tasks) would still be loaded and initialized.

The problem with ClassLoaders is this:

ClassLoaders are not processes. It a (square) reinvention of the process wheel.

For all the ClassLoader fans out there, here's a question for you: How do you do ICC (inter-classloader communication)?

Read: Ant Is Not a Shell, ClassLoaders Are Not Processes

Topic: Bad Bosses, Grocery Tech, Software is Like... Previous Topic   Next Topic Topic: Migrated from SnipSnap

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use