Cracking the Java Coding Interview pdfdrive com


Question What are the different identifier states of a Thread? (Core Java)


Download 1.48 Mb.
Pdf ko'rish
bet88/182
Sana02.05.2023
Hajmi1.48 Mb.
#1423275
1   ...   84   85   86   87   88   89   90   91   ...   182
Bog'liq
Cracking the Java Coding Interview ( PDFDrive )

Question What are the different identifier states of a Thread? (Core Java)
Answer
The different identifiers of a Thread are:
R - Running or runnable thread
S - Suspended thread
CW - Thread waiting on a condition variable MW - Thread waiting on a monitor
lock
MS - Thread suspended waiting on a monitor lock
Question What is the need of Remote and Home interface. Why cant it be in
one? (EJB)
Answer In a few words, I would say that the main reason is because there is a
clear division of roles and responsibilities between the two interfaces. The home
interface is your way to communicate with the container, that is who is
responsible of creating, locating even removing one or more beans. The remote
interface is your link to the bean, that will allow you to remotely access to all its
methods and members. As you can see there are two distinct elements (the
container and the beans) and you need two different interfaces for accessing to
both of them.
Question What is the difference between Java Beans and EJB?s? (EJB)
Answer Java Beans are client-side objects and EJBs are server side object, and
they have completely different development, lifecycle, purpose.
Question QuestionWith regard to Entity Beans, what happens if both my
EJB Server and Database crash, what will happen to unsaved changes? Is


there any transactional log file used? (EJB)
Answer Actually, if your EJB server crashes, you will not even be able to make
a connection to the server to perform a bean lookup, as the server will no longer
be listening on the port for incoming JNDI lookup requests. You will lose any
data that wasn't committed prior to the crash. This is where you should start
looking into clustering your EJB server.
Another Answer
Hi, Any unsaved and uncommitted changes are lost the moment your EJB Server
crashes. If your database also crashes, then all the saved changes are also lost
unless you have some backup or some recovery mechanism to retrieve the data.
So consider database replication and EJB Clustering for such scenarios, though
the occurrence of such a thing is very very rare. All database have the concept of
log files(for example oracle have redo log files concept). So if data bases crashes
then on starting up they fill look up the log files to perform all pending jobs. But
is EJB crashes, It depend upon the container how frequently it passivates or how
frequently it refreshes the data with Database.

Download 1.48 Mb.

Do'stlaringiz bilan baham:
1   ...   84   85   86   87   88   89   90   91   ...   182




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling