3. Session Bean component contract

    À̹øÀåÀº ¼¼¼Çºó°ú ÄÁÅ×ÀÌ³Ê »çÀÌÀÇ °è¾àÀ» ¼³¸íÇÑ´Ù.
    ±×°ÍÀº ¼¼¼ÇºóÀÇ »ý¸íÁֱ⸦ °áÁ¤ÇÑ´Ù.

    3.1 A container's management of its working set

        ÄÁÅ×À̳ʴ idle »óÅÂÀÇ ¼¼¼ÇºóÀ» ÀÓÀÇÀÇ secondary storage À¸·ÎÀÇ passivation ¹×
        ¹Ý´ë·Î activation(ÀÛ¾÷ÀÌ ÇÊ¿äÇÒ¶§ ¸Þ¸ð¸®·Î ¿Ã¸°´Ù) À» °ü¸®ÇÑ´Ù.

        passivation Àº ºóÀÌ Æ®·£Àè¼Ç³»¿¡ ÀÖÁö ¾ÊÀ»¶§¿¡¸¸ °¡´ÉÇÏ´Ù

        ¼¼¼ÇºóÀº ´ÙÀ½°ú °°ÀÌ µÎ°¡Áö·Î ±¸ºÐµÈ´Ù.

            - STATELESS : the Bean contains no conversational state between methods;
                                  any Bean instance can be used for any client.
            - STATEFUL : the Bean contains conversational state which must be retained
                                across methods and transactions.

    3.2 Conversational state

        A STATEFUL session Bean's conversational state ¶ó´Â°ÍÀº Á÷·ÄÈ­ °¡´ÉÇÑ field value
        ¸¦ ÀǹÌÇÑ´Ù.

        conversational state ´Â Á÷·ÄÈ­µÉ¶§ open files, open sockets, open database cursors
        µîÀÇ ¿­·ÁÀÖ´Â ÀÚ¿øÀ» Æ÷ÇÔÇÒ¼ö ÀÖÀ¸¸ç ¼¼¼ÇºóÀÌ passivate ÇÑ µ¿¾È¿¡´Â ÄÁÅ×À̳ʰ¡
        À̵é ÀÚ¿øÀ» ´Ù½Ã ȹµæÇÒ ¼ö ¾ø´Ù.
        À̿Ͱ°Àº ºó °³¹ßÀÚµéÀº ejbPassivate(), ejbActivate() ¸¦ ÀÌ¿ëÇÏ¿© ÀÌ·±ÀÚ¿øµéÀ»
        ¿­°Å³ª ´Ý¾Æ¾ß ÇÑ´Ù.

    3.3 Instance passivation and conversational state

        ÄÁÅ×À̳ʴ ÀνºÅϽº»óÀÇ ejbPassivate() ¸Þ¼Òµå°¡ È£ÃâµÉ °æ¿ì ±× ÀνºÅϽºÀÇ
        »óŸ¦ ÀúÀåÇÑ´Ù.
        ºó°³¹ßÀÚ´Â Çʵ尡 Á÷·ÄÈ­ °¡´ÉÇϵµ·Ï ÇÏ¿©¾ß Çϸç(Áï, transient ·Î ¼±¾ðÇÏÁö ¸»¾Æ¾ßÇÔ)
        ejbPassivate() È£ÃâÀÌÈÄ Á÷·ÄÈ­µÇÁö ¾ÊÀº ÀνºÅϽºµéÀº ÄÁÅ×À̳ʿ¡ ÀÇÇØ ÆÄ±«µÈ´Ù.
        Sun ¿¡¼­´Â enterprise Bean's fields ¸¦ "transient" ·Î ¼±¾ðÇÏÁö ¾Êµµ·Ï ÃßõÇÑ´Ù.

    3.4 The effect of transaction rollback on conversational state

        A session Bean's conversational state is not transactional.
        À̰ÍÀº ¼¼¼ÇºóÀÇ rollback ÀÌ ÄÁÅ×À̳ʿ¡ ÀÇÇØ ÀÚµ¿ÀûÀ¸·Î ÀÌ·ç¾îÁöÁö ¾Ê´Â´Ù´Â ¸»ÀÌ´Ù.
        µû¶ó¼­ ºó°³¹ßÀÚ´Â afterCompletion() ¸Þ¼Òµå¸¦ È£ÃâÇØ¼­ À̸¦ ±¸ÇöÇØ¾ßÇÑ´Ù.

    3.5 The protocol between a session Bean and its container

        3.5.1 The required SessionBean interface

            ¸ðµå¼¼¼ÇºóÀº SessionBean interface ¸¦ ±¸ÇöÇØ¾ß¸¸ ÇÑ´Ù.
            setSessionContext() ¸Þ¼Òµå´Â ¼¼¼Çºó ÀνºÅϽº¿Í °ü·ÃµÈ context ¸¦ À¯ÁöÇÏ´Â
            ÄÁÅ×À̳ʿ¡ ÀÇÇØ¼­ È£ÃâµÈ´Ù.
            ÀϹßÀûÀ¸·Î ¼¼¼ÇºóÀº session context ¸¦ conversational state ÀÇ ÀϺκÐÀ¸·Î¼­
            ÀçȹµæÇÑ´Ù.

        3.5.2 The SessionContext interface

            ¸ðµç ÄÁÅ×À̳ʴ SessionContext ¿Í ÇÔ²² ±×µéÀÇ ºó ÀνºÅϽº¸¦ Á¦°øÇÑ´Ù.
            À̰ÍÀº Bean instance µéÀÌ ÄÁÅ×À̳ʿ¡ ÀÇÇØ À¯ÁöµÇ´Â ±×µéÀÇ context ¸¦
            Á¢±ÙÇÒ¼ö ÀÖµµ·Ï ÇÑ´Ù.

            SessionContext ´Â ´ÙÀ½°ú °°Àº ¸Þ¼Òµå¸¦ Á¤ÀÇÇÑ´Ù.

                - The getEJBObject method returns the EJB object for the instance.

                - The getHome method returns the home interface for the instance's EJB class.

                - The getEnvironment method returns the environment properties list that the
                   Bean was deployed with.

                - The getCallerIdentity method returns the identity of the current invoker of the
                   Bean instance's EJB object.

                - The isCallerInRole predicate tests if the Bean caller has a particular role.

                - The setRollbackOnly method allows the instance to mark the current transaction
                  such that the only outcome of the transaction is a rollback.

                - The getRollbackOnly method allows the instance to test if the current
                   transaction has been marked for rollback.

                - The getUserTransaction method returns the javax.jts.UserTransaction
                   interface that the Bean can use for explicit transaction demarcation .
                   (ÄÁÅ×À̳ʴ ºóÁî°¡ TX_BEAN_MANAGED Æ®·£Á§¼Ç ¼Ó¼ºÀ» °¡Áú¶§¸¸
                    UserTransaction ÀÎÅÍÆäÀ̽º¸¦ »ç¿ë°¡´ÉÇϵµ·Ï ÇÑ´Ù. )

        3.5.3 The optional SessionSynchronization interface

            ¼¼¼ÇºóÀº Ãß°¡ÀûÀ¸·Î javax.ejb.SessionSynchronization ÀÎÅÍÆäÀ̽º¸¦
            ±¸ÇöÇÒ¼ö ÀÖ´Ù.
            ÀÌ ÀÎÅÍÆäÀ̽º´Â ºóÀÌ µ¥ÀÌÅͺ£À̽º, Æ®·£Àè¼Ç³»¿¡ ÀúÀåµÈ µ¥ÀÌŸ¸¦ ´Ù·ê¶§
           Æ®·£Àè¼Ç µ¿±âÈ­ È£ÃâÀ» °¡´ÉÇϵµ·Ï ÇÑ´Ù.

            afterBegin() ¸Þ¼Òµå´Â ¼¼¼ÇÀνºÅϽº¿¡°Ô »õ·Î¿î Æ®·£Àè¼ÇÀÌ ½ÃÀ۵Ǿú´Ù´Â °ÍÀ»
            ¾Ë¸®¸ç À̽ÃÁ¡¿¡¼­ ÀνºÅϽº´Â ÀÌ¹Ì Æ®·£Àè¼Ç³»¿¡ ÀÖÀ¸¸ç, Æ®·£Àè¼ÇÀÇ ¹üÀ§
            ¾È¿¡¼­ ¿ä±¸µÇ¾îÁø ÀÛ¾÷À» ¼öÇàÇÒ ¼ö ÀÖ´Ù.

            beforeCompletion() ¸Þ¼Òµå´Â »õ¼ÇºóÀÇ Å¬¶óÀÌ¾ðÆ®°¡ ÀÚ½ÅÀÇ ÇöÀç Æ®·£Àè¼ÇÇÏ¿¡¼­
            ÀÛ¾÷À» ¸¶ÃÆÁö¸¸, instance's resources µéÀº ¾ÆÁ÷ commit ÇÏÁö ¾ÊÀº»óÅÂÀ϶§
            È£ÃâµÈ´Ù.
            ÀνºÅϽº°¡ µ¥ÀÌŸº£À̽º¸¦ °»½ÅÇÏ´Â ½ÃÁ¡¿¡¼­ ¼¼¼Ç ÄÁÅØ½ºÆ®»óÀÇ setRollbackOnly()
            ¸¦ È£ÃâÇÔÀ¸·Î½á rollback Æ®·£Àè¼ÇÀ» ¼öÇàÇÒ ¼ö ÀÖ´Ù.

            afterCompletion(boolean committed) ¸Þ¼Òµå´Â ÇöÀç Æ®·£Àè¼ÇÀÌ ¿Ï·á µÇ¾ú´Ù´Â
            °ÍÀ» ÀǹÌÇϸç true ´Â commit, false ´Â rollback ÀÌ ¹ß»ýÇßÀ½À» ÀǹÌÇÑ´Ù.

        3.5.4 Business method delegation

            enterprise Bean's remote interface ³»¿¡ Á¤ÀÇµÈ ºñÁî´Ï½º ¸Þ¼Òµå´Â Ŭ¶óÀÌ¾ðÆ®¿¡
            ÀÇÇØ È£ÃâµÈ´Ù.
            enterprise Bean's remote interface ´Â ÄÁÅ×ÀÌ³Ê Åø¿¡ ÀÇÇØ »ý¼ºµÈ EJB object class
            ¿¡ ÀÇÇØ ½ÇÇàµÇ¸ç EJB object class ´Â ÀÌ ºñÁî´Ï½º ¸Þ¼Òµå È£ÃâÀÇ ½ÇÇàÀ»
            enterprise Bean class Ŭ·¡½º¿¡ À§ÀÓÇÑ´Ù.

        3.5.5 Session Bean's ejbCreate(...) methods

            Ŭ¶óÀÌ¾ðÆ®´Â Bean's home interface ³»¿¡ Á¤ÀÇµÈ create() ¸Þ¼ÒµåÁßÀÇ Çϳª¸¦ È£ÃâÇØ
            ¼¼¼ÇºóÀÇ ÀνºÅϽº¸¦ »ý¼ºÇÑ´Ù.
            Ȩ ÀÎÅÍÆäÀ̽º´Â ºó °³¹ßÀÚ°¡ Á¦°øÇØ¾ß ÇÏ°í ±×°ÍÀÇ ½ÇÇàÀº ÄÁÅ×À̳ʰ¡ ´ã´çÇÑ´Ù.

            -ÄÁÅ×À̳ʰ¡ ¼¼¼ÇºóÀÇ ÀνºÅϽº¸¦ »ý¼ºÇÏ´Â 3´Ü°è

                 (¿ì¼± Ŭ¶óÀÌ¾ðÆ®°¡ create() ¸Þ¼Òµå¸¦ È£ÃâÇÑ´Ù. )

                1) ÄÁÅ×À̳ʴ ºó Ŭ·¡½ºÀÇ ÀνºÅϽº¸¦ »ý¼ºÇϱâ À§ÇØ newInstance() ¸Þ¼Òµå¸¦
                  È£ÃâÇÑ´Ù.

                2)  ÄÁÅ×À̳ʴ ÀνºÅϽº¿¡ context °´Ã¼¸¦ Àü´ÞÇϱâ À§ÇØ setSessionContext()
                    ¸Þ¼Òµå¸¦ È£ÃâÇÑ´Ù.

                3) ÄÁÅ×À̳ʴ Ŭ¶óÀÌ¾ðÆ®¿¡¼­ È£ÃâµÈ create() ¸Þ¼Òµå¿Í ½Ã±×³×ó°¡ µ¿ÀÏÇÑ
                    ejbCreate() ¸Þ¼Òµå¸¦ È£ÃâÇÑ´Ù.
                    (Ŭ¶óÀÌ¾ðÆ®°¡ º¸³½ create() ¸Þ¼ÒµåÀÇ Àü´ÞÀÎÀÚ´Â ejbCreate() ¸Þ¼Òµå·Î
                     Àü´ÞµÈ´Ù.)

                ÀÌÁ¦´Â Method Ready »óÅÂÀÌ´Ù.

        3.5.6 Transaction context of session Bean methods

            session Beans ÀÇ afterBegin(), beforeCompletion() ¸Þ¼Òµå´Â °íÀ¯ÀÇ transaction
            context ¿Í ÇÔ²² È£ÃâµÇ°í (if the Bean is transactional), afterCompletion(),
            newInstance(), setSessionContext(), ejbCreate(), ejbRemove(), ejbPassivate(),
            finalize(), ejbActivate()  ¸Þ¼Òµå´Â Ç×»ó transaction ¾øÀÌ È£ÃâµÈ´Ù.

            µû¶ó¼­, session Beans ÀÇ  ejbCreate() or ejbRemove() ¸Þ¼Òµå¿¡¼­ µ¥ÀÌÅͺ£À̽º¸¦
            °»½ÅÇϴ°ÍÀº ÁÁÀº¹æ¹ýÀÌ ¾Æ´Ï´Ù.

            ¼¼¼ÇºóÁîÀÇ ºñÁî´Ï½º·ÎÁ÷ ¸Þ¼Òµå°¡ Æ®·£Àè¼Ç ³»¿¡¼­ È£ÃâµÇ´ÂÁö ¿©ºÎ´Â
            deployment descriptor ¿¡ ÀÇÇØ °áÁ¤µÈ´Ù

    3.6 STATEFUL session Bean state diagram
 
 
 
 


 

<life cycle of a STATEFUL session Bean instance>


 
 
 
 
 

        - ¼¼¼ÇºóÀÇ »ý¸íÀº Ŭ¶óÀÌ¾ðÆ®°¡ create() ¸¦ È£ÃâÇÔÀ¸·Î½á ½ÃÀ۵ȴÙ
          ±×¸®°í ³ª¸é ÄÁÅ×À̳ʴ enterprise Bean ÀÇ »õ·Î¿î °´Ã¼¸¦ ¸Þ¸ð¸®¿¡ ÇÒ´çÇϱâ
          À§ÇØ newInstance() ¸Þ¼Òµå¸¦ È£ÃâÇÑ´Ù.
          ÀÌÈÄ ÄÁÅ×À̳ʴ setSessionContext() È£ÃâÇϰí À̾ ÀνºÅϽº»óÀÇ
          ejbCreate() ¸Þ¼Òµå¸¦ È£ÃâÇÔÀ¸·Î½á EJB object reference ¸¦ Ŭ¶óÀÌ¾ðÆ®·Î
          ¸®ÅÏÇÑ´Ù.
          ÀÌ·¸°Ô »ý¼ºµÈ ÀνºÅϽº´Â ÀÌÁ¦ method ready »óÅÂÀÌ´Ù.

        - Ŭ¶óÀÌ¾ðÆ®°¡ passivated session Bean instanc ¸¦ È£ÃâÇϸé ÄÁÅ×À̳ʴÂ
           ÀνºÅϽº¸¦ Ȱ¼ºÈ­ ½Ãų°ÍÀÌ´Ù.
          ¼¼¼Ç ÀνºÅϽºÀÇ È°¼ºÈ­¸¦ À§ÇØ ÄÁÅ×À̳ʴ secondary storage ·ÎºÎÅÍ
          ÀνºÅϽºÀÇ state ¸¦ ¸Þ¸ð¸®¿¡ ·ÎµåÇϰí ejbActivate() ¸¦ È£ÃâÇÑ´Ù.
          ÀÌÁ¦ ¼¼¼ÇÀνºÅϽº´Â Ŭ¶óÀ̾ðÆ®ÀÇ È£ÃâÀ» À§ÇØ ´Ù½Ã Áغñ»óÅ¿¡ ÀÖ´Ù.

        - Ŭ¶óÀÌ¾ðÆ®°¡ EJB object »óÀÇ remove() ¸¦ È£ÃâÇϸé ÄÁÅ×À̳ʴ Bean instance
          ÀÇ ejbRemove() ¸¦ È£ÃâÇÑ´Ù. À̶§ ¼¼¼Çºó ÀνºÅϽº´Â »ý¸íÀ» ´ÙÇÏ°Ô µÈ´Ù.
          Ŭ¶óÀÌ¾ðÆ®°¡ »ý¸íÀ» ´ÙÇÑ ÀνºÅϽº¸¦ È£ÃâÇϸé java.rmi.NoSuchObjectException
          À» ¹ß»ýÇÑ´Ù.

        - ¼¼¼Ç ÀνºÅϽº°¡ Æ®·£Àè¼Ç³»¿¡ ÀÖÀ»¶§¿¡´Â remove() ¸Þ¼Òµå¸¦ È£ÃâÇÒ¼ö°¡ ¾ø´Ù.
           ¸¸¾à À̸¦ ¾î±æ°æ¿ì javax.ejb.RemoveException À» ¹ß»ýÇÒ°ÍÀÌ´Ù.

        3.6.1 transactions Á¦ÇÑ»çÇ×

            - ¼¼¼Çºó ÀνºÅϽº´Â Çѹø¿¡ ÇÑ Æ®·£Àè¼ÇÇÏ¿¡¸¸ °ü¿©ÇÒ¼ö ÀÖ´Ù.

            - ¼¼¼Çºó ÀνºÅϽº°¡ Æ®·£Àè¼Ç ³»¿¡ °ü¿©ÇÏ´Â µ¿¾È Ŭ¶óÀÌ¾ðÆ®°¡ ¼¼¼ÇºóÀÇ
               ºñÁî´Ï½º ¸Þ¼Òµå¸¦ È£ÃâÇÒ¶§ transaction context Á¸ÀçÇÏÁö ¾Ê°Å³ª ´Ù¸£´Ù¸é
               java.rmi.RemoteException ÀÌ ¹ß»ýÇÑ´Ù.
               ¸¶Âù°¡Áö·Î ¼¼¼ÇºóÀÌ Æ®·£Àè¼Ç³»¿¡ ÀÖÀ»´ë´Â remove() ¸Þ¼Òµå¸¦ È£ÃâÇÒ¼ö ¾øÀ¸¸ç
               È£ÃâÇÒ°æ¿ì javax.ejb.RemoveExceptionÀÌ ¹ß»ýÇÑ´Ù.

            - ¼¼¼Çºó¿¡¼­ rollback ÀÌ ¹ß»ýÇÒ °æ¿ì ÄÁÅ×À̳ʰ¡ ÇÒ¼ö ÀÖ´ÂÀÏÀº ¾ø´Ù.
               µ¥ÀÌŸ¸¦ ÀÌÀü»óÅ·ΠÃʱâÈ­ ÇϴµîÀÇ ¸ðµç º¹±¸´Â Ŭ¶óÀÌ¾ðÆ®°¡ Á¦°øÇØ¾ß ÇÑ´Ù.

    3.7 Sequence diagrams for a STATEFUL session Bean

        3.7.1 Note

            - ¾Æ·¡ µµÇ¥¿¡¼­ "container provided classes" ´Â ÄÁÅ×ÀÌ³Ê È¤Àº ÄÁÅ×ÀÌ³Ê Åø¿¡ ÀÇÇØ
              »ý¼ºµÈ Ŭ·¡½º¸¦ ÀǹÌÇÑ´Ù.

        3.7.2 ¼¼¼Ç°´Ã¼ÀÇ »ý¼º
 
 
 
 


 

<creation of a transactional session enterpriseBean>


 
 
 
 
 
 

        3.7.3 Starting a transaction
 
 
 
 


 
 
 
 
 
 
 

        3.7.4 Committing a transaction
 
 
 
 


 
 

<transaction synchronization protocol for a session enterprise Bean instance>


 
 
 
 
 
 

        3.7.5 Passivating and activating an instance between transactions

            ÀϹÝÀûÀ¸·Î Passivation Àº ÄÁÅ×À̳ÊÀÇ Çʿ信 ÀÇÇØ ÀÚ¹ßÀûÀ¸·Î ¹ß»ýÇϸç,
            Activation Àº Ŭ¶óÀÌ¾ðÆ®°¡ ¸Þ¼Òµå¸¦ È£ÃâÇÒ¶§ ¹ß»ýÇÑ´Ù.
 
 
 
 


 

<passivation and reactivation of a session enter-priseBean instance>


 
 
 
 
 
 

        3.7.6 Removing a session object
 
 
 
 


 
 
 
 
 
 
 

    3.8 Stateless session Beans

        Stateless session Beans Àº  conversational state ¸¦ °¡ÁöÁö ¾Ê´Â ¼¼¼Çºó ÀÌ´Ù.

        stateless session Bean ÀÇ È¨ÀÎÅÍÆäÀ̽º´Â Àü´ÞÀÎÀÚ¸¦ °¡ÁöÁö ¾Ê´Â ´Ü ÇϳªÀÇ create()
        ¸Þ¼Òµå¸¸À» Á¤ÀÇÇØ¾ßÇÏ°í ¸®ÅϰªÀº ¼¼¼ÇºóÀº ¸®¸ðÆ® ÀÎÅÍÆäÀ̽ºÀÌ´Ù.
        ÀÌ´Â session enterprise Bean class ¿¡µµ Àü´ÞÀÎÀÚ¾ø´Â ejbCreate() ¸Þ¼Òµå Çϳª¸¸
        Á¸ÀçÇÑ´Ù´Â °ÍÀÌ´Ù.

        stateless session Bean µéÀº ¸ðµÎ µ¿ÀÏÇϸç ÄÁÅ×À̳ʴ Ŭ¶óÀÌ¾ðÆ®·ÎºÎÅÍÀÇ ¿ä±¸¸¦
        ¼öÇàÇϱâ À§ÇØ »ç¿ë°¡´ÉÇÑ Àû´çÇÑ ¼¼¼ÇºóÀ» ¼±ÅÃÇÒ¼ö ÀÖ´Ù.

        ¶ÇÇÑ Passivation Àº Stateless session Beans ¸¦ À§Çؼ­´Â ÇÊ¿ä¾ø´Ù.

        stateless session Beans ´Â ÄÁÅ×À̳ÊÀÇ ½ÇÇà¿¡ ÀÇÁ¸Çϱ⠶§¹®¿¡ stateful session beans
        º¸´Ù ÀÚ¿øÀ» Àû°Ô Â÷ÁöÇÑ´Ù.
        ÇÏÁö¸¸ ÀÌ·± ÀÌÁ¡Àº stateless bean À» »ç¿ëÇϴ Ŭ¶óÀ̾ðÆ®ÀÇ º¹Àâµµ°¡ Áõ°¡ÇÔ¿¡ µû¶ó
        °¨¼ÒµÉ¼ö ÀÖ´Ù.

        Ŭ¶óÀÌ¾ðÆ®´Â stateful session Bean °ú °°Àº¹æ¹ýÀ¸·Î create(), remove() ¸Þ¼Òµå¸¦
        »ç¿ëÇÑ´Ù.

        Ŭ¶óÀÌ¾ðÆ®¿Í stateless session Bean »çÀÌ¿¡´Â Ưº°ÇÑ ¸ÅÇÎÀÌ Á¸ÀçÇÏÁö ¾ÊÀ¸¸ç
        ÄÁÅ×À̳ʴ ´ÜÁö Ŭ¶óÀÌ¾ðÆ®·ÎºÎÅÍÀÇ È£ÃâÀ» method-ready »óÅ¿¡ ÀÖ´Â ÀÓÀÇÀÇ
        ¼¼¼Çºó¿¡°Ô À§ÀÓÇÒ »ÓÀÌ´Ù.

        3.8.1 Stateless session Bean state diagram
 
 
 
 


 
 
 
 
 
 

            - stateless session Bean ÀÇ »îÀº ÄÁÅ×À̳ʰ¡ »õ·Î¿î ¸Þ¸ð¸® °´Ã¼¸¦
              »ý¼ºÇϱâÀ§ÇØ newInstance() ¸Þ¼Òµå¸¦ È£ÃâÇÔÀ¸·Î½á ½ÃÀ۵ȴÙ.
              ´ÙÀ½À¸·Î setSessionContext() ¸¦ È£ÃâÇϰí À̾ ejbCreate() ¸¦ È£ÃâÇÑ´Ù.

              ÄÁÅ×À̳ʴ Ŭ¶óÀ̾ðÆ®ÀÇ create() È£Ãâ°ú °ü°è¾øÀÌ ¾ðÁ¦µçÁö ÀνºÅϽº¸¦
              »ý¼ºÇÒ ¼ö ÀÖ´Ù.
              ÀÌÁ¦ ºó ÀνºÅϽº´Â Ŭ¶óÀÌ¾ðÆ®·ÎºÎÅÍÀÇ ¸Þ¼ÒµåÈ£ÃâÀ» À§ÀÓ¹ÞÀ»¼ö ÀÖ´Â
              Áغñ¸¦ °®Ãá °ÍÀÌ´Ù.

            - ÄÁÅ×À̳ʴ ÀνºÅϽº°¡ ´õÀÌ»ó ÇÊ¿ä¾øÀ»¶§(ÁÖ·Î method-ready pool ³»ÀÇ
               ÀνºÅϽºÀÇ ¼ö¸¦ ÁÙÀ̰íÀÚ ÇÒ¶§...) ejbRemove() ¸¦ È£ÃâÇÏ¿©
              stateless session Bean instance ÀÇ »ýÀ» ¸¶°¨½ÃŲ´Ù.

    3.9 Sequence diagrams for a STATELESS session Bean

        3.9.1 Client-invoked create()
 
 
 


 

<creation of an EJB object that is implemented by a stateless session Bean>


 
 
 
 
 
 

        3.9.2 Business method invocation
 
 
 
 


 

<invocation of a business method>


 
 
 
 
 

        3.9.3 Client-invoked remove()
 
 
 
 


 

<destruction of an EJB object that is implemented by a stateless session Bean>


 
 
 
 
 
 

        3.9.4 Adding instance to the pool
 
 
 
 


 
 
 
 
 
 

        3.9.5 Remove instance from the pool
 
 
 
 


 
 
 
 
 
 
 
 

    3.10 EnterPrise Bean provider¸¦ À§ÇÑ ¿ä±¸»çÇ×.

        ´ÙÀ½Àº session enterprise Bean Á¦°øÀÚ°¡ Ã¥ÀÓÁ®¾ßÇÒ °ÍµéÀÌ´Ù.

        3.10.1 Classes and interfaces

            enterprise Bean provider ´Â ´ÙÀ½ ¼¼°¡Áö Ŭ·¡½º ÆÄÀÏÀ» Á¦°øÇؾßÇÑ´Ù.

           - Enterprise Bean class.

           - Enterprise Bean's remote interface.

           - Enterprise Bean's home interface.
 

        3.10.2 Session Enterprise Bean class ¸¦ À§ÇÑ ¿ä±¸»çÇ×

           - Ŭ·¡½º´Â javax.ejb.SessionBean interface ¸¦ ±¸ÇöÇØ¾ß¸¸ ÇÑ´Ù.

           - Ŭ·¡½º´Â public À̾î¾ßÇϰí abstract ÀÌ ¾Æ´Ï¾î¾ß ÇÑ´Ù.

           - enterprise bean class ´Â method Àü´ÞÀÎÀÚ³ª ¸®ÅϰªÀ¸·Î
             ºÎÁÖÀÇÇÏ°Ô this ¸¦ Àü´ÞÇϴ°ÍÀ» ¸·±âÀ§ÇØ
             enterprise Bean's remote interface ¸¦ ±¸ÇöÇÏÁö ¾Ê´Â´Ù.
             (Ãßõ»çÇ×..)

           - Ŭ·¡½º´Â business methods ¿Í  ejbCreate() method ¸¦
             ±¸ÇöÇØ¾ß¸¸ ÇÑ´Ù.

           - Ŭ·¡½º´Â ¼±ÅÃÀûÀ¸·Î javax.ejb.SessionSynchronization interface¸¦
             ±¸ÇöÇÒ¼ö ÀÖ´Ù.
 

        3.10.3 ejbCreate() methods

            enterprise Bean class ´Â ´ÙÀ½¿¡ ³ª¿À´Â ±ÔÄ¢À» ÁؼöÇÏ´Â sigatures¸¦ °¡Áö´Â
            ÇϳªÀÌ»óÀÇ ejbCreate() ¸Þ¼Òµå¸¦ ±¸ÇöÇØ¾ßÇÑ´Ù.

            - The method name must be ejbCreate.

            - The method must be declared as public.

            - The return type must be void.

            - The methods arguments must be legal types for Java RMI.

            - The throws clause may define arbitrary application specific exceptions.

            - The throws clause may include java.rmi.RemoteException.

            - The throws clause may include javax.ejb.CreateException.
 

        3.10.4 Business methods

            class ´Â ´ÙÀ½¿¡ ³ª¿À´Â ±ÔÄ¢À» ÁؼöÇÏ´Â sigatures¸¦ °¡Áö´Â
            0°³ ÀÌ»óÀÇ Business methods ¸Þ¼Òµå¸¦ ±¸ÇöÇÒ¼ö ÀÖ´Ù.

            - EJB architecture ¿¡ ÀÌ¹Ì Á¤ÀÇµÈ ¸Þ¼Òµå(ejbCreate, ejbActivate, etc.)
              ¸¦ Á¦¿ÜÇÑ ¾î¶°ÇÑ À̸§À» °¡Á®µµ µÈ´Ù.

            - business method ´Â public À¸·Î ¼±¾ðµÇ¾î¾ß ÇÑ´Ù.

            - The methods arguments and return value types must be legal types for Java RMI.

            - The throws clause may define arbitrary application specific exceptions.

            - The throws clause may include java.rmi.RemoteException.
 

        3.10.5 Enterprise Bean's remote interface

            - ¹Ýµå½Ã javax.ejb.EJBObject interface ¸¦ »ó¼ÓÇØ¾ß ÇÑ´Ù.

            - ¹Ýµå½Ã public À¸·Î ¼±¾ðµÇ¾î¾ß ÇÑ´Ù.

            - ÀÌ ÀÎÅÍÆäÀ̽º¿¡ Á¤ÀÇµÈ ¸Þ¼ÒµåµéÀº RMI ±ÔÄ¢À»µû¶ó¾ß¸¸ ÇÑ´Ù.
              À̰ÍÀº ¸®ÅϰªÀ̳ª Àü´ÞÀÎÀÚ°¡ RMI ¿¡¼­ À¯¿ëÇÑ Å¸ÀÔÀ̾î¾ß Çϰí,
              java.rmi.RemoteException À» ¹ß»ýÇÒ¼ö ÀÖ¾î¾ß ÇÑ´Ù.

            - remote interface ¿¡ Á¤ÀÇµÈ ¸Þ¼Òµå´Â enterprise Bean's class ¿¡ Á¤ÀÇµÈ ¸Þ¼Òµå¿Í
              ¸Þ¼ÒµåÀ̸§, Àü´ÞÀÎÀÚ Å¸ÀÔ / °¹¼ö, ¸®ÅÏŸÀÔÀÌ °°¾Æ¾ß Çϰí,
              enterprise Bean class ÀÇ ÀÏÄ¡ÇÏ´Â ¸Þ¼ÒµåÀÇ throws Àý ¼ÓÀÇ ¸ðµç ¿¹¿ÜÀº
              remote interface ÀÇ ¸Þ¼ÒµåÀÇ throws Àý·Î ¹Ýµå½Ã Á¤ÀǵǾî¾ß ÇÑ´Ù.
 

        3.10.6 Enterprise Bean's home interface

            - javax.ejb.EJBHome interface ¸¦ »ó¼ÓÇØ¾ß¸¸ ÇÑ´Ù.

            - public À¸·Î ¼±¾ðµÇ¾î¾ß ÇÑ´Ù.

            - ÀÌ ÀÎÅÍÆäÀ̽º¿¡ Á¤ÀÇµÈ ¸Þ¼ÒµåµéÀº RMI ±ÔÄ¢À»µû¶ó¾ß¸¸ ÇÑ´Ù.
              À̰ÍÀº ¸®ÅϰªÀ̳ª Àü´ÞÀÎÀÚ°¡ RMI ¿¡¼­ À¯¿ëÇÑ Å¸ÀÔÀ̾î¾ß Çϰí,
              java.rmi.RemoteException À» ¹ß»ýÇÒ¼ö ÀÖ¾î¾ß ÇÑ´Ù.

            - session bean's home interface ´Â ÇϳªÀÌ»óÀÇ create() ¸Þ¼Òµå¸¦ Á¤ÀÇÇÑ´Ù.

            - create() ¸Þ¼Òµå´Â enterprise Bean class ¿¡ Á¤ÀÇµÈ ejbCreate() ¸Þ¼ÒµåÁßÀÇ Çϳª¿Í
              Àü´ÞÀÎÀÚ Å¸ÀÔ / °¹¼ö °¡ ÀÏÄ¡ÇØ¾ß¸¸ÇÑ´Ù. (¸®ÅÏŸÀÔÀº »ó°ü¾ø´Ù)

            - create() ¸Þ¼ÒµåÀÇ ¸®ÅÏŸÀÔÀº enterprise Bean's remote interface ŸÀÔÀ̾î¾ß¸¸
              ÇÑ´Ù.

            - enterprise Bean class ÀÇ ejbCreate() ¸Þ¼ÒµåÀÇ throws Àý¿¡ Á¤ÀÇµÈ ¸ðµç ¿¹¿Ü´Â
              remote interface ³»ÀÇ ÀÏÄ¡ÇÏ´Â create() ¸Þ¼ÒµåÀÇ throws Àý¿¡ Á¤ÀǵǾî¾ß Çϰí,
              ¶ÇÇÑ javax.ejb.CreateException À» ´øÁ®¾ß ÇÑ´Ù.
 

    3.11 container provider ¸¦ À§ÇÑ ¿ä±¸»çÇ×

        3.11.1 Generation of implementation classes

            container tools Àº enterprise Bean deployment time¿¡  ´ÙÀ½°ú°°Àº Ŭ·¡½ºµéÀ»
            Ãß°¡ÀûÀ¸·Î »ý¼ºÇؾ߸¸ ÇÑ´Ù.

           - enterprise Bean's home interface ¸¦ ±¸ÇöÇϴ Ŭ·¡½º (EJB Home class).

           - enterprise Bean's remote interface ¸¦ ±¸ÇöÇϴ Ŭ·¡½º (EJB Object class).

            ÄÁÅ×ÀÌ³Ê ÅøÀº ¶ÇÇÑ enterprise Bean class ¿Í ÄÁÅ×ÀÌ³Ê Á¾¼ÓÀûÀÎ ÄÚµåµéÀÌ
            ¼¯ÀΠŬ·¡½ºµéÀ» »ý¼ºÇÒ¼öµµ ÀÖ´Ù.

        3.11.2 EJB Home class

            EJB home class ´Â enterprise Bean's home interface ¸¦ ±¸ÇöÇÏ´Â
            ÄÁÅ×À̳ʿ¡ ÀÇÇØ »ý¼ºµÈ Ŭ·¡½ºÀÌ´Ù.

        3.11.3 EJB Object class

            EJB Object class ´Â enterprise Bean's remote interface ¸¦ ±¸ÇöÇÏ´Â
            ÄÁÅ×À̳ʿ¡ ÀÇÇØ »ý¼ºµÈ Ŭ·¡½ºÀÌ´Ù.

        3.11.4 Handle class

            ÄÁÅ×À̳ʴ enterprise Bean ÀÇ handle Ŭ·¡½º¸¦ ±¸ÇöÇÒ Ã¥ÀÓÀÌ ÀÖ°í,
            handle Ŭ·¡½º´Â Á÷·ÄÈ­ °¡´ÉÇØ¾ß¸¸ ÇÑ´Ù.

        3.11.5 Meta-data class

            ÄÁÅ×À̳ʴ Ŭ¶óÀÌ¾ðÆ®¿¡°Ô À¯¿ëÇÑ meta-data ¸¦ Á¦°øÇϴ Ŭ·¡½º¸¦
            ±¸ÇöÇÒ Ã¥ÀÓÀÌ ÀÖ´Ù.
            ÀÌ Å¬·¡½º´Â javax.ejb.EJBMetaData interface ¸¦ ±¸ÇöÇØ¾ßÇϰí,
            »ç¿ë°¡´ÉÇÑ RMI/Value class À̾î¾ß ÇÑ´Ù.

        3.11.6 Thread µ¿±âÈ­µÈ  instances

            ÄÁÅ×À̳ʴ ÇÑ ¾²·¹µå°¡ µ¿½Ã¿¡ ÇÑ ÀνºÅϽº¸¸À» ½ÇÇàÇÒ¼ö ÀÖµµ·Ï
            º¸ÀåÇØ¾ß ÇÑ´Ù.

            ÀνºÅϽº°¡ Ŭ¶óÀ̾ðÆ®ÀÇ ¿äûÀ» ½ÇÇàÇϰí ÀÖ´ÂÁß¿¡ ¶Ç´Ù¸¥ Ŭ¶óÀÌ¾ðÆ®°¡
            ¿äûÀ» ÇØ¿À¸é ÄÁÅ×À̳ʴ µÎ¹øÂ° Ŭ¶óÀÌ¾ðÆ®¿¡°Ô java.rmi.RemoteException
            À» ¹ß»ý½ÃŲ´Ù.

            Áï, session enterprise Bean Àº ÁÖ·Î ´ÜÀÏ Å¬¶óÀÌ¾ðÆ®¸¸À» »ó´ëÇϱ⠶§¹®¿¡
            °°Àº ¼¼¼Çºó ÀνºÅϽº¿¡ ¿©·¯ Ŭ¶óÀÌ¾ðÆ®°¡ È£ÃâÀ» ½ÃµµÇÏ¸é ¿¡·¯....

            °°ÀºÀǹ̷ΠŬ¶óÀÌ¾ðÆ®°¡ session Bean instance ·ÎÀÇ loopback È£ÃâÀ» ºÒ°¡´ÉÇÏ´Ù.

        3.11.7 Transaction scoping, security, exceptions