Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!

Midhun Agnihotram

Greenhorn
+ Follow
since Feb 20, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Midhun Agnihotram

Hi All,

Our application set up is as follows : Tomcat 5.5 + Java 1.5 + Spring 2 + Hibernate 3.3 + Atomikos + Oracle 10G. Our application session timeout is set to 30 minutes in web.xml. With some heavy processing, we find that there are a lot of INACTIVE sessions in the Database. These might be due to the user closing the window or the web session timing out, etc - it is not clear.

How do I set to close my database sessions when the web sessions close ? Is there a way to clear the database sessions if the web sessions are active ?

Thanks,
Midhun
Hey Guys,

We have a MHTML report generated by Cognos. We need to render this report inside our application's JSP itself. I am stuck with these two isses :

1. The report is generated outside location of WAR. So I cant directly import it into a JSP. Is there a way to import from a location outside the WAR ? After some googling, I found <c:import>. But it didnt work for me.

2. The second approach was to stream the file on to the JSP via the controller. The code is as below(this is also after some googling ) :




I tried with a lot of permutations and combinations of setContentType and setHeader. They too didnt help. Whenever Content Type was set to "text/mhtml" / "text/mht", there would always be a pop up of the report instead of rendering it inline (Even after setting the header to "inline").

Has anybody rendered a MHTML report before ?

Thanks,
Midhun.


8 years ago
JSP
Hi All,

We created a custom class to act as a key for HashMap as follows :





The CommonUtils.fieldChanged function is as follows :




When this class is used as a Key in HashMap and retrieve the value, I get a null - although in Debug mode I see the same key present in the HashMap too. I believe that this has got to do something with the equals / hashCode methods. Can anybody point to as what is wrong ?


Thanks,
Midhun
8 years ago
Hi All,

We have a Spring and Hibernate based J2EE application. Even though there is a logger mechanism created using log4j, many System.out.println statements are used.

As per my knowledge, Sysouts effect the performance of the application. Is there a way to redirect all Sysouts to the logger file so that it boost the performance a bit ? I donot want to change the Sysouts in all files as it is huge code base.

Thanks,
Midhun
9 years ago
Hi All,

I would like to know if there are any performance benefits in using a logger (like log4j) and using a System.out.println to print debug / info in an application server. I understand that the use of a logging mechanism is better, but has anybody seen a significant difference between them ?

Thanks,
Midhun.
9 years ago
Hi All,

For an upcoming module, I will need to use different SQL queries to display data depending on what the user inputs. The queries might change frequently. I can have these mapped in a properties file (like HashMap) or store them in a database table and query the table to get the appropriate query.

My question is which one will be more efficient ? I have the following things in mind :

Properties file - Pros
1. Ease of maintenance.
2. Quicker access to read the query - one less hit to the database.

Properties file - Cons
1. The properties file might be be huge (say 10MB) after adding all the queries. So this will occupy 10 MB of memory on server startup (we are using spring + hibernate).
2. If the properties file is not to be loaded at startup, it might be loaded multiple times if two or more users access the same module.

Database - Pros

1. No extra memory occupied like the properties file.

Database - Cons

2. Might be time taking.


I seem to be inclined towards using Properties file and load it on server startup even if occupies extra memory. Can someone please throw more light as to what else should be considered here ? And which might work better ?

Thanks,
Midhun.
9 years ago
Hi,

Rob, I am apologize for that piece of code. That filename is actually generated at runtime. To simplify, I had put it that way.

Ernest, that thing worked after I moved sos.flush() after sos.write(data);

Thanks,
Midhun.

9 years ago
Hi,

We are using a ServletOutputStream to send a file to the user for download. The code is as below. It reads a file off the disk (C:\abc.zip) and streams it to the user for download. The name of the downloaded file should have been abc.zip.






The file name was abc.zip untill we used IE6 SP2. When we upgraded to IE6 SP3, the filename of the file downloaded changed "reportGeneration.zip" (which I think it gets from the action name). I have no clue why this is happening. I have tried hard coding the filename - but it didnt work. I tried changing the contentType too - no use.

Any ideas ?

Thanks,
Midhun

P.S. I know I should upgrade my browser. But this is our firm uses.
9 years ago
Hi All,

Thanks for the replies. Jim, your explanation makes it crystal clear.


Regards,
Midhun.
9 years ago
Hi Ryan,

Thank you for the clarification. The b.process() in both the codes overrides a.process(). Doesn't it mean that b.process() 's is also expected to throw a Exception ? In which case, try/catch is required for Code 2 too ? Its obvious I missed something here.


Thanks Ritchie for the code tag. Will follow it from my next post.
9 years ago
Hi All,

The following two pieces of code have a different outcome. Please help me understand why

Code 1:
=====



Code 2:
=====



Code 1 would throw a compilation error on line 19 while code 2 would not on line 18. As far as I understand both the "process()" methods in class B should be handled in a try/catch as the super method throws an Exception. Then why does Code 2 compile and run fine while Code 1 does not ?
9 years ago