Leon Omk

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

Recent posts by Leon Omk

Antipattern: Hot Potato.

It's discussed in Book "Bitter EJB". I'm wondering if it's legal to quote the book. So I give a description in my own words.

1. JMS server sends message to a MDB.
2. this MDB's onMessage() is being triggered, but unfortunally, throws EJBException(). So no acknowelage message sent back to server.
3. JMS thought Message has not been received, then re-send the message.
4. MDB does the same thing in step 2.
5. JMS Server does the same thing in step 3.
...
...

So, I think answer should be Messaging in the Business Tier
Thanks a lot!

I'll take the exams first. That class is really really expensive.
I want to get to the exams directly without taking "mandatory" course.

I'm wondering if there would be exam results (score report) in Oracle Certview after finishing the 1st part of the exam? Help, Thanks.

Ralph Jaus wrote:The trick is to use local variables. Actually your code in 3) should better be something like Now each thread works with his own entity manager instance.



Could you provide detailed description from any specification about "Now each thread works with his own entity manager instance. " ?

Sergio Tridente wrote:

Originally posted by nitin pai:
It does. The lookup is done inside your servlet's service method: once for each thread. That means, each thread will have its own PersistenceContext instance.




Personally, I hope it's sure. But I can't prove it myself. Could you provide detailed description from EJB, Jpa or any specification?
I went through the EJB 3.2 spec, seems there is no explicit description about the thread safety of EJBContext. Anyone can help?

12.2.1.5 cascade-persist
The cascade-persist subelement applies to all relationships in the persistence unit.
Specifying this subelement adds the cascade persist option to all relationships in addition to any settings
specified in annotations or XML.
The cascade-persist subelement cannot be overridden in this release.
The ability to override the cascade-persist of the persistence-unit-defaults
element will be added in a future release of this specification.



Why can't other types, such as cascade-remove, cascade-refresh,etc. be set globally? Curious and can't figure out the answer.
I'm curious about interrupting accept(). If accept() is invoked, a ServerSocket is listening at the endpoint(local server address+port).

If we close this ServerSocket directly, accept() would be interrupted and an exception would be thrown, saying "socket closed".

But if we create a new socket(not serverSocket) on the same endpoint, then close it. The serverSocket.accept() will stop silently without any exception thrown! Why is there no exception?


I want to shutdown server elegantly. In the code, serverSocket.accept() will be listening at the endpoint forever.

Approach 1, servletSocket.close() will case serverSocket.accept() to throw exception. Ugly, since my isGoingToShutdown flag is completely useless.

Approach 2, use "new Socket(serverSocket.getInetAddress(), serverSocket.getLocalPort()).close();" to interrupt serverSocket.accept(). Works. But why, why it works, and why should I do it in this way?


Result is:
  • UTF-8,*;q=0.5


  • So, request.getCharacterEncoding() is null? Why? Why not "UTF-8"?
    Where can I download the source code for these 2 jars?
    12 years ago
    JSP
    BTW, The filter configuration from Head First Servlet and JSP is like this, note that <servlet-name> is actually used for filter 2, 4


    <filter-mapping>
    <filter-name>Filter1</filter-name>
    <url-pattern>/Recipes/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Filter2</filter-name>
    <servlet-name>/Recipes/HopsList.do</servlet-name>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Filter3</filter-name>
    <url-pattern>/Recipes/Add/*</url-pattern>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Filter4</filter-name>
    <servlet-name>/Recipes/Modify/ModRecipes.do</servlet-name>
    </filter-mapping>
    <filter-mapping>
    <filter-name>Filter5</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>

    Can't find tld. But I found the schema used to validate JSP syntax.

    In jsp-api.jar in Tomcat 7.x.

    Under folder:
    javax.servlet.jsp.resources
  • jsp_2_2.xsd
  • jspxml.xsd
  • web-jsptaglibrary_2_1.xsd
  • 13 years ago
    JSP

    Celinio Fernandes wrote:That is not what the DD is made of.

    2nd and 4th filter mappings are mapped to servlet names, not url patterns.
    That is why you think the answer is wrong.




    helpful!