Forums Register Login

Concurrency in java.util.logging

+Pie Number of slices to send: Send
Hello everyone,

I'm writing a simple Handler for the java logging API, so that I can write log messages using JDBC. I found an example in

http://www.developer.com/java/article.php/1468351

which is precisely what I need, except that it has no mention to concurrency issues. My question is, should a Handler object be thread safe? if so, which methods can be called from multiple threads? or are all calls made to a Handler object made from the same thread?

Thanks for your help,

Juan Tamayo
+Pie Number of slices to send: Send
All the methods in the handler class are supposed to be thread safe. All JDK provided handlers, eg: FileHandler, StreamHandler synchronize the entire methods.
Since JDBC connection is not thread safe so, you have to put external synchronization in your handler.
+Pie Number of slices to send: Send
You're right, they're all synchronized. Thanks for the help!
Hey! You're stepping on my hand! Help me tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 5158 times.
Similar Threads
Calling Java Program from Stored Procedure
Thread.interrupt not working properly
HandlerChain
Redirect in Action class
Struts form bean question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 01:12:14.