thread dump to detect deadlocks

for each thread
u see the locks held
u see what locks she’s waiting

jvm can search for wait-for cycles and shout “DEADLOCK” in the thread dump?

IDE can request a thread dump

Advertisements

dao-jsp-struts q&&a

q: every browser request would trigger an instantiation of the DAO?
A: i think so, from the DAO factory. In fact, if the request uses 2 tables, then you need 1 DAO intance for each table.

q: at a minimum, how do u keep the dao instance persistent throughout the session?
A: I don’t think you want that. If you keep 3000 DAO object in that many sessions, then you need that many connection objects! See also P 360 [[ JSP ]]

q: dao objects are placed in jndi/app/session/request scope?
A: I think you can put in request scope.

[lopri] q: jndi?

q: in a non-trivial system like hib or struts, what are the most basic “interface points” of DAO
– how does a client get a DAO? jndi?
– where does the DAO return result to? in a bean? a value object?
– how does the client receive the result?

Java design: EJB home factory

Justification: InitialContext instantiation is expensive. Use a singleton

Justification: Home Look-up is usually vendor-specific. Centralize and HIDE the vendor-specific code in a single class, instead of repeating it in every process requiring home look-up

Justification: caching