comp.lang.java.programmer
http://groups-beta.google.com/group/comp.lang.java.programmer
[EMAIL PROTECTED]

Today's topics:

* Tomcat and classloaders - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d1677b8e903332e
* J2ME Regular Expressions - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e182702e3f20a35
* how go load VM parameters programmatically? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c0538ad702b444ed
* How to compare Ant and Maven? - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/17aee95b856a64d3
* java.net.URI.equals() - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/13482983512ae419
* Indefinite for loop syntax question - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6fb2ebeb7cfb92a9
* Imagero Reader 1.6.0 - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32d176d8af63b989
* nested locks - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e57863f17acef231
* Extracting text data from MS Word document - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/adadc7b9250f0fb1
* Servlet serialization - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d55088e393f71298
* Thread synchronization - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
* Multiple JVMs; specifying the runtime lib - 3 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a0514c6cbf4dc13a
* Test my J2ME MIDP 2.0 game: Taleban vs. Robot - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d33c48591b2afae1
* finally with no try/catch? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/316672728452e3f
* java.util.zip - problem opening some legitimite me zip files - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32006c0dd622b47b
* Could it be too bad to implement it as a tag? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7be6c3a08e023f28
* EJB - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d10a655890884de
* cmsg cancel <[EMAIL PROTECTED]> ignore - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/63219b49f732325e
* Zipping without a file - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d97c18b4cd4dd37b
* Problem reading from nio socketchannels into a bytebuffer - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d8b57d1c9857a5b2
  
==========================================================================
TOPIC: Tomcat and classloaders
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d1677b8e903332e
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 16 2004 2:10 am
From: [EMAIL PROTECTED] (Erik Berglund) 

Babu Kalakrishnan <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Erik Berglund wrote:
> > 
> > I do not know if this is correct forum but I could not find any "free"
> > tomcat forum right now. So:
> > 
> > I have a problem using Tomcat (version 4.1.30) in an environment where
> > we have configured it with about 10 different hosts (used together
> > with virtual hosts in Apache webserver ). Theses hosts are different
> > web applications used by different countries with different time
> > zones.
> > 
> > The problem is when setting the default java.util.TimeZone in one web
> > application it will also affect another web application under a
> > completely different host.
> > 
> > I guess this is beacause core java classes are shared among all
> > defined hosts and just loaded once. Is this correct ? Is it in any way
> > possible to configure Tomcat so that each host can have its own
> > default TimeZone?
> > 
> 
> I would say depending on Objects that use the Default Locale / Timezone values 
> isn't a very robust design anyway for an application meant to cater to varying 
> Locales. As far as I can think, most (all?) classes that need Locale / Timezone 
> information for proper functioning (like character I/O, Calendars etc) have 
> constructors that allow you to specify a specific non-default value for these 
> and applications such as yours must use those and must never be dependent on
> setting the system defaults.
> 
> BK

Thanks for your hint.
But that do not solve my problem right now. To clarify: each
application does not deal with different time zones. For example:
Lithuania has its own application hosted on one host and Sweden has
its own application hosted on another host. Why do they not get
different default time zones ? Is it not possible to have each host
running in its own process (virtual machine) ? Earlier we used
WebSphere to host all these countrie's applications (but that was not
as quick as Tomcat and of course more expensive) and I do not remember
having this problem.

Regards
Erik



== 2 of 2 ==
Date:   Thurs,   Sep 16 2004 4:40 am
From: Babu Kalakrishnan <[EMAIL PROTECTED]> 

Erik Berglund wrote:
> 
> But that do not solve my problem right now. To clarify: each
> application does not deal with different time zones. For example:
> Lithuania has its own application hosted on one host and Sweden has
> its own application hosted on another host. Why do they not get
> different default time zones ? Is it not possible to have each host
> running in its own process (virtual machine) ? Earlier we used
> WebSphere to host all these countrie's applications (but that was not
> as quick as Tomcat and of course more expensive) and I do not remember
> having this problem.
> 

By "host" do you mean different physical computers or a different 
webapp running under the same Tomcat instance ?

If it is the former, I would expect them to be running under different 
JVMs and you should be able to setup each one by calling the 
TimeZone.setDefault(TimeZone) method (I'm not sure if there is a 
system property that defines this which would make it easier to 
provide the value on the commandline).

If they are different webapps running under the same Tomcat instance, 
I'm not very sure if Tomcat provides a way for core library classes to 
be loaded from a different classloader. As far as I can recall, only 
external libraries found in the WEB-INF/lib directory or classes found 
in the WEB-INF/classes directory are loaded by the Context classloader 
in preference to an already existing class in the parent (system) 
classloader.

In such a scenario, the only workaround that I can see is to run 
multiple instances of Tomcat (and bind them to different AJP connector 
ports if they are on the same physical machine) so that each process 
runs under its own private JVM (might be pretty resource intensive if 
done on a single machine)

BK




==========================================================================
TOPIC: J2ME Regular Expressions
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6e182702e3f20a35
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 16 2004 2:11 am
From: [EMAIL PROTECTED] (Olivier Laurent) 

Hi all,

I would like to use regular expressions for a J2ME application. The
regex package isn't include in J2ME. Has anybody ever studied an
alternative?

Olivier



== 2 of 3 ==
Date:   Thurs,   Sep 16 2004 3:44 am
From: bugbear <[EMAIL PROTECTED]> 

Olivier Laurent wrote:
> Hi all,
> 
> I would like to use regular expressions for a J2ME application. The
> regex package isn't include in J2ME. Has anybody ever studied an
> alternative?

Did you even try a quick google before posting?
e.g.

"regular expression" package java

     BugBear



== 3 of 3 ==
Date:   Thurs,   Sep 16 2004 4:42 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Thu, 16 Sep 2004 11:44:17 +0100, bugbear wrote:
> Olivier Laurent wrote:

>> I would like to use regular expressions for a J2ME application. The
>> regex package isn't include in J2ME. Has anybody ever studied an
>> alternative?
..
> "regular expression" package java

..hmmm.  Those 42,900 hits look interesting,
but I think these 798 might be more topical
<http://www.google.com/search?q=%22regular+expression%22+package+j2me>

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane




==========================================================================
TOPIC: how go load VM parameters programmatically?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/c0538ad702b444ed
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 16 2004 2:33 am
From: [EMAIL PROTECTED] (Andre Anneck) 

[EMAIL PROTECTED] (robert walker) wrote in message news:<[EMAIL PROTECTED]>...
> hi all, i downloaded a systray tool for java
> and the only api they give specifies
> 
> running the app   with      -Djava.dll=c:\xyz
> 
> where the   c:\xyz    is where the   dll is that 
> enables java system tray icon to   work
> 
> If I cannot start the app with a -D  (starting via java web start)
> is there a way  I  set the 
> java.dll vm parameter to my dll file location  programatically
> 
> thanks all

You can do that in your JAVA_OPTS environment variable. Depending on
your OS you will have differnt syntax of course. See Java Environment
Variables on google ;)

Take care ,

André



== 2 of 2 ==
Date:   Thurs,   Sep 16 2004 2:56 am
From: Manfred Rosenboom <[EMAIL PROTECTED]> 

Why don't you add the DLL to your WebStart environment ?

Best,
Manfred




==========================================================================
TOPIC: How to compare Ant and Maven?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/17aee95b856a64d3
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 16 2004 2:48 am
From: [EMAIL PROTECTED] (Earth) 

Hi all,

I have noted that Apache provides a build tool, namely Maven.

I have been using ANT for more than year. Just wonder how to compare
Maven and Ant from a developer point of view?

What is your comments?

Thanks in advance for any inputs or ideas.

Eclifeww



== 2 of 2 ==
Date:   Thurs,   Sep 16 2004 7:28 am
From: Bryce <[EMAIL PROTECTED]> 

On 16 Sep 2004 02:48:10 -0700, [EMAIL PROTECTED] (Earth) wrote:

>Hi all,
>
>I have noted that Apache provides a build tool, namely Maven.
>
>I have been using ANT for more than year. Just wonder how to compare
>Maven and Ant from a developer point of view?

Maven is built on top of Ant. 

Maven helps manage dependencies among projects. In Maven, all you do
is define your project in a file called project.xml, and Maven does
most of the rest.

Build your projects, jar them, deploy them, even build a project
website for you.

--
now with more cowbell




==========================================================================
TOPIC: java.net.URI.equals()
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/13482983512ae419
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 3:00 am
From: Daniel Bonniot <[EMAIL PROTECTED]> 

Peter Davis wrote:
> I'm trying to figure something out -- java.net.URI.equals() makes no 
> sense the way it is specified:
> 
>     "When testing the user-information, path, query, fragment, 
> authority,  or scheme-specific parts of two URIs for equality, the raw 
> forms rather than the encoded forms of these components are compared and 
> the  hexadecimal digits of escaped octets are compared without regard 
> to  case."
> 
> First of all, is that a typo?  I think it's trying to say "the raw forms 
> rather than the /decoded/ forms...".  

Unless by raw they mean "decoded". But the implementation does not seem to 
match that.

> Aside from that, the problem is 
> that it would make sense if two URIs with encoded or unencoded versions 
> of the same characters should be equal, but they're not.  I wrote a 
> little test class:
> 
> import java.net.*;
> 
> class Test {
>        public static void main(String[] args) throws Throwable {
>                URI u1 = new URI("foo%7Ebar");
>                URI u2 = new URI("foo%7ebar");
>                URI u3 = new URI("foo~bar");
> 
>                System.out.println(u1 + " == " + u2 + " => " + 
> u1.equals(u2));
>                System.out.println(u1 + " == " + u3 + " => " + 
> u1.equals(u3));
>                System.out.println(u2 + " == " + u3 + " => " + 
> u2.equals(u3));
>        }
> }
> 
> Outputs:
> 
> foo%7Ebar == foo%7ebar => true
> foo%7Ebar == foo~bar => false
> foo%7ebar ==foo~bar => false
> 
> Why in the world would it compare the raw rather than decoded forms of 
> the URI?  Anybody have any clues?

Not a direct answer, but what should happen when non-ascii characters occur, 
(directly or in encoded form)? For instance, is %E1 equal to á (like it does 
in some latin-? encodings).

Daniel
--
The Nice programming language: http://nice.sf.net




==========================================================================
TOPIC: Indefinite for loop syntax question
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6fb2ebeb7cfb92a9
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 4:06 am
From: Nigel Wade <[EMAIL PROTECTED]> 

Jenny wrote:

> Hi,
> 
> I read somewhere that a for loop can have a form for ( ; ; ){...}.  I
> try to understand the code below.
> 
> 1. Could you tell me why after j becomes 1, it jump to line a?

I presume that, by "jump to line a" you are running the code in a debugger
and single stepping through to watch the execution - otherwise it doesn't
make much sense.

The reason it "jumps to line a" is that you've appended the closing brace
for the if block at the end of "line a", so when the debugger skips the
block and places the cursor on the closing brace it actually shows it as
being "line a".

> 2. Could you tell me why after line a, it jump to line int j =0;?

If you mean "if it was on line a, why didn't it execute the break", that's
because it was on the terminating brace of the if, not the break. The loop
continues on the first line of the loop.

> 3. How could one use for ( ; ; ){...} in a real app?

I never would.

>   
> public class Ball {
>       public static void main(String[] args){
>       int k;
>         k=1;
>         for ( ; ; ){
>           int j =0;      
>           j++;
>           if (j>1){
>                   System.out.println("j is " + j);
>                   break;}   //line a
>         }
>       }}

-- 
Nigel Wade, System Administrator, Space Plasma Physics Group,
            University of Leicester, Leicester, LE1 7RH, UK 
E-mail :    [EMAIL PROTECTED] 
Phone :     +44 (0)116 2523548, Fax : +44 (0)116 2523555




==========================================================================
TOPIC: Imagero Reader 1.6.0
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32d176d8af63b989
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 16 2004 4:18 am
From: "Andrei Kouznetsov" <[EMAIL PROTECTED]> 


ImageroReader is in Java written library for reading of image files.
Supported file types are:
BMP, GIF, TIFF, PNG, JNG, MNG, JPEG, PSD, PBM, PGM, PPM.

Supported RAW files (basic support - full resolution image can't be yet
read, but thumbnails, previews and some metadata):
CRW, NEF, DCR

ImageroReader can also read thumbnails and metadata (IPTC, EXIF and XMP)
from those formats and THM files.
ImageroReader works with java1.1 and later.
ImageroReader defines simple Interface ImageReader to read image files.

ImageReader interface allows to get image width and height, image count
contained in file, define area to read, add ProgressListener and choose
image channel to read.

ImageroReader is free for non-commercial use.


What's new in 1.6.0:
    Fast and high quality scaling capability was added.
    Bug fixes.

Download ImageroReader 1.6.0 at http://reader.imagero.com/download/

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader








== 2 of 3 ==
Date:   Thurs,   Sep 16 2004 6:55 am
From: Mark Wright <[EMAIL PROTECTED]> 

One joyful day (Thu, 16 Sep 2004 13:18:28 +0200 to be precise), "Andrei
Kouznetsov" <[EMAIL PROTECTED]> decided that the Usenet community
would benefit from this remarkable comment:

>ImageroReader is in Java written library for reading of image files.
>Supported file types are:
>BMP, GIF, TIFF, PNG, JNG, MNG, JPEG, PSD, PBM, PGM, PPM.

Didn't somebody lay claim to the gif format? AFAIK you can't distribute
software which encodes/decodes gifs without a license. 

Mark Wright
- [EMAIL PROTECTED]

================Today's Thought====================
"In places where books are burned, one day,
 people will be burned" - Heinrich Heine, Germany -
  100 years later, Hitler proved him right
===================================================



== 3 of 3 ==
Date:   Thurs,   Sep 16 2004 7:25 am
From: "Andrei Kouznetsov" <[EMAIL PROTECTED]> 

"Mark Wright" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> One joyful day (Thu, 16 Sep 2004 13:18:28 +0200 to be precise), "Andrei
> Kouznetsov" <[EMAIL PROTECTED]> decided that the Usenet community
> would benefit from this remarkable comment:
>
> >ImageroReader is in Java written library for reading of image files.
> >Supported file types are:
> >BMP, GIF, TIFF, PNG, JNG, MNG, JPEG, PSD, PBM, PGM, PPM.
>
> Didn't somebody lay claim to the gif format? AFAIK you can't distribute
> software which encodes/decodes gifs without a license.

if you mean LZW patent - see http://lpf.ai.mit.edu/Patents/Gif/Gif.html

"The United States LZW patent expired on June 20th, 2003.. According to
Unisys, the counterpart Canadian patent expires July 7, 2004, the
counterpart patents in the United Kingdom, France, Germany and Italy expire
June 18, 2004, and the Japanese counterpart patents expire June 20, 2004."

If you would read License you could find that I used SUNs implementation of
LZW-decoder.
This implementation is under BSD license!

-- 
Andrei Kouznetsov
http://uio.dev.java.net Unified I/O for Java
http://reader.imagero.com Java image reader






==========================================================================
TOPIC: nested locks
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/e57863f17acef231
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 16 2004 6:12 am
From: "VisionSet" <[EMAIL PROTECTED]> 

I'm aware that nesting synchronisation blocks is generally a bad idea.
Is this just due to the ease of deadlock?

Does this advice apply to implicit inner locks eg

Set mySyncedSet = Collections.synchronizedSet(new HashSet());
...
synchronized(this) {

    mySyncedSet.add(anObj);

}

I guess in this case it would be fine because the Set is not going to hold
any locks for long.
I suppose the only problem would be if the inner lock does a loop on wait()
or blocks on I/O.
But the Javadoc(umentation) is not enforced in this area, it is not always
apparant if a method is synced or not, let alone the details of the objects
blocking.
Any guidelines available in this case?

-- 
Mike W





== 2 of 2 ==
Date:   Thurs,   Sep 16 2004 6:46 am
From: Rogan Dawes <[EMAIL PROTECTED]> 

VisionSet wrote:

> I'm aware that nesting synchronisation blocks is generally a bad idea.
> Is this just due to the ease of deadlock?
> 
> Does this advice apply to implicit inner locks eg
> 
> Set mySyncedSet = Collections.synchronizedSet(new HashSet());
> ...
> synchronized(this) {
> 
>     mySyncedSet.add(anObj);
> 
> }
> 
> I guess in this case it would be fine because the Set is not going to hold
> any locks for long.
> I suppose the only problem would be if the inner lock does a loop on wait()
> or blocks on I/O.
> But the Javadoc(umentation) is not enforced in this area, it is not always
> apparant if a method is synced or not, let alone the details of the objects
> blocking.
> Any guidelines available in this case?

My understanding is that the risks of nesting locks is that you could 
deadlock, as you suggest. The other possibility is the added overhead 
involved in actually synchronizing. If you can synchronize once, rather 
than multiple times, that might be a better approach.

What I mean is, perhaps you don't need to make your set a 
synchronizedSet, if accesses to the set are already done in synchronized 
blocks . . .

Rogan
-- 
Rogan Dawes

*ALL* messages to [EMAIL PROTECTED] will be dropped, and added
to my blacklist. Please respond to "nntp AT dawes DOT za DOT net"




==========================================================================
TOPIC: Extracting text data from MS Word document
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/adadc7b9250f0fb1
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 6:14 am
From: [EMAIL PROTECTED] (Max) 

unfortunately this approach doesn't fit ...

I cannot make users to save documents in some specific formats ...
The Big Idea is that 
1. user works with preferred document format (MS Word)
2. sends it in a System
3. System extracts text data from it and process it as necessary ...

any other ideas?
:)


Paul Lutus <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> Ann wrote:
> 
> / ...
> 
> > If you have control, save the word document in RTF format
> > which is mostly text.
> 
> Not really. Look at one sometime in a plain-text editor.
> 
> > Then just read it as any other text file. 
> 
> If the intent is to read it "as any other text file", why not save it as any
> othre text file? Word does that too. If instead it is saved as RTF, it
> should be read as RTF, which Java can do with some limited success.




==========================================================================
TOPIC: Servlet serialization
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d55088e393f71298
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 5:54 am
From: "William Brogden" <[EMAIL PROTECTED]> 

On 15 Sep 2004 11:42:27 -0700, Martin <[EMAIL PROTECTED]> wrote:

> [EMAIL PROTECTED] (Martin) wrote in message  
> news:<[EMAIL PROTECTED]>...
>> I have my servlet deployed on Tomcat. Every 2 hours context is
>> refreshed and my servlet restarted. I dont want to lose servlet data,
>> so i serialize it to file. Should i serialize servlet in public void
>> destroy() method or is there some other way? i tried it
>> locally(JBuilderX) and it didnt work. Data wasnt serialized when i
>> terminated servlet...
>
> I implemented serialization and it works, but only locally, when i
> deploy it to on my web(server Tomcat 4), it doesnt write at all. Web
> service cannot help me.
>
>
>
> <code>
> public void destroy()
> {
>  // player list serialization
>       try
>       {
>         ObjectOutput out = new ObjectOutputStream(new
> FileOutputStream(
>             "Players.dat"));

There is one problem right away. You don't specify a
path so it is going to write to the "current" directory,
something you have no control over.
Typically people either use the init parameters to
define a storage path or use ServletContext to get
a path.





>         try
>         {
>           out.writeObject(players);
>         }
>         catch (IOException e)
>         {
>           System.err.println("Error writing to file");
>                }
>       }
>       catch (IOException exc)
>       {
>         System.err.println("Error creating file");
> }
>
> </code>
>
>
> Any suggestions?



-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/




==========================================================================
TOPIC: Thread synchronization
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/172837b7b0667fd1
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 6:27 am
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

xarax coughed up:
> "Babu Kalakrishnan" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
>> xarax wrote:
>>>
>>> public class MyArrayList
>>> extends ArrayList
>>> {
>>>     public Fubar[] getFubars()
>>>     {
>>>         Fubar[] result;
>>>
>>>         synchronized(this)
>>>         {
>>>             final int kk;
>>>
>>>             kk = size();
>>>             result = new Fubar[kk];
>>>             toArray(result);
>>>         }
>>>         return result;
>>>     }
>>> }
>>>
>>
>> Two points :
>>
>> a) This code isn't threadsafe (unless the class you're extending is
>> a Vector). If another thread calls add() on a MyArrayList instance
>> between the size() call and the toArray() call, "result" will no
>> longer contain the data from the list.
>>
>> b) The Collections framework is one of the rare cases in the Java
>> library where synchronization behaviour of classes is reasonally
>> well defined and documented. As for other complex objects (like say
>> GUI classes, Threads, java.io classes etc) there is precious little
>> documentation available on whether the superclass ever executes a
>> method / block with synchronization on the "this" object at all. So
>> when discussing about the general advisability of synchronizing on
>> "this", an ArrayList or a Vector would be a bad example to use.
>
> Yes, you would have to override the other methods
> and make them synchronized. But that was not my
> point. The point was to encapsulate a series of
> operations into one method, so that the method
> can handle the threadsafety issues, rather than
> the client.

Override /all/ of the accessor/mutator's and methods with similar side
effects?  Unless there is a protected/public common subroutine to all of
them, IMHO you've now created a technique that is adding more potential
instability than you were trying to avoid in the first place.

Interestingly (to me at least) there /are/ inner classes called, for one
example, Collections.SynchronizedCollection, etc.  But it is declared with
package scope, so you cannot extend it.


-- 
Framsticks.  3D Artificial Life evolution.  You can see the creatures
that evolve and how they interact, hunt, swim, etc. (Unaffiliated with
me). http://www.frams.alife.pl/






==========================================================================
TOPIC: Multiple JVMs; specifying the runtime lib
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/a0514c6cbf4dc13a
==========================================================================

== 1 of 3 ==
Date:   Thurs,   Sep 16 2004 6:35 am
From: [EMAIL PROTECTED] (Scott Edward Skinner) 

I thought JWS was for client-side stuff like Applets. I'm talking
about multiple JVMs for QA--server-side stuff.

Is there a list of undocumented parameters beyond what "java -help"
provides?

-S


Andrew Thompson <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> On 15 Sep 2004 10:18:32 -0700, Scott Edward Skinner wrote:
> 
> > In general, what is the best way to handle multiple JVMs?
> 
> Java Webstart.



== 2 of 3 ==
Date:   Thurs,   Sep 16 2004 7:34 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 16 Sep 2004 06:35:54 -0700, Scott Edward Skinner wrote:

Please don't top-post Edward, I find it most confusing..
<http://www.physci.org/codes/javafaq.jsp#netiquette>

See further comments in-line.

> Andrew Thompson <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
>> On 15 Sep 2004 10:18:32 -0700, Scott Edward Skinner wrote:
>> 
>>> In general, what is the best way to handle multiple JVMs?
>> 
>> Java Webstart.
..
>  thought JWS was for client-side stuff like Applets. 

or applications.

>..I'm talking
> about multiple JVMs for QA..

Question and Answer?  
What has that to do with the conversation?

>..--server-side stuff.

So, is this a web-service?  Is it 
defined in the web.xml file?  Or are 
these simply applications that run
on the server?

> Is there a list of undocumented parameters ...

If there was a list, ..they would 
then be documented.

>...beyond what "java -help" provides?

No.  'batch files' is not the way to go here
in any case.  I am not sure how to do it if
you are talking anout a web-service, but for 
applications, WebStart has all you need.

You can specify not only a minimum version,
but even specific micro-versions of the JRE.

They are 'installed' in that if the requested
JRE is not present, it will be downloaded and 
installed, but it does not 'take over' as the 
main JRE in the way it would if you install a 
different Java version yourself.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane



== 3 of 3 ==
Date:   Thurs,   Sep 16 2004 7:54 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Thu, 16 Sep 2004 14:34:48 GMT, Andrew Thompson wrote:

> On 16 Sep 2004 06:35:54 -0700, Scott Edward Skinner wrote:
> 
> Please don't top-post Edward, I find it most confusing..

Ooops!  Sorry, Scott.

( now, ..you see how *easily* I get confused.  ;-)




==========================================================================
TOPIC: Test my J2ME MIDP 2.0 game: Taleban vs. Robot
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d33c48591b2afae1
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 6:47 am
From: [EMAIL PROTECTED] (daniel) 

I tried downloading the game on a Nokia 6600 but it didn't work.  It
started downloading the app and then it said:

"Unable to install. Invalid version"

[EMAIL PROTECTED] (Christian Hvid) wrote in message news:<[EMAIL PROTECTED]>...
> Please test my new mobile phone game:
> 
> http://apelab.com/mobile/taleban 
> 
> Click "get demo". The full game is not available for sale yet. 
>   
> The game is designed for the Sony Ericsson K700 but should run on any
> J2ME MIDP 2.0 enabled phone with a minimal display size of 128x128 (or
> at least so I hope).
>  
> If you test the demo on a device other the listed devices (currently
> it is only tested on the Sony Ericsson K700) and you like the game,
> then I will send you the full version for free (just throw me an email
> with the name of your device) ...
> 
> I hope to sell it online :-D but I will release the source code later
> as a part of a mobile edition of my framework for small java games.
> The original game and framework is described here:
> 
> http://vredungmand.dk/programming/sjg/taleban/index.html
> 
> -- Christian




==========================================================================
TOPIC: finally with no try/catch?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/316672728452e3f
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 6:48 am
From: kaeli <[EMAIL PROTECTED]> 

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] 
enlightened us with...
> > 
> 
> Why do you catch the Exception in the first place? You _can_ use
> 
> try {
>       // ...
> } finally {
>       // ...
> }
> 
> just as well. No need to catch anything. In fact, AFAIK this is the main 
> use for finally.
> 


I thought I HAD to catch it if I was using try.

This was exactly what I was asking if I could do.
Thanks!

-- 
--
~kaeli~
The secret of the universe is @*&^^^ NO CARRIER  
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace





==========================================================================
TOPIC: java.util.zip - problem opening some legitimite me zip files
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/32006c0dd622b47b
==========================================================================

== 1 of 2 ==
Date:   Thurs,   Sep 16 2004 6:58 am
From: Alex Hunsley <[EMAIL PROTECTED]> 

I'm returning to a project I left off a short while ago. One of the problems I 
had was that java.util.zip was having problems opening some zip files that 
opened just fine in winzip.
When I get my hand into the code again (tonight perhaps) I can maybe reproduce 
the actual error, but as I recall, java.util.zip thought that the zip file was 
corrupt.
Anyone had experience with OK zip files getting rejected by the zip package in 
this way?
Will post more info when I have it.

ta,
alex



== 2 of 2 ==
Date:   Thurs,   Sep 16 2004 7:06 am
From: Andrew Thompson <[EMAIL PROTECTED]> 

On Thu, 16 Sep 2004 14:58:13 +0100, Alex Hunsley wrote:

> Anyone had experience with OK zip files getting rejected by the zip package in 
> this way?

Yep.

> Will post more info when I have it.

Goodo.

...Oh all-right Alex.  The answer to your 
(rather vague) question is probably that 
the Zip file's index is corrupt, but in 
that case the ZipEntries can still be 
retrieved sequentially.

WinZip probably tries the first, then 
silently falls back to the second.

Google Chris Uppal's posts for a long and 
detailed discussion of the arcane aspects 
of ZipFiles.

-- 
Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.lensescapes.com/  Images that escape the mundane




==========================================================================
TOPIC: Could it be too bad to implement it as a tag?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/7be6c3a08e023f28
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 7:12 am
From: Sudsy <[EMAIL PROTECTED]> 

Rhett Liu wrote:
> Hi,Kind guys!
> 
> I'm in troulbe with a choice of custom tag.
> The situation is:
> I have some record stored in database,but not much records,just like a 
> catalog,less than 30,there's need to display them all in a web page as a 
> list,I want to write a custome tag to display them,fill them in a 
> <select><option></option></select>'s options;If I don't do like 
> this,however,I have to refill all them in to a java bean in a action 
> bean,consider that first we get it from an edit-action,next we submit it 
> to the save-action,if save-action fill and have to redirect back to edit 
> page,hear we have to refill all them in to a java bean(which is stored 
> in request not session,i think this is more suitable).

I'd use the html:optionsCollection tag and store the options (assuming
the list doesn't change frequently) in session scope.





==========================================================================
TOPIC: EJB
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/9d10a655890884de
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 7:15 am
From: Sudsy <[EMAIL PROTECTED]> 

Martinez wrote:
<snip>
>                     PomiarHome home = ( PomiarHome)session.getAttribute("home");
>                     Pomiar newPomiar = 
> home.create(id,miejscowosc,data_pomiaru,temperatura,cisnienie,wilgotnosc,kierune
> k_wiatru);
> 
> what is wrong  ???

I don't believe it has anything to do with the database since you're
not getting an SQLException, you're getting a NullPointerException.
That would lead me to believe that home is null and when you attempt
to use it (home.create) it generates the exception.





==========================================================================
TOPIC: cmsg cancel <[EMAIL PROTECTED]> ignore
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/63219b49f732325e
==========================================================================

== 1 of 1 ==
Date:   Mon,   Sep 13 2004 8:53 am
From: [EMAIL PROTECTED] (Ollivier Robert) 

ECP/EMP aka SPAM or pyramidal scheme (MMF) cancelled by [EMAIL PROTECTED]
It may also be an image too small for newsbot to be activated.
See report in fr.usenet.abus.rapports.

Original subject was:
Osama Bin Ladin Recent Photos




==========================================================================
TOPIC: Zipping without a file
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d97c18b4cd4dd37b
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 7:47 am
From: Tyler Reed <[EMAIL PROTECTED]> 

I'd like to compress a stream. However, the incoming data is not a file and,
more importantly, the outgoing data is not a file, it's just another
stream. What can I use to compress the data? I've been playing around with
util.zip but it wants me to create a Zip Entry and I can't be injecting
irrelevant info like that into the data stream. Any ideas?

Thanks,
Tyler Reed
[EMAIL PROTECTED]





==========================================================================
TOPIC: Problem reading from nio socketchannels into a bytebuffer
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d8b57d1c9857a5b2
==========================================================================

== 1 of 1 ==
Date:   Thurs,   Sep 16 2004 8:05 am
From: [EMAIL PROTECTED] (Jeff Silvis) 

At:
http://www.javanio.info/filearea/bookexamples/unpacked/com/ronsoft/books/nio/channels/SelectSockets.java

There is sample code.  In that page there are the lines:




                     // send the data, don't assume it goes all at once
                        while (buffer.hasRemaining()) {
                                socketChannel.write (buffer);
                        }
                        // WARNING: the above loop is evil.  Because
                        // it's writing back to the same non-blocking
                        // channel it read the data from, this code can
                        // potentially spin in a busy loop.  In real life
                        // you'd do something more useful than this.




In some of my code I have written a line more or less exactly like:
while (buffer.hasRemaining()) {
                                socketChannel.write (buffer);
                        }


and the code does just spin.   What is an example of "something more
useful than this"?

Jeff



=======================================================================

You received this message because you are subscribed to the
Google Groups "comp.lang.java.programmer".  

comp.lang.java.programmer
[EMAIL PROTECTED]

Change your subscription type & other preferences:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe

Report abuse:
* send email explaining the problem to [EMAIL PROTECTED]

Unsubscribe:
* click http://groups-beta.google.com/group/comp.lang.java.programmer/subscribe


=======================================================================
Google Groups: http://groups-beta.google.com 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/BCfwlB/TM
--------------------------------------------------------------------~-> 

<a href=http://English-12948197573.SpamPoison.com>Fight Spam! Click Here!</a> 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/kumpulan/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to