Java Trivia points

Source: Internet
Author: User

The difference between 1.sleep () and Wait ()

Sleep is a threading class (thread) method that causes this thread to pause execution for a specified time, giving the execution opportunity to other threads, but the monitoring state remains and is automatically restored when it is finished. Calling sleep does not release the object lock.

Wait is a method of the object class that calls the wait method on this object to cause this thread to discard the object lock, enter the waiting lock pool waiting for the object, and then enter the object lock only after the Notify method (or Notifyall) is emitted against this object

Fixed pool ready to get object lock into run state

The difference between 2.javabean and EJB

JavaBean is a reusable component, and there is no strict specification for JavaBean, in theory, any Java A class can be a Bean. But typically, because JavaBean is created by a container (such as Tomcat),

so JavaBean should have an argument-free constructor, in addition, usually javabean to implement the Serializable interface used to implement the persistence of the bean. JavaBean is actually equivalent to a local in-process COM group in the Microsoft COM model

it cannot be accessed across processes. Enterprisejavabean is equivalent to DCOM, a distributed component. It is a Java-based remote method invocation (RMI) technology, so EJBS can be accessed remotely (across processes, across computers).

However, ejbs must be in containers such as Webspere, WebLogic, and EJB clients never directly access real EJB component, but is accessed through its container. The EJB container is the proxy for the EJB component, and the EJB component is created by the container

and management. Customers access real EJB components through containers

Java Trivia points

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.