Efficiency/GC problem with Runtime.exec()?
Hi,
I've noticed weird behavior with JDK1.1.7a (Suse 6.0) that I didn't see
with JDK 1.1.6: When doing the most basic system exec, and then reading
in the stdin, Java frequently hiccups, for a good second or two, usually
when garbage is collected.
I found this because I've written a port of GNU find to Java that is
cross-platform, but will detect when used on Linux or FreeBSD, and use
GNU tools if it can to speed things up. (
http://www.rule-of-eight.com/components/javafind ).
Here's a small class that demonstrates the problem by calling a command
that generates a lot of output. It doesn't hiccup as much as my Find
class does, but it still shows the effect:
---
import java.io.*;
class SystemTest {
public static void main(String[] args) throws IOException {
Process p = Runtime.getRuntime().exec("/usr/bin/find /usr");
BufferedReader in = new BufferedReader(
new InputStreamReader(
p.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
in.close();
}
}
---
- Robb
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Efficiency/GC problem with Runtime.exec()?
Chris Abbey wrote: > ...running 117_v1a, native, with the -verbosegc option I see that a quick run > on my "toy" system produced 137598 objects and 8000423 bytes worth of trash! > ... I would highly recommend that you > write your own readln method taking a char[] or a StringBuffer if you > _have_ to have an object and recycling a single object throughout the > operation. Just because gc is there doesn't mean we _have_ to use it ;) > Hi, Thanks - I really hadn't considered the fact that the call to readLine() may be creating a lot of throw-away objects, too. I just saw that my loop was creating one String object per iteration, so I thought, "That's not too bad." :) I'm still confused, though, by the output from -verbosegc. When I ran it, there was always a message at the same time as one of these 1-2 second pauses. Made it obvious that gc had something to do with this. But the gc messages claimed that the garbage collection took only a few milliseconds, while the perceptible pause was at least a full second. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: go back to gzip!
Peter Kovacs wrote: > jdk1.2pre-v1.tar.bz2 24457274 > jdk1.2pre-v1.tar.gz26062044 > > Means a 6.1% better compression rate. Is it really that much improvement? If it was >at least 15%... > Well, that looks like 1.6 MB per download. So, multiplied by the 500,000 downloads it'll get :), that's a lot of traffic that can be saved, esp. for a non-commercial provider. If bzip2 is "better", then we should use it for -everything-. It doesn't matter if it hurts a bit in the short run. As long as there's a new version coming of (say) tar that knows about it, and it makes sense, then it should be done. This, to me, is a BIG strength of the Linux world. Choices are made because of quality, and we go through sometimes painful changes because it's better in the long run. (I'm thinking of elf format, c library changes, etc.) In Dos/Windows, this rarely happens: they're tied to an old customer base that uses crap, and so new versions must also be crappy. - Robb PS: I put better in quotes, because I'm not so sure we can make a flat judgement like that: bzip has a higher compression rate, but it seems much slower than gzip. So, it may not be appropriate for all uses. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Just thinking about VM
Hi, Check out this page: "Programming Languages for the Java Virtual Machine" http://grunge.cs.tu-berlin.de/~tolk/vmlanguages.html See the "Lisp and co." section. Not exactly what you were talking about, but definitely interesting. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Non mofit AWT.
Hi, Is it me, or did the original question get kind of lost here. :) To me, the issue isn't so much whether AWT is great or not, or whether it should still be used... The problem is that at some point, Motif calls must be made from Java/Linux, and thus the motif library must be there. And, for me (like most people, I guess) that means that a huge statically linked VM must be used. This takes time and memory. I've actually thought about shelling out cash for motif just to be run Java programs better, but I don't know if most people would. Anyhow, it'd be cool if Java/LINUX could really be used on Linux without extra investment. (Just like Java can be used on other platforms w/out extra investment.) So the question is whether some runtime-license-free library could be used instead. Is this possible? Or, must the implementation use Motif? - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
-classpath "bug"
Hi, I know this is an old one, but I was wondering about the state of the "-classpath" annoyance that is there in Java/Linux 117a, and possibly in other Java versions, too. I mean the problem where the command line option has different behavior than the environment variable - namely, with the command line option you must specify the core java libraries, too. I saw something about this a while ago, but don't remember - anybody know what the state of this is? Is it acknowledged as a generic Java bug? Is it only a Linux problem? (I'm just editing for the nth time a startup script to avoid the annoying "cannot find class java/lang/Thread" error.) Thanks, Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: UGLY BUG parsing the date of "1999-04-30" in jdk 1.1.7 on Linux RH 5.2
Constantin Teodorescu wrote:
>
> sdf = new SimpleDateFormat("-MM-dd");
> sdf.setLenient(false);
> try {
> thedate = sdf.parse(s);
Hi,
I've gotten good results by using the SimpleDateFormat constructor with this signature:
SimpleDateFormat(String, Locale)
...You specifiy the locale (which contains the time zone) of the given date string.
This might
help avoid the problem. I was getting some strange results before I started doing
this, because
I'm writing and testing a program in Europe (GMT+1) that's getting deployed in
California
(PST). I can dig out the source code for this, if you like.
- Robb
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Anyone tried Teikade?
Hi, I just downloaded Teikade (The 1.x version that works with JDK 1.1), and I'm really impressed - it offers a real OO development environment - similar to Smalltalk's class browser. The source is there too, and I can imagine that it wouldn't be to hard to add in other stuff I'd like (BeanShell-type scripting, for example, and automatically generated method "protocols" for private, public, etc...) Anybody using this? - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Anyone tried Teikade?
Hamdi Mohd Yusof wrote: > Hi, > > No, I have never heard of Teikade before. Can you give me the link? > Sure - http://www.pfu.co.jp/teikade/ I've played with it for about 1.5 hours altogether. It's apparently a 100% Java IDE, that's -very- closely modelled on the Smalltalk environment. It automatically parses source code and presents it in the typical Smalltalk browser: you click on a package name, class name, and method name, and then you see just that one method. It also has options for compiling and executing. I got a huge Java class last night that I need to work on, and the environment helps a lot in understanding new code like that. The downsides I found are that the 1.x version uses AWT, and there seems to be an occaisonal bug in the Linux JDK where listboxes will start scrolling all by themselves (?) - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Sun Bashing 2
Hi, Interesting conversation. I vaguely disagree with your overall sentiment, but the following prodded me out of lurker state. :) Ken McNeil wrote: > > >Do you REALLY want to make Java into the horrible mess C++ is today? > > Okay, I will substantiate this... > > 1. In the spirit of Darwinism we could say that without competition Java is > likely to stagnate (like C++ did). By adding competition to the environment > that made C++ the mess you speak of would have been avoided. In fact Java is > simply competition to C++ that came a little to late to help it along. > I'm not sure what you're saying - I think you may be be mushing together two kinds of competition: (1) From within the same language, and (2) from other languages. And, I think there's been lots of both for C++ over time: the various vendors (type 1), and Powerbuilder, VB, Delphi... (type 2). > > 2. In the spirit of "The Cathedral and the Bazaar" without competition the > pace at which Java develops will be slower and will lead to a weaker product > in the end. > I see competition for Java all over the place - Python, Smalltalk, VB, ActiveX - maybe this isn't what you mean. > > 3. Competition does not necessarily imply that you will get a large amount > of little add-ons that will lead to a mess like C++. This happens when > technical choices are made in the market place not democratically. With an > open development environment you will see a hybrid of this market place vs. > democratic development process. > I really really wish this could be true, but it's hard to accept. Are there any precedents for this working? It seems to me that you've either got to totally open development (like Python or Perl), or go the other route and totally control it. I don't really care as long as the thing works. (Maybe Python is what you're after...) > > ___ > Get Free Email and Do More On The Web. Visit http://www.msn.com ^ Yikes! - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Thin client Java apps
Hi,
More details would be needed about your exact application / problem domain, but I've
done exactly what you're describing, and here's one combination of pieces you can put
together to do it: (In other words, there's MANY ways to make a multi application -
here's one way I've seen it work.)
BACKEND: MS Access. Easy to modify and manage, like you've probably found. You'll run
into problems using it as an "enterprise" database, but the n-tier architecture will
let you swap it out when the time comes.
MIDDLETIER: A Java application that makes its services available via RMI or CORBA (or
Voyager, or HORB...) . It runs on Linux, and connects to MS Access on the Windows box
with the "RmiJdbc" driver:
http://dyade.inrialpes.fr/mediation/download/RmiJdbc/RmiJdbc.html
...So, it'll actually be making RMI connections in two directions: to the backend
database, and then also to the clients. This middletier has the responsibility of
hiding your relational database schema from clients. It also contains "Business Logic"
that would be common to all UI's.You make Objects accessible that support your
application's "use cases". For example, you might have a "UserManager" object that
returns a User object given an id. It has a nice OO interface, while internally using
JDBC to the database:
public User getUser(int id) {
query.execute("SELECT from Users WHERE id="+id+");
}
CLIENT: With the n-tier architecture you can now support two types of clients - First,
you can write applets that connect directly to the middle tier via the network
protocol. For users who don't/can't use a Java 1.1 browser, you can make a second set
of clients with servlets. These servlets are clients of the middletier, but present
all of the UI in HTML, which gets sent to the user.
-
Problems with this:
MS Access: It's not really meant to be a server. It doesn't support transactions.
RmiJdbc: It's about 10% as fast as a JDBC driver for a real database.
But, this isn't a big deal. You can write the program now as a proof of concept. And
then, when it gets bigger, you can use a different database, and then the best JDBC
driver for it.
- Robb
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Ability to reload class files
Steve Byrne wrote: > Apache's mod_jserv does this, and the code is small enough to be easily > comprehensible. > I just recently looked over this code, and it is interesting, but I don't think it quite does what's described: As far as I understand it: - They have a ClassLoader implementation that can report if a *directly* loaded class file has been changed. - Before running a servlet, jserv asks the class loader if there's been a change to any of its classes. - If yes, it throws away the current class loader, and instantiates a brand new one. By default, this causes instances belonging to the old loader to also be trashed. AFAIK, this only detects changes in directly loaded classes, but not transitively loaded ones. So, this is kind of interesting... I was wondering what it'd be like to combine this with an IDE to be able to better adapt to changes. Not sure how applicable it is. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: [off-topic] stop MS bashing please (was: Re: -Xrunhprof:cpu=times)
Hi, I find this hard to understand. Louis-David Mitterrand wrote: > MS is dominant on the desktop and consumer OS for now simply because its > competition has been so lame and disorganized. Sure, I think that MS has some decent software. Encarta is great. BUT, you just can't ignore MS's predatory tactics. After learning to program on a TRS-80 and C-64, I did MS programming, because it was fun, and that's what there was. But over time, you just get sick of MS putting marketing before quality and the needs of the consumer. I got into Java because it was wonderful having a nice OO language, and cross-platform dev. I became viruently anti-MS as I saw how they did what they could to stop and kill Java. Other examples abound: Here's a puzzler: Why do you need to install IE if you want to use MS's XML parser? A VB programmer on Usenet wanted to know, because he was now in the position of forcing his customers to install IE, even though they didn't want/need it. This is system design 101: the separation of logic from presentation. I wrote to the XML project manager and asked if this could possibly be true. Yes, it is. And no; they don't reall know what they'll do about this "problem". To me, the marketing strategy is clear. As we've seen a 1000 times before, here's another way they're using one part of their system to leverage in other pieces. And, it also shows them getting away with putting marketing before quality. Something you wouldn't see in a well functioning market. >...Sun is no better than MS > when it comes to locking-in customers and racketting them with upgrade > "taxes". Only they're less successful at it. Please show us receipts from having paid "Java Taxes". You're getting a great language and OO development system for free. And, the fact that you DECIDED to use it tells me that you find it to have some kind of substance. This is how the market should work. I hope my tone hasn't been too much on the attack here, because of course it is true that with a huge company like MS, some good stuff has to come out of it. But, you have to have noticed how quality and competition have suffered over the last 10 years. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: [off-topic] stop MS bashing please (was: Re: -Xrunhprof:cpu=times)
Charles Forsythe wrote: > > > If MS were so powerful > > and monopolistic they would have killed Linux somehow. > > How? It has no parent company to drive out of business... Yeah, I also found this claim to be suspicious. To say: L: Linux Exists Therefore: M: MS is not powerful and monopolistic ...is really just over-simplifying a million factors. Not the least of which is that Linux is just a one- or two-year old phenomenon, as far as the press and industry is concerned. And, don't forget that Linux is still in the domain of hackers and know-it-alls. Right now, we're just crossing over the border into the area of respectable server territory, and really hitting mom-and-pop users is going to take a bit longer... And of course, this ignores the entire OpenSource issue. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
An idea for Java / KDE or GNOME integration
Hi, I had this idea, and would like to get comments - if it's cool, or dumb - whatever: I want to have my Java programs better integrated or "aware" of my KDE desktop. And vice-versa. I don't need the equivalent of the Python-KDE binding: This package does two things: it gives access to desktop-system features, as well as graphics widgets. I just want access to system features. I'm thinking of the services that the "KApplication" class gives KDE apps: Notification when the system is getting shut down, for instance. Or, the generation of temp file names. I first thought about making a binding like the Python-KDE package but then decided against it. I also don't want to access native code from Java. Too messy and system dependent. My idea is to use CORBA: Have a server that creates KApplication server objects. The Java programs then connect to a KApplication server instance and also register themselves for callbacks. There'd probably be a small applet-like framework that Java app writers would use that would hook their program into this setup. The system could also use something like Echnida to launch Java apps quickly. Now, once this basic idea is implemented, the CORBA/IDL solution offers extreme flexibility. For example, there's no reason that a GNOME server couldn't be written that creates the GNOME equiv of KApplication (whatever that may be...). It would serve the same IDL, and all the Java apps would work with it too. The same could even be done for MS Windows. AND, this can go the other way: Programming environments like Squeak Smalltalk can be adapter to fit into the client-side of the framework. So, what this system would really become is a "VM-driven language to desktop integrator". Comments? - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Has Sun Overstretch Themselves With So Many APIs?
LAIKOK wrote: > > Is that So ? I guess you haven't Push the Swing API > its limit. Do you mean, maybe, pushing the Swing *implementation* to its limit? An API is a description of services offered by a package, not an actual package itself. FWIW, I think Sun's strategy is good. They're taking a forward-thinking approach by making API's in key areas that are important for the "new" way of computing: JCA/JCE, multimedia, etc. Many companies would simply provide implementations of algorithms that you either have to use or not. Sun's API's though, have a nice amount of abstraction that gives plenty of room for 3rd parties to jump in as "providers", while keeping compatibility. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
JNI/Linux pointers?
Hi, Does anybody have any pointers to using JNI on Linux? I'm starting a project where I'll be hacking pine to access a running Java process. Thanks! - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: [Off-topic] Drag-n-drop applet?
Hi, IBM has a set of Java Beans that enable drag and drop for Java 1.1. I'm checking it out right now to see if it'll work in an applet: http://www.alphaworks.ibm.com/ab.nsf/jbName/E4F2891D1D606E208525674C00682447 - Robb
A suggestion and a glibc question.
Hi, Question: I've got Suse 6.0, and don't know how to figure out what glibc version I have, and thus what version to download. I tried doing a "locate glibc", and also "rpm -qa | grep glibc", and didn't find anything useful. So, I really have two questions: 1) How to find this out, and 2) What does Suse 6.0 use? Suggestion: I bet that these questions (and lots like it) have been asked and answered on this list lots of times. I can see though, that lots of the official Java/Linux information suffers from the typical web problem that a restricted set of people must edit a growing list of interlinked documents: The docs don't take many detailed issues into account, and always have a certain number of broken "links". I'd say we set up a "Wiki" to deal with Java/Linux issues. We just let the thing grow on its own. If anyone has any info or experience reports to offer, they just put it out there. With a little care here and there, a rough organization can develop. I've got some experience running "Swikis"; the Squeak wiki port. I can add another on easily on my Linux box. I've wanted an excuse, though, to install Ward's wiki system. Comments? (Does something like this already exist?) - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Create an Image without using AWT
Nathan Meyers wrote: > > It's a "feature" of the AWT. This is really a "feature" of Java/X, or Java/Linux, isn't it? I don't think that this is a problem on NT. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Swing version w/ 1.2 pre-2?
Hi, I've been doing 1.1 programming with Swing 1.1.1 beta2, and now am upgrading to Swing 1.2. I've noticed, though, that some of Swing's newer features aren't there - so moving to 1.2 is actually a "downgrade" as far as Swing is concerned. The feature that I was using is the ability to use HTML for text in components. Anyone know about this, and when it'll get resolved? Thanks, Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Benchmark results for Linux JVMs (formatted for 70 columns)
Interesting comments. > >benchmark execution was repeated ten times. We discarded the maximum > >and minimum results, and averaged the remaining 8 execution times. > > very good methodology... sure wish more people would do that. Yes - it sounds like a nice mix between "median" and "mean". Mean, on its own, is not a good measure of central tendency. Maybe the "professionals" who do benchmarks should take a typical university experimental methodology course. I don't think I've ever seen a benchmark say that results are "statistically insignificant". (Not talking about the original poster here.) Personally, I'd be interested to see info about non-Blackdown free JVMs. We don't hear too much about them on this list. That would have been an interesting comparison. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
To use Sniff+... Re: Version for GlibC
Peter Pilgrim wrote: > > Could you print this glibc version info on the shrinked wrapped boxes > for SuSE 6.3 and for all forthcoming SuSEs. Hi - while on the topic of Suse, Java and glibc versions, [ob java+linux] I want to check out this "Java/Web" version of Sniff+, and have a Suse 6.0 system. [/ob java+linux] I can't, though, because I don't have glibc 2.1. Is there a document on Suse's Site, or anywhere else, that explains how to quickly add the glibc 2.1 libraries --just for the purposes of running a dynamically linked application--? I browsed through the www.suse.de site, and couldn't find anything. There's several (complex) instructions elsewhere on the web about this (ie. glibc 2 howto), but they're geared for people doing glibc development. They usually start with "Extract the source distribution...". I'd think that I shouldn't have to do that! Thanks for any help, Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Sun and Inprise Java 2 announcement
Paolo Ciccone wrote: > ... this version > includes JPDA and several Swing bugs that we found ... Do you mean "bug fixes?" -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
Re: Blackdown JDK vs Sun/Inprise
Brian Pomerantz wrote: > It is a solution to the problem, though. The Sun JDK doesn't have > that problem with JBuilder. I also found it to be more responsive > running JBuilder than the Blackdown JDK is. Speaking of advantages to the Sun/Inprise JDK, anybody know about how it handles older or multiple versions of glibc? The various executables that require certain glibc versions is a huge pain for people with distro's like Suse... Anybody know if the JDK comes with its own copies of shared libraries that it uses if not present in the system? This should be possible, shouldn't it? I'd love to use the new JDK (any of them!), but I can't upgrade my system right now. - Robb -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]
