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

Today's topics:

* Question regarding marker interfaces.... - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cf059e2fa32de473
* One user sees another user's data - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/362a5a1a0b2a65d3
* Package jar files inside EJB jar file? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f0cc75e4ca20aad4
* references and a binary tree - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d897505b2c28f461
* newbie - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca1e2e741e203cc6
* request.getHeader - referer - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/810ddbb36c621b1f
* efficient network transfer - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6996ec6c1fb6cf53
* What does this mean? (The type xxxx.yyyy cannot be resolved. It is indirectly 
referenced from required .class files) - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/da4ccc03f5890f02
* diagnosing thread leak questions - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1a8fdadf2109adbc
* Reading huge text files one line at a time.... - 3 messages, 3 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5297862f47d197a6
* EJB find methods. Why do they return only the primary key? - 2 messages, 2 
authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f78cddca61b64ba
* Image Resizing - 2 messages, 2 authors
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f6023931da0327a
* hey i am new to this - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1037fd04428c23dc
* Any Tutorial on coding Struts under NetBeans IDE ? - 1 messages, 1 author
  
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14c348ae79ecbc06
  
==========================================================================
TOPIC: Question regarding marker interfaces....
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/cf059e2fa32de473
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 22 2004 12:25 pm
From: "Anton Spaans" <aspaans at(noSPAM) smarttime dot(noSPAM) com> 


"pentium" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Hi folks,
> I was just wondering why does Java need empty interfaces like
> serializable & cloneable if they don't specify any methods ? What
> purpose do they serve then ?
> Any pointers would be appreciated.
>
> Thanks,
> -MK.

I've been using marker interfaces for classes (that implement such marker
interfaces) having a behavior that can not be syntactically written down in
Java (i.e. there is no way that this behavior can be checked at compile
time).

E.g. the Serializable interface dictates that all members of the class
implementing it need to be serializable as well. There is no way to enforce
this at compile time.

These marker interfaces are mostly used by the callers/users of classes
implementing them.

I consider 'normal' interfaces to be used as 'contracts', and marker
interfaces as 'promises'.   :=)

-- Anton.






== 2 of 2 ==
Date:   Mon,   Nov 22 2004 1:27 pm
From: "bilbo" <[EMAIL PROTECTED]> 

pentium wrote:
> Hi folks,
> I was just wondering why does Java need empty interfaces like
> serializable & cloneable if they don't specify any methods ? What
> purpose do they serve then ?
> Any pointers would be appreciated.
>
> Thanks,
> -MK.

Before Java 1.5, there wasn't really any good way to specify attributes
of a class like Serializable, Clonable, RandomAccess for Lists, etc.  I
agree that using empty interfaces for this purpose seems unintuitive
and hackish, since the interfaces don't actually specify any
functionality; but it works.

With Java 1.5, you can use the new annotation feature, which seems to
me like a more straightforward way to accomplish this.  An annotation
doesn't pretend to guarantee any functionality.  I'd guess that if the
standard library were being written now, Serializable, Clonable, and
RandomAccess would be class annotations rather than empty interfaces.





==========================================================================
TOPIC: One user sees another user's data
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/362a5a1a0b2a65d3
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 22 2004 2:05 pm
From: [EMAIL PROTECTED] (Matt Walter) 

Having a problem with a web app. User A and User B have both logged
on, are using the app, then User A all of the sudden begins seeing
User B's data.

I've checked for thread-safety in the servlets and can't find any
issues.

The web app is used over several hundered locations across the
country. When the session switching happens, the two users are always
at the same location, meaning user A and user B are on the same
network.

The site also uses Akamai's EdgeSuite. Currently, we have EdgeSuite's
persistent connections disabled - if we were to enable them User A and
User B could be at different locations and would experience the
session swtiching.

Any ideas?

Thanks.



== 2 of 2 ==
Date:   Mon,   Nov 22 2004 2:52 pm
From: Sudsy <[EMAIL PROTECTED]> 

Matt Walter wrote:
<snip>
> The web app is used over several hundered locations across the
> country. When the session switching happens, the two users are always
> at the same location, meaning user A and user B are on the same
> network.
<snip>
> Any ideas?

Just one: it's possible that these sites are using NAT (Network Address
Translation). It permits multiple computers to share a single IP address.
A proper session management implementation should not have a problem with
NAT, setting browser cookies or utilizing URL rewriting as appropriate.
Lesser attempts might try to map sessions to IP address alone. It might
be easier from a programming stand-point but fails to address reality.
You'll have to do some network sniffing or dive into the logs in order
to prove or disprove this possibility. That or refer to the documentation
for the software packages in use...

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.





==========================================================================
TOPIC: Package jar files inside EJB jar file?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f0cc75e4ca20aad4
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 22 2004 2:11 pm
From: Sudsy <[EMAIL PROTECTED]> 

harry wrote:
> I have a enterprise app constisting of 6 EJB's & 1 web component.
> 
> I want one of the ejb's to control database persistance using the iBatis
> framework.
> 
> Where do I put the jar files that make up ibatis in this EJB jar file? - no
> WEB-INF\lib dir like with web components & trying adding one but seems to
> ignore it!

You need to investigate the format of an ear. Start here:
<http://java.sun.com/j2ee/sdk_1.2.1/techdocs/guides/ejb/html/Overview5.html>

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.





==========================================================================
TOPIC: references and a binary tree
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/d897505b2c28f461
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 22 2004 2:29 pm
From: Sudsy <[EMAIL PROTECTED]> 

John C. Bollinger wrote:
> Andrew Thompson wrote:
<snip>
>> My money is on WannaGoForAWalkError.
> 
> 
> No, no, that's the cause of the HeSaysHesNotDeadError that's thrown.
> 
> :-)

Is that a superclass of the PiningForTheFjordsException?

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.





==========================================================================
TOPIC: newbie
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/ca1e2e741e203cc6
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 22 2004 2:38 pm
From: "Fahd Shariff" <[EMAIL PROTECTED]> 

int num = 932;
int sum = 0;
String s = Integer.toString(num);
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
int digit = Integer.parseInt(Character.toString(c));
sum += digit;
}
System.out.println(sum);

--
Fahd Shariff
http://www.fahdshariff.cjb.net
"Let the code do the talking... "




== 2 of 2 ==
Date:   Mon,   Nov 22 2004 2:52 pm
From: Andrew Thompson <[EMAIL PROTECTED]> 

On 22 Nov 2004 14:38:06 -0800, Fahd Shariff wrote:

(snip code)

(sig)
> "Let the code do the talking... "

Yes, I notice you've been saying that to each of the OP's
postings on c.l.j.help, gui and programmer.  Whereas I have 
been trying to encourage him to make a single post to 
c.l.j.help (on each group I've seen messages).

In case you intend to methodically answer each one as well, 
I better warn you that you seem to have missed at least 1.
<http://groups.google.com/[EMAIL PROTECTED]>

[ ;-) ]

-- 
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: request.getHeader - referer
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/810ddbb36c621b1f
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 22 2004 2:59 pm
From: "Murray" <[EMAIL PROTECTED]> 


"sks" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
>
> Well it's referer lower case.
>
> But it only works if you've clicked a link. If you type something in at
the
> url bar the referer will always be null.

Or if your browser/firewall chooses not to set the referer header (depending
on security settings)






==========================================================================
TOPIC: efficient network transfer
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/6996ec6c1fb6cf53
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 22 2004 4:00 pm
From: [EMAIL PROTECTED] (uzon) 

Andrew Thompson <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>...
> On 22 Nov 2004 06:58:50 -0800, uzon wrote:
> 
> > keep your "suggestions" to yourself. 
> 
> Plonk whoever your wish.
> 
> > this is a java forum 
> 
> Yes, it's a discussion forum for the Java programming 
> language, conducted primarily in English.  
> 
> Such discussions are made simpler for all concerned (including 
> the large number of contributors who speak English as a second 
> language) if the poster makes every effort to be understood.
> 
> This effort amounts to including such boring and mundane things 
> as putting a space between paragraphs and capitalising the first 
> letter of sentences.
> 
> >...not grammar and spelling. 
> 
> You seem to be ignoring the 15 lines of my post that did not
> mention grammar and spelling.  For reference, I'll link to it..
> <http://groups.google.com/[EMAIL PROTECTED]>
> 
> You might even visit, and benefit from, the links I included.
> 
> > troll isn't name calling. it's a description of your precious and unique 
> > attitude.
> 
> Pot, kettle, black.  Get over it, and please locate your shift key.

ok i get it, telling people to use an upper case 'I' makes your day.
fine. you're great. wonderful. you make the forums worth reading.
<applause>
notice others didn't have a problem understanding my question.
fin



== 2 of 2 ==
Date:   Mon,   Nov 22 2004 8:50 pm
From: Thomas Schodt <[EMAIL PROTECTED]> 

uzon wrote:

> notice others didn't have a problem understanding my question.

Maybe many others either
- did not bother reading your post because it was hard to read, or
- did not bother telling you your post was hard to read since Andrew had 
beat them to it.

OFC you are free to continue to throttle the responses you get
by making your posts hard to read. o_O




==========================================================================
TOPIC: What does this mean? (The type xxxx.yyyy cannot be resolved. It is 
indirectly referenced from required .class files)
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/da4ccc03f5890f02
==========================================================================

== 1 of 3 ==
Date:   Mon,   Nov 22 2004 4:08 pm
From: [EMAIL PROTECTED] (Joseph Kelch) 

The class in question is being used just fine a few lines above where
this error is being generated.  The only difference is that the
reference generating the error is on a static member function. 
Non-static references are working just fine.  I am using Eclipse
3.0.1.  The static function is showing up in the package explorer, but
does not show up in the editor quick complete window when I type the
class name followed by the member operator.  Only the non-static
member functions show up.  Any idea what is going on here?  The rest
of the project (very large, hundreds of source files!) seems to
compile just fine.



== 2 of 3 ==
Date:   Mon,   Nov 22 2004 5:20 pm
From: "Thomas G. Marshall" <[EMAIL PROTECTED]> 

Joseph Kelch coughed up:
> The class in question is being used just fine a few lines above where
> this error is being generated.  The only difference is that the
> reference generating the error is on a static member function.
> Non-static references are working just fine.  I am using Eclipse
> 3.0.1.  The static function is showing up in the package explorer, but
> does not show up in the editor quick complete window when I type the
> class name followed by the member operator.  Only the non-static
> member functions show up.  Any idea what is going on here?  The rest
> of the project (very large, hundreds of source files!) seems to
> compile just fine.


Then post the part that doesn't and let's have a look.  Criminey.  ;)



-- 
Whyowhydidn'tsunmakejavarequireanuppercaselettertostartclassnames....





== 3 of 3 ==
Date:   Mon,   Nov 22 2004 5:58 pm
From: "Ann" <[EMAIL PROTECTED]> 


"Thomas G. Marshall" <[EMAIL PROTECTED]>
wrote in message news:[EMAIL PROTECTED]
> Joseph Kelch coughed up:
> > The class in question is being used just fine a few lines above where
> > this error is being generated.  The only difference is that the
> > reference generating the error is on a static member function.
> > Non-static references are working just fine.  I am using Eclipse
> > 3.0.1.  The static function is showing up in the package explorer, but
> > does not show up in the editor quick complete window when I type the
> > class name followed by the member operator.  Only the non-static
> > member functions show up.  Any idea what is going on here?  The rest
> > of the project (very large, hundreds of source files!) seems to
> > compile just fine.

Ya, my stuff compiles fine too.






==========================================================================
TOPIC: diagnosing thread leak questions
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1a8fdadf2109adbc
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 22 2004 4:27 pm
From: "Jeff" <[EMAIL PROTECTED]> 

Is there some mechanism to identify which class or method created a thread?

My application's thread count increases dramatically heavy loads.  At 
startup, my application creates 5 threads.  However, 10 threads are listed 
in the active thread enumeration.  Now some of those could be supporting 
libraries such as log4j.   But once it starts processing load, the thread 
count jumps to 26, and eventually gets above 150.

I've called Thread(String arg) when the application explicitly creates 
threads so that I can identify the threads the application explicitly 
creates.  The mystery threads all have high identifier names.  For example,

At startup, the threads are called:
 Thread-1
 Thread-2
 Thread-3.

Under load, I see:
Thread-760
 Thread-1750

1. Does 760 imply there are 759 previous threads?

2.  There are always 3 null entries in the enumeration of active threads. 
Is this symptom some discrepency between activeCount() and 
Thread.enumerate()?

Here's the method I use to count threads:
   public static void listThreads() {
       int activeCount = Thread.activeCount();
       System.out.println("active thread count: " + activeCount);
        Thread[] threads = new Thread[activeCount];
        Thread.enumerate(threads);

        for ( int j = 0 ; j < threads.length ; j ++ ) {
            System.out.println("threads["+ j + "]:" + threads[j]);
        }
     }

Thanks
-- 
Jeff 





== 2 of 2 ==
Date:   Mon,   Nov 22 2004 4:38 pm
From: "Ann" <[EMAIL PROTECTED]> 


"Jeff" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Is there some mechanism to identify which class or method created a
thread?
>
> My application's thread count increases dramatically heavy loads.  At
> startup, my application creates 5 threads.  However, 10 threads are listed
> in the active thread enumeration.  Now some of those could be supporting
> libraries such as log4j.   But once it starts processing load, the thread
> count jumps to 26, and eventually gets above 150.
>
> I've called Thread(String arg) when the application explicitly creates
> threads so that I can identify the threads the application explicitly
> creates.  The mystery threads all have high identifier names.  For
example,
>
> At startup, the threads are called:
>  Thread-1
>  Thread-2
>  Thread-3.
>
> Under load, I see:
> Thread-760
>  Thread-1750
>
> 1. Does 760 imply there are 759 previous threads?
>
> 2.  There are always 3 null entries in the enumeration of active threads.
> Is this symptom some discrepency between activeCount() and
> Thread.enumerate()?
>
> Here's the method I use to count threads:
>    public static void listThreads() {
>        int activeCount = Thread.activeCount();
>        System.out.println("active thread count: " + activeCount);
>         Thread[] threads = new Thread[activeCount];
>         Thread.enumerate(threads);
>
>         for ( int j = 0 ; j < threads.length ; j ++ ) {
>             System.out.println("threads["+ j + "]:" + threads[j]);
>         }
>      }
>
> Thanks
> --
> Jeff
>
I have an app that creates no threads, but there are
some created by the system. I wrote a method to list them.
(d=daemon, *=current, number is prio.)

Thread Group: system
------ 1
Thread 0: d  10 Reference Handler
Thread 1: d  8  Finalizer
Thread 2: d  10 Signal Dispatcher
Thread 3: d  10 CompilerThread0
Thread 4: d  6  AWT-Windows
Thread 5:  * 6  AWT-EventQueue-0
Thread 6:    5  AWT-Shutdown
Thread 7: d  10 Java2D Disposer
Thread 8:    5  DestroyJavaVM






==========================================================================
TOPIC: Reading huge text files one line at a time....
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/5297862f47d197a6
==========================================================================

== 1 of 3 ==
Date:   Mon,   Nov 22 2004 4:51 pm
From: [EMAIL PROTECTED] (Brock Heinz) 

Hello All,

I've done quite a bit of research on this one and I'm still stumped. 
I have an application that reads a text file (up to 100MB in size) one
line at at time, converts the line to XML using Castor (each line is a
specific record) and then sends a JMS message for that line.  After
validating the file one line at a time (never reading the entire
contents into memory), I am then confident I can perform the Castor
transformation / send operation.  I'm doing something like the
following:

BufferedReader reader = new BufferedReader(new FileReader(validFile));
//for each line in the file
for (String line; (line = reader.readLine()) != null;) {
  //perform transformation and send
  IMessage message = transformer.createMessage(line, msgSelector);
  sendMessage(message);
  messageSentCount++;
  //perform cleanup / logging every 500th message
  if (messageSentCount % 500 == 0) {
    log.debug("sent message: "+messageSentCount);
    log.debug(" - Garbage collecting.");
    try {
      this.finalize();
    } catch (Throwable t) {
      log.warn("Could not finalize - keep on reading anyhow"); 
    }
  }
}
reader.close();


Does anyone see any problems with reading the files one line at a time
in this manner (using the readLine() method)?  I seem to hit an
OutofMemoryException right around line 315,000.  Is the readLine()
method interally not efficient to use?

In the archives I've seen the approach of reading chunks of the file
with a buffer, and then determining each line by seaching for carriage
returns or line breaks.  Anyone have any thoughts on this?

Any help would be greatly appreciated.

Thanks,
Brock



== 2 of 3 ==
Date:   Mon,   Nov 22 2004 5:21 pm
From: thirdrock <[EMAIL PROTECTED]> 

Brock Heinz wrote:

> Hello All,

> 
> BufferedReader reader = new BufferedReader(new FileReader(validFile));
> //for each line in the file
> for (String line; (line = reader.readLine()) != null;) {
>   //perform transformation and send
>   IMessage message = transformer.createMessage(line, msgSelector);

What object type is transformer?

>   sendMessage(message);
>   messageSentCount++;
>   //perform cleanup / logging every 500th message
>   if (messageSentCount % 500 == 0) {
>     log.debug("sent message: "+messageSentCount);
>     log.debug(" - Garbage collecting.");
>     try {
>       this.finalize();
What is this?
Where is 'message' garbage collected?

>     } catch (Throwable t) {
>       log.warn("Could not finalize - keep on reading anyhow"); 
>     }
>   }
> }
> reader.close();
> 
> 
> Does anyone see any problems with reading the files one line at a time
> in this manner (using the readLine() method)?  I seem to hit an
> OutofMemoryException right around line 315,000.  

That would tend to indicate that you are running out of memory.

> Is the readLine()
> method interally not efficient to use?
What makes you think it is the readline() method that is sucking up all 
of the memory?

> 
> In the archives I've seen the approach of reading chunks of the file
> with a buffer, and then determining each line by seaching for carriage
> returns or line breaks. 

That will only help once you have determined that readline() is the 
cause of the problem.

Ian



== 3 of 3 ==
Date:   Mon,   Nov 22 2004 7:29 pm
From: [EMAIL PROTECTED] (EricF) 

In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (Brock Heinz) wrote:
>Hello All,
>
>I've done quite a bit of research on this one and I'm still stumped. 
>I have an application that reads a text file (up to 100MB in size) one
>line at at time, converts the line to XML using Castor (each line is a
>specific record) and then sends a JMS message for that line.  After
>validating the file one line at a time (never reading the entire
>contents into memory), I am then confident I can perform the Castor
>transformation / send operation.  I'm doing something like the
>following:
>
>BufferedReader reader = new BufferedReader(new FileReader(validFile));
>//for each line in the file
>for (String line; (line = reader.readLine()) != null;) {
>  //perform transformation and send
>  IMessage message = transformer.createMessage(line, msgSelector);
>  sendMessage(message);
>  messageSentCount++;
>  //perform cleanup / logging every 500th message
>  if (messageSentCount % 500 == 0) {
>    log.debug("sent message: "+messageSentCount);
>    log.debug(" - Garbage collecting.");
>    try {
>      this.finalize();
>    } catch (Throwable t) {
>      log.warn("Could not finalize - keep on reading anyhow"); 
>    }
>  }
>}
>reader.close();
>
>
>Does anyone see any problems with reading the files one line at a time
>in this manner (using the readLine() method)?  I seem to hit an
>OutofMemoryException right around line 315,000.  Is the readLine()
>method interally not efficient to use?
>
>In the archives I've seen the approach of reading chunks of the file
>with a buffer, and then determining each line by seaching for carriage
>returns or line breaks.  Anyone have any thoughts on this?
>
>Any help would be greatly appreciated.
>
>Thanks,
>Brock

I don't think the problem is with readline. You have a memory leak. 

Is the finalize call really doing anything?

Try setting any variables to null when you are thru with them at the end of 
the for loop. Particulalry message.

Eric




==========================================================================
TOPIC: EJB find methods. Why do they return only the primary key?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/3f78cddca61b64ba
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 22 2004 4:51 pm
From: "Doug Pardee" <[EMAIL PROTECTED]> 

> What I don't understand is why I should access the database (or
whatever
> repository where I can find my information) twice, instead of just
> building the bean and returning it in the find method.

There are multiple cases to consider.

The container uses the ejbFindByPrimaryKey method to test if the
database has a record with that primary key. If so, ejbFindByPrimaryKey
returns the primary key; if not it throws an ObjectNotFoundException.
In the event that more than one record exists with the primary key (not
usually possible), the finder throws a FinderException. This process
doesn't necessarily involve doing a database access, but in practice it
almost always does.

The container uses other Single-Object Finders to translate the lookup
criteria into a primary key for a record in the database. If there is
no such record, the finder must throw an ObjectNotFoundException. If
more than one primary key is found, the finder must throw a
FinderException. This lookup might not involve reading the actual
record from the database; e.g., the primary key might be obtained by
querying a different table using the search criteria.

In both of the above cases, if the container receives a primary key
back from the finder, it then looks in its bean pool to see if it
already has a bean instance for that key. It returns that instance if
so, or allocates a new instance if not (or sets up lazy allocation for
it). Thus, it's possible that the bean instance returned is one from
the pool, not the one that executed the finder. It could also be just a
stub for lazy allocation.

The container uses Multi-Object Finders to perform queries based on the
lookup criteria. The finder returns a Collection of primary keys
(possibly empty) associated with the result set of the query. This
might not involve reading the actual records from the database; e.g.,
the primary keys might be obtained by querying a different table using
the search criteria.

In this case, the container looks in its bean pool to see if it has
bean instances for any of the returned keys. It allocates new instances
(or sets up lazy allocation) for any keys that didn't have pooled
instances, and then returns the lot. Multiple bean instances are
returned, and maybe none of them are the one that executed the finder.
Some might just be a stub for lazy allocation.

The client might then use the bean instance(s) that it received from
the container. The first access to each bean instance will trigger a
call to its ejbLoad method, which typically will issue another database
read.

So, if you call a finder method that returns 'n' bean instances, and
then access each of those instances, you'll typically end up with 'n+1'
database accesses.

Some containers (at least WebLogic and JBoss) can be instructed to
preload all of the returned beans if they're CMP beans. In a few cases
this might be wasteful; for example, if the result set was 1000 beans
and you only wanted to look at the top 5. It can also result in your
database going into lock escalation.

Entity beans are designed to always behave correctly under all
conditions. They are inherently low-performance and should be
approached carefully in any system that is expected to be under heavy
load. In addition to the 'n+1' problem (which can sometimes be
circumvented with some containers), you have scalability challenges
introduced by the limitation that only one client can be accessing an
entity bean at a time. Entity beans must be accessed inside
transactions, which generally is inappropriate for OLAP applications.
And depending on your database, you might end up with unnecessary lock
escalation which can further damage scalability.




== 2 of 2 ==
Date:   Mon,   Nov 22 2004 8:28 pm
From: Sudsy <[EMAIL PROTECTED]> 

Doug Pardee wrote:
<snip>

Thank you for a most eloquent description.

> Entity beans are designed to always behave correctly under all
> conditions. They are inherently low-performance and should be
> approached carefully in any system that is expected to be under heavy
> load. In addition to the 'n+1' problem (which can sometimes be
> circumvented with some containers), you have scalability challenges
> introduced by the limitation that only one client can be accessing an
> entity bean at a time. Entity beans must be accessed inside
> transactions, which generally is inappropriate for OLAP applications.
> And depending on your database, you might end up with unnecessary lock
> escalation which can further damage scalability.

I agreed with everything you said, save this last paragraph. In cases
where there is a lot of contention for table (or view) rows, CMP entity
EJBs can actually improve performance.
Well-designed implementations draw on the experience gained through
many years and iterations and access methods which provide the best
performance with minimal contention.
I'd be the first to agree that the initial attempts in this area fell
far short of potential. You only have to look at the ommission of the
ORDER BY clause in the initial implementation of EJB-QL to see that
they didn't offer what many consider to be essential functionality
at the beginning. Things have improved considerably since then.
I still believe that CMP entity EJBs (especially when you utilize
CMR) provide flexibility and power as a component of an enterprise
application.
And I also believe that many of the performance limitations are behind
us. Now if someone wants to fund a research project to prove that
premise...  ;-)

-- 
Java/J2EE/JSP/Struts/Tiles/C/UNIX consulting and remote development.





==========================================================================
TOPIC: Image Resizing
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/f6023931da0327a
==========================================================================

== 1 of 2 ==
Date:   Mon,   Nov 22 2004 5:04 pm
From: "SamMan" <[EMAIL PROTECTED]> 

Is there a lib, or some other utility that will reduce the size of an image?

For example, if I have an image 20 pixels by 20 pixels, 40k in size, is 
there a way to programmatically make it a 10 x 10, 20k image?

Thanks.

-- 
SamMan
Rip it to reply






== 2 of 2 ==
Date:   Mon,   Nov 22 2004 7:51 pm
From: "John McGrath" <[EMAIL PROTECTED]> 

On 11/22/2004 at 8:04:39 PM, SamMan wrote:

> Is there a lib, or some other utility that will reduce the size of an
> image?
> 
> For example, if I have an image 20 pixels by 20 pixels, 40k in size, is 
> there a way to programmatically make it a 10 x 10, 20k image?

There may be something in the Advanced Imaging API.  But a fairly easy way
to do this would be to create a BufferedImage, then get a Graphics context
for it and paint your image on the Graphics context at a reduced size.
The BufferedImage will then contain the reduced image.

-- 
Regards,

John McGrath




==========================================================================
TOPIC: hey i am new to this
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/1037fd04428c23dc
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 22 2004 5:14 pm
From: Scott Ellsworth <[EMAIL PROTECTED]> 

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Greg Smith) wrote:

> > But since I have your attention, please locate your Shift Key*
> > and type capital letters for the beginning of sentences, the word 
> > 'I' and proper names like 'Tamer' and 'Java'.  You are likely to 
> > get better responses if you take effort to make your posts easy to read.
> 
> it has become very common on the internet not to use capital letters.

In the main, I skip past posts by people who can not be bothered to 
properly capitalize and spell their posts.  You are free to disagree, 
but I know that I, among others, pretty much ignore such posts.

> the fact is that it is faster to type and offers no loss in
> readability.

Looking at your post, I assure you that it does offer a loss in 
readability.  Not a crippling loss, as I did respond, but quite 
noticeable.

> i had no trouble reading the posting and i've never been
> critcized for my lack of caseness in my writings. surely, to complain
> about lack of case in emails or postings is akin to insisting on
> proper grammer and spelling in an instant message.

Perhaps.  Note, though, that an IM is a quite ephemeral thing, read only 
by your intended target.  Newsgroup posts tend to stick around, and are 
read by a wide variety of people, sometimes quite some time after 
posting.

Scott




==========================================================================
TOPIC: Any Tutorial on coding Struts under NetBeans IDE ?
http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/14c348ae79ecbc06
==========================================================================

== 1 of 1 ==
Date:   Mon,   Nov 22 2004 6:45 pm
From: [EMAIL PROTECTED] (Jason Jacob) 

To all, 

As title, any tutorial or tips in coding Struts with NetBeans....?

I've got an error like this "HTTP Status 404 - Servlet action is not
available"
and no more useful information listed out then.... It seems that the
ActionServlet hasn't been started up normally (but I've provided all
the necessary things already, include providing the
ApplicationResource.properties, struts.jar and struts-config.xml)

Any clues????

PS. I can't use the "Struts Console" plugin since my NetBeans version
is 4.0Beta 2 which doesn't support it anymore...

>From Jason (Kusanagihk)



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

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 

Reply via email to