JavaÃæÊÔÌ⣨5)
72¡¢EJBµÄ½ÇÉ«ºÍÈý¸ö¶ÔÏó
¡¡Ò»¸öÍêÕûµÄ»ùÓÚEJBµÄ·Ö²¼Ê½¼ÆËã½á¹¹ÓÉÁù¸ö½ÇÉ«×é³É£¬ÕâÁù¸ö½ÇÉ«¿ÉÒÔÓɲ»Í¬µÄ¿ª·¢ÉÌÌṩ£¬Ã¿¸ö½ÇÉ«Ëù×÷µÄ¹¤×÷±ØÐë×ñÑSun¹«Ë¾ÌṩµÄEJB¹æ·¶£¬ÒÔ±£Ö¤±Ë´ËÖ®¼äµÄ¼æÈÝÐÔ¡£ÕâÁù¸ö½ÇÉ«·Ö±ðÊÇEJB×é¼þ¿ª·¢Õߣ¨Enterprise Bean Provider£©¡¢Ó¦ÓÃ×éºÏÕߣ¨Application Assembler£©¡¢²¿ÊðÕߣ¨Deployer£©¡¢EJB ·þÎñÆ÷ÌṩÕߣ¨EJB ServerProvider£©¡¢EJB ÈÝÆ÷ÌṩÕߣ¨EJB Container Provider£©¡¢ÏµÍ³¹ÜÀíÔ±£¨System Administrator£©
Èý¸ö¶ÔÏóÊÇRemote£¨Local£©½Ó¿Ú¡¢Home£¨LocalHome£©½Ó¿Ú£¬BeanÀà
73¡¢EJBÈÝÆ÷ÌṩµÄ·þÎñ
Ö÷ÒªÌṩÉùÃ÷ÖÜÆÚ¹ÜÀí¡¢´úÂë²úÉú¡¢³ÖÐøÐÔ¹ÜÀí¡¢°²È«¡¢ÊÂÎñ¹ÜÀí¡¢ËøºÍ²¢·¢ÐйÜÀíµÈ·þÎñ¡£
74¡¢EJB¹æ·¶¹æ¶¨EJBÖнûÖ¹µÄ²Ù×÷ÓÐÄÄЩ£¿
1.²»ÄܲÙ×÷Ï̺߳ÍÏß³ÌAPI(Ïß³ÌAPIÖ¸·ÇÏ̶߳ÔÏóµÄ·½·¨Èçnotify,waitµÈ)£¬
2.²»ÄܲÙ×÷awt£¬
3.²»ÄÜʵÏÖ·þÎñÆ÷¹¦ÄÜ£¬
4.²»ÄܶԾ²Ì¬ÊôÐÔ´æÈ¡£¬
5.²»ÄÜʹÓÃIO²Ù×÷Ö±½Ó´æÈ¡Îļþϵͳ£¬
6.²»ÄܼÓÔر¾µØ¿â.£¬
7.²»Äܽ«this×÷Ϊ±äÁ¿ºÍ·µ»Ø£¬
8.²»ÄÜÑ»·µ÷Óá£
75¡¢remote½Ó¿ÚºÍhome½Ó¿ÚÖ÷Òª×÷ÓÃ
remote½Ó¿Ú¶¨ÒåÁËÒµÎñ·½·¨£¬ÓÃÓÚEJB¿Í»§¶Ëµ÷ÓÃÒµÎñ·½·¨¡£
home½Ó¿ÚÊÇEJB¹¤³§ÓÃÓÚ´´½¨ºÍÒƳý²éÕÒEJBʵÀý
76¡¢bean ʵÀýµÄÉúÃüÖÜÆÚ
¡¡¡¡¶ÔÓÚStateless Session Bean¡¢Entity Bean¡¢Message DrivenBeanÒ»°ã´æÔÚ»º³å³Ø¹ÜÀí£¬¶ø¶ÔÓÚEntity BeanºÍStatefull SessionBean´æÔÚCache¹ÜÀí£¬Í¨³£°üº¬´´½¨ÊµÀý£¬ÉèÖÃÉÏÏÂÎÄ¡¢´´½¨EJBObject£¨create£©¡¢ÒµÎñ·½·¨µ÷Óá¢removeµÈ¹ý³Ì£¬¶ÔÓÚ´æÔÚ»º³å³Ø¹ÜÀíµÄBean£¬ÔÚcreateÖ®ºóʵÀý²¢²»´ÓÄÚ´æÇå³ý£¬¶øÊDzÉÓûº³å³Øµ÷¶È»úÖƲ»¶ÏÖØÓÃʵÀý£¬¶ø¶ÔÓÚ´æÔÚCache¹ÜÀíµÄBeanÔòͨ¹ý¼¤»îºÍÈ¥¼¤»î»úÖƱ£³ÖBeanµÄ״̬²¢ÏÞÖÆÄÚ´æÖÐʵÀýÊýÁ¿¡£
77¡¢EJBµÄ¼¤»î»úÖÆ
¡¡¡¡ÒÔStateful Session BeanΪÀý£ºÆäCache´óС¾ö¶¨ÁËÄÚ´æÖпÉÒÔͬʱ´æÔÚµÄBeanʵÀýµÄÊýÁ¿£¬¸ù¾ÝMRU»òNRUËã·¨£¬ÊµÀýÔÚ¼¤»îºÍÈ¥¼¤»î״̬֮¼äǨÒÆ£¬¼¤»î»úÖÆÊǵ±¿Í»§¶Ëµ÷ÓÃij¸öEJBʵÀýÒµÎñ·½·¨Ê±£¬Èç¹û¶ÔÓ¦EJBObject·¢ÏÖ×Ô¼ºÃ»Óа󶨶ÔÓ¦µÄBeanʵÀýÔò´ÓÆäÈ¥¼¤»îBean´æ´¢ÖУ¨Í¨¹ýÐòÁл¯»úÖƴ洢ʵÀý£©»Ø¸´£¨¼¤»î£©´ËʵÀý¡£×´Ì¬±äǨǰ»áµ÷ÓöÔÓ¦µÄejbActiveºÍejbPassivate·½·¨¡£
78¡¢EJBµÄ¼¸ÖÖÀàÐÍ
»á»°£¨Session£©Bean £¬ÊµÌ壨Entity£©Bean ÏûÏ¢Çý¶¯µÄ£¨Message Driven£©Bean
»á»°BeanÓÖ¿É·ÖΪÓÐ״̬£¨Stateful£©ºÍÎÞ״̬£¨Stateless£©Á½ÖÖ
ʵÌåBean¿É·ÖΪBean¹ÜÀíµÄ³ÖÐøÐÔ£¨BMP£©ºÍÈÝÆ÷¹ÜÀíµÄ³ÖÐøÐ
Ïà¹ØÎĵµ£º
°Ë javaÃæÏò¶ÔÏó³ÌÐòÉè¼Æ(¹¹Ôì·½·¨)
/**
* ÃæÏò¶ÔÏóÖ®¶þ
* ¹¹Ôì·½·¨(¹¹Ôì»ú):
*
* 1,¹¹Ôì·½·¨µÄÌØÕ÷:
* Ëü¾ßÓÐÓëÀàÏàͬµÄÃû³Æ£»
* Ëü²»º¬·µ»ØÖµ£»
* Ëü²»ÄÜÔÚ·½·¨ÖÐÓÃreturnÓï¾ä·µ»ØÒ»¸öÖµ
* ×¢Ò⣺ÔÚ¹¹Ôì·½·¨Àï²»º¬·µ»ØÖµµÄ¸ÅÄîÊDz»Í¬ÓÚ“void&rdquo ......
¾Å javaÃæÏò¶ÔÏó³ÌÐòÉè¼Æ(this¹Ø¼ü×Ö)
/**
* ÃæÏò¶ÔÏóÖ®ËÄ
* this¹Ø¼ü×Ö×ܽá
*/
/*this¹Ø¼ü×ֵĵÚÒ»ÖÖÓ÷¨*/
//ÔÚ·½·¨Öе÷ÓÃͬÀàÖеķ½·¨,ÕâʱµÄthis¿ÉÒÔÊ¡ÂÔ.
class ThisPointer
{
public void function1()
{
System.out.println("function1 is calling...");
......
ʹÓÃant.jar°ü£¨1.6°æ±¾£©£¬Íê³ÉtarµÄ´ò°ü¹¦ÄÜ£¬Ö±½ÓÌù´úÂë
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Li ......
ÔÚjava script ÖÐʵÏÖ¶ÁÈ¡/дÈëtxtÎļþµÄ²Ù×÷,
³ÌÐò´úÂë:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestEvent.aspx.cs" Inherits="TestEvent" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html ......
58¡¢Ï̵߳Ļù±¾¸ÅÄî¡¢Ï̵߳Ļù±¾×´Ì¬ÒÔ¼°×´Ì¬Ö®¼äµÄ¹Øϵ
¡¡¡¡Ïß³ÌÖ¸ÔÚ³ÌÐòÖ´Ðйý³ÌÖУ¬Äܹ»Ö´ÐгÌÐò´úÂëµÄÒ»¸öÖ´Ðе¥Î»£¬Ã¿¸ö³ÌÐòÖÁÉÙ¶¼ÓÐÒ»¸öỊ̈߳¬Ò²¾ÍÊdzÌÐò±¾Éí¡£
JavaÖеÄÏß³ÌÓÐËÄÖÖ״̬·Ö±ðÊÇ£ºÔËÐС¢¾ÍÐ÷¡¢¹ÒÆð¡¢½áÊø¡£
59¡¢JSPµÄ³£ÓÃÖ¸Áî
<%@page language="java" csession="true" buffer="64kb" autoFlush ......