Chris Brat

Ranch Hand
+ Follow
since May 22, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Chris Brat

Hi,

I'm are using Weblogic Server 10 and making use of distributed queues and a bridge to publish messages to a 2nd system.

Is there a callback mechanism available where application code can be executed as a result of a successful delivery of a message in the JMS bridge ?

As an example :
1.) My application inserts message into queue on bridge
2.) Message is successfully delivered to 2nd system -> callback class in my application is invoked (possibly to update a database status entry or initiate a application specific timer)

I know that the messages that currently exist in a queue can be retrieved by JMX but I'd prefer to use an callback facility than write code to query the queue/bridge via JMX at intervals.

Thanks,
Chris
15 years ago
Hi,

Thanks for the response.

I would also generally look towards files or sockets not being closed correctly - thats why I'm curious.

Chris
Hi,

A colleague of mine recently told me that he once wrote a web application that made very heavy use of StringBuffer class (JVM version 1.3) in order to generate code (using Javacc) and experienced the problem of running out of file handles.

It was explained to me that the problem was due to the synchronized methods of the StringBuffer class and all the thread locking associated with using it.

I don't know much about this but it sounds very interesting and could explain a problem I had at a previous company.

Please share your opinions or thoughts.

Thanks
Chris
Hi,

Thanks for the reply.

Is that true for all versions?

C
18 years ago
Hi,

Where can I find information about the performance of the
nextProbablePrime() method in the java.math.BigInteger class? The
relates to the initial capacity of a HashMap.

The HashMap that can hold data of at least size X and at most Y,
and I want to set the initial capacity to the next possible prime
between X and Y.

By the way Y = X * 2.

At the moment I am setting the capacity to X but I've read that
HashMaps perform better if the initial capacity is a prime number - I
want to test this.

Will setting the initial capacity to the value returned by nextProbablyPrime() - starting from position X - have a significant improvement or is it going to waste memory?

Thanks,
Chris
18 years ago
Hi guys,

Thanks for all your input.

Im using Tomcat 5.5 and I eventually looked inside the generated JSP class files (that Tomcat generates) to see if I could see anything.

It looks like Tomcat maintains a pool of tag instances (my tag extended BodyTagSupport) that it stores in the servlet context - I'm guessing this is for performance reasons. And this to me explains why I was getting application wide access to it.


I never manipulate the tag attributes (setting them to null etc), but I was passing values from a few nested child tags to their common parent ... something like this :

<cb arentTag>
<cb:childTag name="1" attr="val1">
<cb:childTag name="2" attr="val2">
</cb arentTag>

So child 1 and 2 both passed the attr values ("val1" and "val2" respectively) through to the parent (the child tags have no body) by calling a protected method of the parent tag (that I looked up with getParent()).

The parent keeps the supplied attr values in a list and then in the doEndTag() method it does some processing and outputs the results.

Hope this is making sense.
18 years ago
JSP
Hi,

Is it correct to assume that a a web (servlet/JSP) container can create a single instance of a custom tag which it shares between mutliple pages?

Or is it expected that a new object will be created for each tag declaration on each JSP?

I created a custom tag (call it MyCustomTag) and am using it in a JSP page
and from what I see only one instance is created and is being 'shared' between multiple pages (it seems to be a single instance used application wide) and this is corrupting the data?

How do I force a single instance of this tag per page? Or at least force the tag to clear itself once it is finished (the release() method?)

Lotsa questions... ;-)

Thanks
Chris
18 years ago
JSP
In the following situation

Class A{

public void method1() throws IOException{
System.out.println("class A")
}

}

Class B extends A{

// this class throws subclasses of IOException
public void method1() throws FileNotFoundException{
System.out.println("class B")
}

}

Class C extends A{

// this method throws less exceptions
public void method1(){
System.out.println("class C")
}

}



- Class A defines method1 as throwing IOException
- Any class that extends class A (here B or C) that overrides method1 must throw the same exceptions, less exceptions or subclasses of the original exception.
- Class B does not throw the original IOException from class A, but throws FileNotFoundException (which is a subclass of IOException) - it could also have thrown ZIPException which is also a subclass of IOException
- Class C chooses to rather throw less exceptions (none actually).

Basically you can not throw more exceptions in an overridden method because logic which has based itself on the original method would not cater for the extra exceptions.

Hope this helps.

Chris
As far as I know you cannot code according to the order of messages because if one message fails (transaction rolled back) then it is placed at the back of the queue behind any messages that were posted before it.
Hi

instanceof checks if one reference to a class (an object of ClassA) is of the same type as another class (ClassB) or one of its decendant classes.

The comparison is always between an object on the left and a class on the right, and since null is not a class or an object it makes sense that you get false.


Chris
Found better solution.

For anyone interested, OAS 10.1.3 has a new Scheduler feature for jobs that need to run at a scheduled time.
18 years ago
Hi,

I am using OAS 10g (OC4J) and have a need for 'jobs' to happen in the background at scheduled times.

These 'jobs', which are unrelated and function without interaction with each other, are :
1.) Retrieve relevant data from a table and export it to a flat file.
2.) Check data in the database and send emails to a list of recipients.

I am currently looking at using the open source J2EE job scheduler 'Quartz' by Opensymphony http://www.opensymphony.com/quartz/ .

Has anyone used this successfully in OAS?

If yes, were there any problems with configuration and/or deployment?

Thanks
Chris
18 years ago
Hi,

I am busy working on a system where there is a need to persist data into two tables - this is one transaction. We currently use Direct JDBC but I am open to looking at other solutions (Hibernate, EJB CMPs, etc).

The data in Table1 is inserted by an outside system and my application must update a row in the table if it exists (only one update to this table occurs in transaction).


The data in Table2 is inserted by my application for each field that is updated in Table1 - this is the audit trail of changes to Table1.




To prove the concept I currently build up all the SQL statements, insert them into a java.sql.Statement object as a batch and then execute the batch.

This is working fine during development but I dont want to get surprised in three months when we deliver to the client.

Thanks
Chris

[ March 09, 2006: Message edited by: Chris Brat ]

[ March 09, 2006: Message edited by: Chris Brat ]
[ March 09, 2006: Message edited by: Chris Brat ]
I'd definitely say learn the basics though I prefer to use a framework.

I think most frameworks refer back to the servlet design/logic basics either to explain the inner workings of the framework itself (struts documentation describes its controller servlet and compares JSP include logic with Tiles) or how the framework aims to overcome perceived problems with Servlets and JSP.

Do all Java web developers eventually gravitate to a framework though ?

Chris
18 years ago