锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲高清国产拍精品熟女,亚洲成A人片在线观看WWW,亚洲国产一区二区三区青草影视http://www.tkk7.com/rednight/0x2B|~0x2B,That's not a question,Just do it.zh-cnMon, 12 May 2025 14:14:43 GMTMon, 12 May 2025 14:14:43 GMT60娑堟伅涓棿浠跺拰JMShttp://www.tkk7.com/rednight/archive/2007/04/11/109941.htmlrednightrednightWed, 11 Apr 2007 08:41:00 GMThttp://www.tkk7.com/rednight/archive/2007/04/11/109941.htmlhttp://www.tkk7.com/rednight/comments/109941.htmlhttp://www.tkk7.com/rednight/archive/2007/04/11/109941.html#Feedback0http://www.tkk7.com/rednight/comments/commentRss/109941.htmlhttp://www.tkk7.com/rednight/services/trackbacks/109941.html褰撳墠錛孋ORBA銆丏COM銆丷MI絳塕PC涓棿浠舵妧鏈凡騫挎硾搴旂敤浜庡悇涓鍩熴備絾鏄潰瀵硅妯″拰澶嶆潅搴﹂兘瓚婃潵瓚婇珮鐨勫垎甯冨紡緋葷粺錛岃繖浜涙妧鏈篃鏄劇ず鍑哄叾灞闄愭э細(xì)錛?錛夊悓姝ラ氫俊錛氬鎴峰彂鍑鴻皟鐢ㄥ悗錛屽繀欏葷瓑寰呮湇鍔″璞″畬鎴愬鐞嗗茍榪斿洖緇撴灉鍚庢墠鑳界戶緇墽琛岋紱錛?錛夊鎴峰拰鏈嶅姟瀵硅薄鐨勭敓鍛藉懆鏈熺揣瀵嗚﹀悎錛氬鎴瘋繘紼嬪拰鏈嶅姟瀵硅薄榪涚▼閮藉繀欏繪甯歌繍琛岋紱濡傛灉鐢變簬鏈嶅姟瀵硅薄宕╂簝鎴栬呯綉緇滄晠闅滃鑷村鎴風(fēng)殑璇鋒眰涓嶅彲杈撅紝瀹㈡埛浼?xì)鎺ユ敹鍒板紓甯稿Q涳紙3錛夌偣瀵圭偣閫氫俊錛氬鎴風(fēng)殑涓嬈¤皟鐢ㄥ彧鍙戦佺粰鏌愪釜鍗曠嫭鐨勭洰鏍囧璞°?
   闈㈠悜娑堟伅鐨勪腑闂翠歡錛圡essage Oriented Middleware錛孧OM錛夎緝濂界殑瑙e喅浜嗕互涓婇棶棰樸傚彂閫佽呭皢娑堟伅鍙戦佺粰娑堟伅鏈嶅姟鍣紝娑堟伅鏈嶅姟鍣ㄥ皢娑堟伅瀛樻斁鍦ㄨ嫢騫查槦鍒椾腑錛屽湪鍚堥傜殑鏃跺欏啀灝嗘秷鎭漿鍙戠粰鎺ユ敹鑰呫傝繖縐嶆ā寮忎笅錛屽彂閫佸拰鎺ユ敹鏄紓姝ョ殑錛屽彂閫佽呮棤闇絳夊緟錛涗簩鑰呯殑鐢熷懡鍛ㄦ湡鏈繀鐩稿悓錛氬彂閫佹秷鎭殑鏃跺欐帴鏀惰呬笉涓瀹氳繍琛岋紝鎺ユ敹娑堟伅鐨勬椂鍊欏彂閫佽呬篃涓嶄竴瀹氳繍琛岋紱涓瀵瑰閫氫俊錛氬浜庝竴涓秷鎭彲浠ユ湁澶氫釜鎺ユ敹鑰呫?
   宸叉湁鐨凪OM緋葷粺鍖呮嫭IBM鐨凪QSeries銆丮icrosoft鐨凪SMQ鍜孊EA鐨凪essageQ絳夈傜敱浜庢病鏈変竴涓氱敤鐨勬爣鍑嗭紝榪欎簺緋葷粺寰堥毦瀹炵幇浜掓搷浣滃拰鏃犵紳榪炴帴銆侸ava Message Service錛圝MS錛夋槸SUN鎻愬嚭鐨勬棬鍦ㄧ粺涓鍚勭MOM緋葷粺鎺ュ彛鐨勮鑼冿紝瀹冨寘鍚偣瀵圭偣錛圥oint to Point錛孭TP錛夊拰鍙戝竷/璁㈤槄錛圥ublish/Subscribe錛宲ub/sub錛変袱縐嶆秷鎭ā鍨嬶紝鎻愪緵鍙潬娑堟伅浼犺緭銆佷簨鍔″拰娑堟伅榪囨護(hù)絳夋満鍒躲?/font>

1.JMS
   JAVA 娑堟伅鏈嶅姟(JMS)瀹氫箟浜咼ava 涓闂秷鎭腑闂翠歡鐨勬帴鍙c侸MS 鍙槸鎺ュ彛錛屽茍娌℃湁緇欎簣瀹炵幇錛屽疄鐜癑MS 鎺ュ彛鐨勬秷鎭腑闂翠歡縐頒負(fù)JMS Provider錛宨Link瀹炵幇浜咼MS鎺ュ彛錛岀敤鎴峰彲浠ラ氳繃浣跨敤JMS鎺ュ彛錛屽湪iLink涓繘琛孞MS緙栫▼銆?iLink鏀寔JMS1.0.2鐗堟湰銆?

2.JMS鎺ュ彛鎻忚堪
   JMS 鏀寔涓ょ娑堟伅綾誨瀷PTP 鍜孭ub/Sub錛屽垎鍒О浣滐細(xì)PTP Domain 鍜孭ub/Sub Domain錛岃繖涓ょ鎺ュ彛閮界戶鎵跨粺涓鐨凧MS鐖舵帴鍙o紝JMS 涓昏鎺ュ彛濡備笅鎵紺猴細(xì)

MS鐖舵帴鍙?/font>

PTP

Pub/Sub

ConnectionFactory

QueueConnectionFactory

TopicConnectionFactory

Connection

QueueConnection

TopicConnection

Destination

Queue

Topic

Session

QueueSession

TopicSession

MessageProducer

QueueSender

TopicPublisher

MessageConsumer

QueueReceiver,QueueBrowse r

TopicSubscriber

 

 

 

                  
   ConnectionFactory 錛氳繛鎺ュ伐鍘傦紝JMS 鐢ㄥ畠鍒涘緩榪炴帴
   Connection 錛欽MS 瀹㈡埛绔埌JMS Provider 鐨勮繛鎺?br>   Destination 錛氭秷鎭殑鐩殑鍦?br>   Session錛?涓涓彂閫佹垨鎺ユ敹娑堟伅鐨勭嚎紼?br>   MessageProducer錛?鐢盨ession 瀵硅薄鍒涘緩鐨勭敤鏉ュ彂閫佹秷鎭殑瀵硅薄
   MessageConsumer錛?鐢盨ession 瀵硅薄鍒涘緩鐨勭敤鏉ユ帴鏀舵秷鎭殑瀵硅薄

3.JMS娑堟伅妯″瀷
JMS 娑堟伅鐢變互涓嬪嚑閮ㄥ垎緇勬垚錛氭秷鎭ご錛屽睘鎬э紝娑堟伅浣撱?br>  
3.1 娑堟伅澶?Header) - 娑堟伅澶村寘鍚秷鎭殑璇嗗埆淇℃伅鍜岃礬鐢變俊鎭紝娑堟伅澶村寘鍚竴浜涙爣鍑嗙殑灞炴у錛欽MSDestination,JMSMessageID 絳夈?

 娑堟伅澶?/font>

 鐢辮皝璁劇疆

JMSDestination

send 鎴?publish 鏂規(guī)硶

JMSDeliveryMode

send 鎴?publish 鏂規(guī)硶

JMSExpiration

send 鎴?publish 鏂規(guī)硶

JMSPriority

send 鎴?publish 鏂規(guī)硶

JMSMessageID

send 鎴?publish 鏂規(guī)硶

JMSTimestamp

send 鎴?publish 鏂規(guī)硶

JMSCorrelationID

瀹㈡埛

JMSReplyTo

瀹㈡埛

JMSType

瀹㈡埛

JMSRedelivered

JMS Provider

 

 

        
 

 

 

      


3.2 灞炴?Properties)
- 闄や簡娑堟伅澶翠腑瀹氫箟濂界殑鏍囧噯灞炴у錛孞MS 鎻愪緵涓縐嶆満鍒跺鍔犳柊灞炴у埌娑堟伅澶?涓紝榪欑鏂板睘鎬у寘鍚互涓嬪嚑縐嶏細(xì)
   1. 搴旂敤闇瑕佺敤鍒扮殑灞炴?
   2. 娑堟伅澶翠腑鍘熸湁鐨勪竴浜涘彲閫夊睘鎬?
   3. JMS Provider 闇瑕佺敤鍒扮殑灞炴с?br>   鏍囧噯鐨凧MS 娑堟伅澶村寘鍚互涓嬪睘鎬э細(xì)

JMSDestination

娑堟伅鍙戦佺殑鐩殑鍦?/font>

JMSDeliveryMode

浼犻掓ā寮忥紝 鏈変袱縐嶆ā寮忥細(xì) PERSISTENT 鍜孨ON_PERSISTENT錛孭ERSISTENT 琛ㄧず璇ユ秷鎭竴瀹氳琚佸埌鐩殑鍦幫紝鍚﹀垯浼?xì)瀵艰嚧搴旂敤閿欒銆侼ON_PERSISTENT 琛ㄧず鍋剁劧涓㈠け璇ユ秷鎭槸琚厑璁哥殑錛岃繖涓ょ妯″紡浣垮紑鍙戣呭彲浠ュ湪娑堟伅浼犻掔殑鍙潬鎬у拰鍚炲悙閲忎箣闂存壘鍒板鉤琛$偣銆?/font>

JMSMessageID

鍞竴璇嗗埆姣忎釜娑堟伅鐨勬爣璇嗭紝鐢盝MS Provider 浜х敓銆?/font>

JMSTimestamp

涓涓秷鎭鎻愪氦緇橨MS Provider 鍒版秷鎭鍙戝嚭鐨勬椂闂淬?/font>

JMSCorrelationID

鐢ㄦ潵榪炴帴鍒板彟澶栦竴涓秷鎭紝鍏稿瀷鐨勫簲鐢ㄦ槸鍦ㄥ洖澶嶆秷鎭腑榪炴帴鍒板師娑堟伅銆?/font>

JMSReplyTo

鎻愪緵鏈秷鎭洖澶嶆秷鎭殑鐩殑鍦板潃

JMSRedelivered

濡傛灉涓涓鎴風(fēng)鏀跺埌涓涓緗簡JMSRedelivered 灞炴х殑娑堟伅錛屽垯琛ㄧず鍙兘璇ュ鎴風(fēng)鏇劇粡鍦ㄦ棭浜涙椂鍊欐敹鍒拌繃璇ユ秷鎭紝浣嗗茍娌℃湁絳炬敹(acknowledged)銆?/font>

JMSType

娑堟伅綾誨瀷鐨勮瘑鍒銆?/font>

JMSExpiration

娑堟伅榪囨湡鏃墮棿錛岀瓑浜嶲ueueSender 鐨剆end 鏂規(guī)硶涓殑timeToLive 鍊兼垨TopicPublisher 鐨刾ublish 鏂規(guī)硶涓殑timeToLive 鍊煎姞涓婂彂閫佹椂鍒葷殑GMT 鏃墮棿鍊箋傚鏋渢imeToLive鍊肩瓑浜庨浂錛屽垯JMSExpiration 琚涓洪浂錛岃〃紺鴻娑堟伅姘鎬笉榪囨湡銆傚鏋滃彂閫佸悗錛屽湪娑堟伅榪囨湡鏃墮棿涔嬪悗娑堟伅榪樻病鏈夎鍙戦佸埌鐩殑鍦幫紝鍒欒娑堟伅琚竻闄ゃ?/font>

JMSPriority

娑堟伅浼樺厛綰э紝浠?-9 鍗佷釜綰у埆錛?-4 鏄櫘閫氭秷鎭紝5-9 鏄姞鎬ユ秷鎭侸MS 涓嶈姹侸MS Provider 涓ユ牸鎸夌収榪欏崄涓紭鍏堢駭鍙戦佹秷鎭紝浣嗗繀欏諱繚璇佸姞鎬ユ秷鎭鍏堜簬鏅氭秷鎭埌杈俱?/font>

 

 

 

 

 

 

 

 

 

 



3.3 娑堟伅浣?Body) - JMS API 瀹氫箟浜?縐嶆秷鎭綋鏍煎紡錛屼篃鍙秷鎭被鍨嬶紝浣犲彲浠ヤ嬌鐢ㄤ笉鍚屽艦寮忓彂閫佹帴鏀?鏁版嵁騫跺彲浠ュ吋瀹圭幇鏈夌殑娑堟伅鏍煎紡錛屼笅闈㈡弿榪拌繖5縐嶇被鍨嬶細(xì)

娑堟伅綾誨瀷

娑堟伅浣?/font>

TextMessage

java.lang.String瀵硅薄錛屽xml鏂囦歡鍐呭

MapMessage

鍚?鍊煎鐨勯泦鍚堬紝鍚嶆槸String瀵硅薄錛屽肩被鍨嬪彲浠ユ槸Java浠諱綍鍩烘湰綾誨瀷

BytesMessage

瀛楄妭嫻?/font>

StreamMessage

Java涓殑杈撳叆杈撳嚭嫻?/font>

ObjectMessage

Java涓殑鍙簭鍒楀寲瀵硅薄

Message

娌℃湁娑堟伅浣擄紝鍙湁娑堟伅澶村拰灞炴?/font>













涓嬩緥婕旂ず鍒涘緩騫跺彂閫佷竴涓猅extMessage鍒頒竴涓槦鍒楋細(xì)
TextMessage message = queueSession.createTextMessage();
message.setText(msg_text); // msg_text is a String
queueSender.send(message);

涓嬩緥婕旂ず鎺ユ敹娑堟伅騫惰漿鎹負(fù)鍚堥傜殑娑堟伅綾誨瀷錛?
Message m = queueReceiver.receive();
if (m instanceof TextMessage) {
 TextMessage message = (TextMessage) m;
 System.out.println("Reading message: " + message.getText());
} else {
 // Handle error
}

4. 娑堟伅鐨勫悓姝ュ紓姝ユ帴鏀?br>   娑堟伅鐨勫悓姝ユ帴鏀舵槸鎸囧鎴風(fēng)涓誨姩鍘繪帴鏀舵秷鎭紝JMS 瀹㈡埛绔彲浠ラ噰鐢∕essageConsumer 鐨剅eceive鏂規(guī)硶鍘繪帴鏀朵笅涓涓秷鎭?br>   娑堟伅鐨勫紓姝ユ帴鏀舵槸鎸囧綋娑堟伅鍒拌揪鏃訛紝涓誨姩閫氱煡瀹㈡埛绔侸MS 瀹㈡埛绔彲浠ラ氳繃娉ㄥ唽涓涓疄 鐜癕essageListener 鎺ュ彛鐨勫璞″埌MessageConsumer錛岃繖鏍鳳紝姣忓綋娑堟伅鍒拌揪鏃訛紝JMS Provider 浼?xì)璋冪敤MessageListener涓殑onMessage 鏂規(guī)硶銆?

5. PTP妯″瀷
PTP(Point-to-Point)妯″瀷鏄熀浜庨槦鍒楃殑錛屽彂閫佹柟鍙戞秷鎭埌闃熷垪錛屾帴鏀舵柟浠庨槦鍒楁帴鏀舵秷鎭紝闃熷垪鐨勫瓨鍦ㄤ嬌寰楁秷鎭殑寮傛浼犺緭鎴愪負(fù)鍙兘銆傚拰閭歡緋葷粺涓殑閭涓鏍鳳紝闃熷垪鍙互鍖呭惈鍚勭娑堟伅錛孞MS Provider 鎻?渚涘伐鍏風(fēng)鐞嗛槦鍒楃殑鍒涘緩銆佸垹闄ゃ侸MS PTP 妯″瀷瀹氫箟浜嗗鎴風(fēng)濡備綍鍚戦槦鍒楀彂閫佹秷鎭紝浠庨槦鍒楁帴鏀舵秷鎭紝嫻忚闃熷垪涓殑娑堟伅銆?br>   涓嬮潰鎻忚堪JMS PTP 妯″瀷涓殑涓昏姒傚康鍜屽璞★細(xì)

鍚嶇О

鎻忚堪

Queue

鐢盝MS Provider 綆$悊錛岄槦鍒楃敱闃熷垪鍚嶈瘑鍒紝瀹㈡埛绔彲浠ラ氳繃JNDI 鎺ュ彛鐢ㄩ槦鍒楀悕寰楀埌涓涓槦鍒楀璞°?/font>

TemporaryQueue

鐢盦ueueConnection 鍒涘緩錛岃屼笖鍙兘鐢卞垱寤哄畠鐨凲ueueConnection 浣跨敤銆?/font>

QueueConnectionFactory

瀹㈡埛绔敤QueueConnectionFactory 鍒涘緩QueueConnection 瀵硅薄銆?/font>

QueueConnection

涓涓埌JMS PTP provider 鐨勮繛鎺ワ紝瀹㈡埛绔彲浠ョ敤QueueConnection 鍒涘緩QueueSession 鏉ュ彂閫佸拰鎺ユ敹娑堟伅銆?/font>

QueueSession

鎻愪緵涓浜涙柟娉曞垱寤篞ueueReceiver 銆丵ueueSender銆丵ueueBrowser 鍜孴emporaryQueue銆傚鏋滃湪QueueSession 鍏抽棴鏃訛紝鏈変竴浜涙秷鎭凡緇忚鏀跺埌錛屼絾榪樻病鏈夎絳炬敹(acknowledged)錛岄偅涔堬紝褰撴帴鏀惰呬笅嬈¤繛鎺ュ埌鐩稿悓鐨勯槦鍒楁椂錛岃繖浜涙秷鎭繕浼?xì)琚啀娆℃帴鏀躲?/font>

QueueReceiver

瀹㈡埛绔敤QueueReceiver 鎺ユ敹闃熷垪涓殑娑堟伅錛屽鏋滅敤鎴峰湪QueueReceiver 涓瀹氫簡娑堟伅閫夋嫨鏉′歡錛岄偅涔堜笉絎﹀悎鏉′歡鐨勬秷鎭細(xì)鐣欏湪闃熷垪涓紝涓嶄細(xì)琚帴鏀跺埌銆?/font>

QueueSender

瀹㈡埛绔敤QueueSender 鍙戦佹秷鎭埌闃熷垪銆?/font>

QueueBrowser

瀹㈡埛绔彲浠ueueBrowser 嫻忚闃熷垪涓殑娑堟伅錛屼絾涓嶄細(xì)鏀惰蛋娑堟伅銆?/font>

QueueRequestor

JMS 鎻愪緵QueueRequestor 綾葷畝鍖栨秷鎭殑鏀跺彂榪囩▼銆俀ueueRequestor 鐨勬瀯閫犲嚱鏁版湁涓や釜鍙傛暟錛歈ueueSession 鍜宷ueue錛孮ueueRequestor 閫氳繃鍒涘緩涓涓復(fù)鏃墮槦鍒楁潵瀹屾垚鏈緇堢殑鏀跺彂娑堟伅璇鋒眰銆?/font>

鍙潬鎬?Reliability)

闃熷垪鍙互闀夸箙鍦頒繚瀛樻秷鎭洿鍒版帴鏀惰呮敹鍒版秷鎭傛帴鏀惰呬笉闇瑕佸洜涓烘媴蹇冩秷鎭細(xì)涓㈠け鑰屾椂鍒誨拰闃熷垪淇濇寔嬋媧葷殑榪炴帴鐘舵侊紝鍏呭垎浣撶幇浜嗗紓姝ヤ紶杈撴ā寮忕殑浼樺娍銆?/font>



              
          
  
 

 

 

 

 

 

 

 

 


6. PUB/SUB妯″瀷
JMS Pub/Sub 妯″瀷瀹氫箟浜嗗浣曞悜涓涓唴瀹硅妭鐐瑰彂甯冨拰璁㈤槄娑堟伅錛岃繖浜涜妭鐐硅縐頒綔涓婚(topic)銆?br>   涓婚鍙互琚涓烘槸娑堟伅鐨勪紶杈撲腑浠嬶紝鍙戝竷鑰?publisher)鍙戝竷娑堟伅鍒頒富棰橈紝璁㈤槄鑰?subscribe)浠庝富棰樿闃呮秷鎭備富棰樹嬌寰楁秷鎭闃呰呭拰娑堟伅鍙戝竷鑰呬繚鎸佷簰鐩哥嫭绔嬶紝涓嶉渶瑕佹帴瑙﹀嵆鍙繚璇佹秷鎭殑浼犻併?br>   涓嬮潰鎻忚堪JMS Pub/Sub 妯″瀷涓殑涓昏姒傚康鍜屽璞★細(xì)

鍚嶇О

鎻忚堪

璁㈤槄(subscription)

娑堟伅璁㈤槄鍒嗕負(fù)闈炴寔涔呰闃?non-durable subscription)鍜屾寔涔呰闃?durable subscrip-tion)錛岄潪鎸佷箙璁㈤槄鍙湁褰撳鎴風(fēng)澶勪簬嬋媧葷姸鎬侊紝涔熷氨鏄拰JMS Provider 淇濇寔榪炴帴鐘舵佹墠鑳芥敹鍒板彂閫佸埌鏌愪釜涓婚鐨勬秷鎭紝鑰屽綋瀹㈡埛绔浜庣綰跨姸鎬侊紝榪欎釜鏃墮棿孌靛彂鍒頒富棰樼殑娑堟伅灝嗕細(xì)涓㈠け錛屾案榪滀笉浼?xì)鏀跺埌銆傛寔涔呰闃呮椂錛屽鎴風(fēng)鍚慗MS 娉ㄥ唽涓涓瘑鍒嚜宸辮韓浠界殑ID錛屽綋榪欎釜瀹㈡埛绔浜庣綰挎椂錛孞MS Provider 浼?xì)湄?fù)榪欎釜ID 淇濆瓨鎵鏈夊彂閫佸埌涓婚鐨勬秷鎭紝褰撳鎴峰啀嬈¤繛鎺ュ埌JMS Provider鏃訛紝浼?xì)鏍规嵁鑷忿q殑ID 寰楀埌鎵鏈夊綋鑷繁澶勪簬紱葷嚎鏃跺彂閫佸埌涓婚鐨勬秷鎭?/font>

Topic

涓婚鐢盝MS Provider 綆$悊錛屼富棰樼敱涓婚鍚嶈瘑鍒紝瀹㈡埛绔彲浠ラ氳繃JNDI 鎺ュ彛鐢ㄤ富棰樺悕寰楀埌涓涓富棰樺璞°侸MS 娌℃湁緇欏嚭涓婚鐨勭粍緇囧拰灞傛緇撴瀯鐨勫畾涔夛紝鐢盝MS Provider 鑷繁瀹氫箟銆?/font>

TemporaryTopic

涓存椂涓婚鐢盩opicConnection 鍒涘緩錛岃屼笖鍙兘鐢卞垱寤哄畠鐨凾opicConnection 浣跨敤銆備復(fù)鏃朵富棰樹笉鑳芥彁渚涙寔涔呰闃呭姛鑳姐?/font>

TopicConnectionFactory

瀹㈡埛绔敤TopicConnectionFactory 鍒涘緩TopicConnection 瀵硅薄銆?/font>

TopicConnection

TopicConnection 鏄竴涓埌JMS Pub/Sub provider 鐨勮繛鎺ワ紝瀹㈡埛绔彲浠ョ敤TopicConnection鍒涘緩TopicSession 鏉ュ彂甯冨拰璁㈤槄娑堟伅銆?/font>

TopicSession

TopicSession 鎻愪緵涓浜涙柟娉曞垱寤篢opicPublisher銆乀opicSubscriber銆乀emporaryTopic 銆傚畠榪樻彁渚泆nsubscribe 鏂規(guī)硶鍙栨秷娑堟伅鐨勬寔涔呰闃呫?/font>

TopicPublisher

瀹㈡埛绔敤TopicPublisher 鍙戝竷娑堟伅鍒頒富棰樸?/font>

TopicSubscriber

瀹㈡埛绔敤TopicSubscriber 鎺ユ敹鍙戝竷鍒頒富棰樹笂鐨勬秷鎭傚彲浠ュ湪TopicSubscriber 涓緗秷鎭繃婊ゅ姛鑳斤紝榪欐牱錛屼笉絎﹀悎瑕佹眰鐨勬秷鎭笉浼?xì)琚帴鏀躲?/font>

Durable TopicSubscriber

濡傛灉涓涓鎴風(fēng)闇瑕佹寔涔呰闃呮秷鎭紝鍙互浣跨敤Durable TopicSubscriber錛孴opSession 鎻愪緵涓涓柟娉昪reateDurableSubscriber鍒涘緩Durable TopicSubscriber 瀵硅薄銆?/font>

鎭㈠鍜岄噸鏂版淳閫?Recovery and Redelivery)

闈炴寔涔呰闃呯姸鎬佷笅錛屼笉鑳芥仮澶嶆垨閲嶆柊媧鵑佷竴涓湭絳炬敹鐨勬秷鎭傚彧鏈夋寔涔呰闃呮墠鑳芥仮澶嶆垨閲嶆柊媧鵑佷竴涓湭絳炬敹鐨勬秷鎭?/font>

TopicRequestor

JMS 鎻愪緵TopicRequestor 綾葷畝鍖栨秷鎭殑鏀跺彂榪囩▼銆俆opicRequestor 鐨勬瀯閫犲嚱鏁版湁涓や釜鍙傛暟錛歍opicSession 鍜宼opic銆俆opicRequestor 閫氳繃鍒涘緩涓涓復(fù)鏃朵富棰樻潵瀹屾垚鏈緇堢殑鍙戝竷鍜屾帴鏀舵秷鎭姹傘?/font>

鍙潬鎬?Reliability)

褰撴墍鏈夌殑娑堟伅蹇呴』琚帴鏀訛紝鍒欑敤鎸佷箙璁㈤槄妯″紡銆傚綋涓㈠け娑堟伅鑳藉琚蹇嶏紝鍒欑敤闈炴寔涔呰闃呮ā寮忋?/font>

 

 

 

 

 

 

 


 

 


 
 
 
 
 
 
 
 
 




7. 寮鍙慗MS鐨勬楠?br>
   騫夸箟涓婅錛屼竴涓狫MS 搴旂敤鏄嚑涓狫MS 瀹㈡埛绔氦鎹㈡秷鎭紝寮鍙慗MS 瀹㈡埛绔簲鐢ㄧ敱浠ヤ笅鍑犳鏋勬垚錛?
鐢↗NDI 寰楀埌ConnectionFactory 瀵硅薄錛?
鐢↗NDI 寰楀埌鐩爣闃熷垪鎴栦富棰樺璞★紝鍗矰estination 瀵硅薄錛?
鐢–onnectionFactory 鍒涘緩Connection 瀵硅薄錛?
鐢–onnection 瀵硅薄鍒涘緩涓涓垨澶氫釜JMS Session錛?
鐢⊿ession 鍜孌estination 鍒涘緩MessageProducer 鍜孧essageConsumer錛?
閫氱煡Connection 寮濮嬩紶閫掓秷鎭?/font>



rednight 2007-04-11 16:41 鍙戣〃璇勮
]]>
緇忓父紕板埌xml鏂囦歡瑙f瀽閿欒鍙互鑰冭檻鏄笉鏄敱浜庢枃鏈紪杈戝櫒鑰屽鑷寸殑闂http://www.tkk7.com/rednight/archive/2007/01/16/94099.htmlrednightrednightTue, 16 Jan 2007 01:09:00 GMThttp://www.tkk7.com/rednight/archive/2007/01/16/94099.htmlhttp://www.tkk7.com/rednight/comments/94099.htmlhttp://www.tkk7.com/rednight/archive/2007/01/16/94099.html#Feedback0http://www.tkk7.com/rednight/comments/commentRss/94099.htmlhttp://www.tkk7.com/rednight/services/trackbacks/94099.html闂鎻忚堪:
    <[ServletContext(id=18489944,name=EBLGWeb,context-path=/)]: Deployment descriptor "/WEB-INF/bhr-tags-pagination.tld" is malformed. Check against the DTD: Content is not allowed in prolog. (line 1, column 1).>
    <[ServletContext(id=18489944,name=EBLGWeb,context-path=/)]: Error while parsing the Tag Library Descriptor at "/WEB-INF/bhr-tags-pagination.tld".
org.xml.sax.SAXException: [HTTP:101248][ServletContext(id=18489944,name=EBLGWeb,context-path=/)]: Deployment descriptor "/WEB-INF/bhr-tags-pagination.tld" is malformed. Check against the DTD: Content is not allowed in prolog. (line 1, column 1).
        at weblogic.apache.xerces.parsers.DOMParser.parse(DOMParser.java:285)
        at weblogic.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201)
        at weblogic.servlet.jsp.dd.JSPEntityResolver.load(JSPEntityResolver.java:81)
        at weblogic.servlet.jsp.dd.JSPEntityResolver.load(JSPEntityResolver.java:96)
        at weblogic.servlet.internal.WebAppHelper.registerTagLibListeners(WebAppHelper.java:293)
        at weblogic.servlet.internal.WebAppServletContext.activateFromDescriptors(WebAppServletContext.java:2530)
        at weblogic.servlet.internal.WebAppServletContext.activate(WebAppServletContext.java:6163)
        at weblogic.servlet.internal.WebAppServletContext.setActive(WebAppServletContext.java:6141)
        at weblogic.servlet.internal.WebAppModule.activate(WebAppModule.java:836)
        at weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:3322)
        at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2201)
        at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2174)
        at weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:2122)
        at weblogic.management.deploy.slave.SlaveDeployer$Application.setActivation(SlaveDeployer.java:3099)
        at weblogic.management.deploy.slave.SlaveDeployer.setActivationStateForAllApplications(SlaveDeployer.java:1768)
        at weblogic.management.deploy.slave.SlaveDeployer.resume(SlaveDeployer.java:351)
        at weblogic.management.deploy.DeploymentManagerServerLifeCycleImpl.resume(DeploymentManagerServerLifeCycleImpl.java:229)
        at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:136)
        at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:965)
        at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:360)
        at weblogic.Server.main(Server.java:32)
>
鍘熷洜鍒嗘瀽鍜岃В鍐蟲柟娉?
鏄敱浜庢煇浜涙枃鏈紪杈戝櫒錛圲ltraEdit錛夊瓨鏂囨湰鐨勬椂鍊欎駭鐢熺殑闂銆傚彲浠ヤ嬌鐢╰ext pad, word pad緙栬緫XML鏍煎紡鐨勬枃浠躲?


rednight 2007-01-16 09:09 鍙戣〃璇勮
]]>
鏈夋椂WLS-Apache Proxy Plugin鐢變簬timeout鐨勮緗繃鐭岃涓哄鐞嗗畠杞彂璇鋒眰鐨勫簲鐢ㄦ湇鍔″櫒姝繪帀浜嗚岃繘琛孎ailvoerhttp://www.tkk7.com/rednight/archive/2007/01/16/94098.htmlrednightrednightTue, 16 Jan 2007 01:09:00 GMThttp://www.tkk7.com/rednight/archive/2007/01/16/94098.htmlhttp://www.tkk7.com/rednight/comments/94098.htmlhttp://www.tkk7.com/rednight/archive/2007/01/16/94098.html#Feedback0http://www.tkk7.com/rednight/comments/commentRss/94098.htmlhttp://www.tkk7.com/rednight/services/trackbacks/94098.html闂鎻忚堪:
閫氳繃HTTP鎻愪氦EDI璇鋒眰,褰揈DI澶勭悊鏃墮棿瓚呰繃浜?0鍒嗛挓鍚?灝變細(xì)鐪嬪埌鍦ㄥ彟涓涓獁eblogic server涔熸帴鏀跺埌浜嗚繖涓狤DI璇鋒眰,閲嶆柊澶勭悊榪欎釜鎶ユ枃.
濡傛灉鎶ユ枃澶勭悊鏃墮棿鏇撮暱,姣斿瓚呰繃浜?0鍒嗛挓,灝變細(xì)鍙戠幇榪欎釜鎶ユ枃琚鐞嗕簡3閬嶆垨5閬?
鍘熷洜鍒嗘瀽鍜岃В鍐蟲柟娉?
When the Apache HTTP Server Plug-In attempts to connect to WebLogic Server, the plug-in uses several configuration 
parameters to determine how long to wait for connections to the WebLogic Server host and, after a connection is
established, how long the plug-in waits for a response. If the plug-in cannot connect or does not receive a response, 
the plug-in attempts to connect and send the request to other WebLogic Server instances in the cluster. If the 
connection fails or there is no response from any WebLogic Server in the cluster, an error message is sent.


鍝嶅簲絳夊緟鏃墮棿鍙傛暟WLIOTimeoutSecs (http://e-docs.bea.com/wls/docs81/plugins/plugin_params.html#1149781.
鎸夌収BEA 鎺ㄨ崘鐨勶紝榪欎釜鍊煎簲璇ヨ寰楀ぇ涓浜? 榪欎釜鍙傛暟鐨勭己鐪佸間負(fù)300s. 瑙佷笅闈細(xì)
<Location /EDIHandler>
         SetHandler weblogic-handler
         WebLogicCluster apc_app1wls1:7011,apc_app1wls2:7011
         KeepAliveEnabled ON
         WLIOTimeoutSecs 7200
</Location>


rednight 2007-01-16 09:09 鍙戣〃璇勮
]]>
Failed to Send MQ Message Problemhttp://www.tkk7.com/rednight/archive/2007/01/16/94097.htmlrednightrednightTue, 16 Jan 2007 01:08:00 GMThttp://www.tkk7.com/rednight/archive/2007/01/16/94097.htmlhttp://www.tkk7.com/rednight/comments/94097.htmlhttp://www.tkk7.com/rednight/archive/2007/01/16/94097.html#Feedback0http://www.tkk7.com/rednight/comments/commentRss/94097.htmlhttp://www.tkk7.com/rednight/services/trackbacks/94097.html鏈夋椂鍊欎嬌鐢ㄧ殑mq jar鏂囦歡鐨勭増鏈笉瀵圭粰鍑虹幇涓浜涙湯鍚嶅濡欑殑闂,鏈枃鍒欐槸鑳芥帴鏀舵秷鎭絾涓嶈兘鍙戦佹秷鎭殑涓涓棶棰?紕板埌榪欐牱鐨勯棶棰樹竴瀹氳璁板緱double-check浣犱嬌鐢ㄧ殑mq jar鏂囦歡鐨勭増鏈?/p>

闂鎻忚堪:
MQJMS200713 Oct 2006 16:47:15,484 ERROR MessagingUtilServlet [ExecuteThread: '14' for queue: 'weblogic.kernel.Default'][]: **********EXCEPTION TRACE START*************
13 Oct 2006 16:47:15,484 ERROR MessagingUtilServlet [ExecuteThread: '14' for queue: 'weblogic.kernel.Default'][]: produce error
com.bhr.infra.messaging.exception.PMException: JMSException
        at com.bhr.infra.messaging.PMHandler.send(PMHandler.java:419)
        at com.bhr.epc.infra.messaging.util.MessagingUtilServlet.produce(MessagingUtilServlet.java:312)
        at com.bhr.epc.infra.messaging.util.MessagingUtilServlet.service(MessagingUtilServlet.java:74)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1072)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6981)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3892)
        at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2766)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
Caused by: javax.jms.JMSException: MQJMS2007: failed to send message to MQ queue
        at com.ibm.mq.jms.services.ConfigEnvironment.newException(ConfigEnvironment.java:553)
        at com.ibm.mq.jms.MQMessageProducer.sendInternal(MQMessageProducer.java:1589)
        at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1012)
        at com.ibm.mq.jms.MQMessageProducer.send(MQMessageProducer.java:1046)
        at com.bhr.infra.messaging.PMQueueSender.send(PMQueueSender.java:57)
        at com.bhr.infra.messaging.PMHandler.send(PMHandler.java:410)
        ... 13 more
13 Oct 2006 16:47:15,486 ERROR MessagingUtilServlet [ExecuteThread: '14' for queue: 'weblogic.kernel.Default'][]: **********EXCEPTION TRACE END**************

鍘熷洜鍒嗘瀽鍜岃В鍐蟲柟娉?
It may be caused by use of old version MQ jar. It can receive message, but cannot send message.


rednight 2007-01-16 09:08 鍙戣〃璇勮
]]>
Cannot Forward a Response that is Already Committedhttp://www.tkk7.com/rednight/archive/2007/01/16/94096.htmlrednightrednightTue, 16 Jan 2007 01:07:00 GMThttp://www.tkk7.com/rednight/archive/2007/01/16/94096.htmlhttp://www.tkk7.com/rednight/comments/94096.htmlhttp://www.tkk7.com/rednight/archive/2007/01/16/94096.html#Feedback5http://www.tkk7.com/rednight/comments/commentRss/94096.htmlhttp://www.tkk7.com/rednight/services/trackbacks/94096.html濡傛灉浣犵鍒?Cannot Forward a Response that is Already Committed"榪欐牱鐨勯敊璇俊鎭?涓瀹氭槸搴旂敤瀵逛竴嬈ttp璇鋒眰鍋氫簡澶氭欏甸潰璺寵漿鎴栧response瀵硅薄鍋氳繃close鍚?鍙堝幓鍐欏搷搴?

榪欎釜闂鐨勬牴鏈師鍥犵敱浜庡搷搴旀湰嬈¤姹傜殑Response瀵硅薄鐨勭姸鎬佹槸宸叉彁浜ょ姸鎬侀犳垚鐨? 瀹冧笉鍏佽鍝嶅簲鎻愪氦澶氭銆?

浠涔堟椂鍊橰esponse瀵硅薄鐨勭姸鎬佸彉鎴愬凡鎻愪氦鐘舵侊細(xì)褰撲綘鐨勫簲鐢ㄥ凡緇忓疄鐜頒簡欏甸潰璺寵漿閫昏緫銆?

閫氬父鍘熷洜錛?

1錛?濡傛灉浣犱嬌鐢ㄤ簡community鐨勮瘽錛?community鐨勫畨鍏ㄨ璇佸拰鎺堟潈濡傛灉娌℃湁閫氳繃錛宑ommunity鍐呴儴浼?xì)杩涜椤甸潰锜╄浆銆備絾浣犵殑搴旂敤(瀵逛簬workshop搴旂敤鐨勮瘽錛屾寚鐨勬槸action)鍙堣瘯鍥捐繘琛岄〉闈㈣煩杞紝灝變細(xì)鍑虹幇榪欐牱鐨勯棶棰樸?


    /**

     * @jpf:action

     * @jpf:forward name="page" path="page.jsp"

     */

    protected Forward actionMethod()

{

    //濡傛灉宸茬粡鎻愪氦浜嗗搷搴旓紝浣犱粛鐒惰瘯鍥懼啀嬈¤繘琛岄〉闈㈣煩杞紝鍗沖啀嬈℃彁浜ゅ搷搴旓紝鍙兘鍑虹幇闂

    //閫氬父鍙互鍔犱竴涓垽鏂?

 

       if (!getResponse().isCommitted()) {

            return new Forward("success");

        } else {

            return null;

        }

    }

 

    protected void beforeAction() {

       SecurityManager.checkAuthorization(getRequest(), getResponse(), config.getString(

                CDConstants.CREATE_TERM_ACTION_NAME, ""));

      //榪欎釜璋冪敤鍙兘瀹炵幇浜嗛〉闈㈣煩杞紝鍗蟲彁浜ゅ搷搴?

}

 

娉ㄦ剰JSP涓疄鐜伴〉闈㈣煩杞悗錛屽姞return 璇彞闃叉緇х畫鎻愪氦鍝嶅簲:

 

<%

       SecurityManager.checkAuthorization(getRequest(), getResponse(), config.getString(

                CDConstants.CREATE_TERM_ACTION_NAME, ""));

{

     //鍙兘鏈夊疄鐜伴〉闈㈣煩杞昏緫

    ……………forward();

        return;//璁板緱鍔爎etrun.

    }

%>

 

2. .濡傛灉娌℃湁浣跨敤community鐨勮瘽錛屼笅闈㈡儏鏅篃浼?xì)鍑虹幇杩欎釜闂?

 

    /**

     * @jpf:action

     * @jpf:forward name="page" path="page.jsp"

     */

    protected Forward actionMethod()

 

//鐩存帴鎿嶄綔Response瀵硅薄鍐欏搷搴?

     getResponse().getPrintWriter().println();

    …

/

   // 鍙堟墽琛岀殑欏甸潰璺寵漿錛屼篃鍙兘鍑虹幇闂

        return new Forward("index");

    }


rednight 2007-01-16 09:07 鍙戣〃璇勮
]]>
Page Flow Error - No Relevant Pagehttp://www.tkk7.com/rednight/archive/2007/01/16/94094.htmlrednightrednightTue, 16 Jan 2007 01:06:00 GMThttp://www.tkk7.com/rednight/archive/2007/01/16/94094.htmlhttp://www.tkk7.com/rednight/comments/94094.htmlhttp://www.tkk7.com/rednight/archive/2007/01/16/94094.html#Feedback0http://www.tkk7.com/rednight/comments/commentRss/94094.htmlhttp://www.tkk7.com/rednight/services/trackbacks/94094.html涓涓〉闈㈡祦鍦ㄧ涓嬈′嬌鐢ㄦ椂,鍐呴儴灞炴urrentpage騫舵病鏈夋寚瀹氶〉闈?鎵浠ラ伩鍏嶅湪begin鏂規(guī)硶閲屼嬌鐢╮eturn-to: current page鐢ㄦ硶.鍚屾椂鍦ㄧ敤鐨勬椂鍊欐敞鎰忛〉闈㈡祦鐨勫伐浣滄柟寮?/p>

闂鎻忚堪:
Error message like below in Web Page is displayed:

Page Flow:
 /com/xxxx/xxx/xxx.jpf
Action:
 update
 
Page Flow Error - No Relevant Page
You have tried to return to a recent page in the current page flow through return-to="currentPage", 
but there is no appropriate page. 


Exception's stack trace:

Exception: No previous page for return-to="currentPage" on action create in page flow
 /com/gems/mt/web/CreateReleaseCntr/CreateReleaseCntrController.jpf.
com.bea.wlw.netui.pageflow.NoPreviousPageException: No relevant page for return-to="currentPage" 
on action create in page flow /com/gems/mt/web/CreateReleaseCntr/CreateReleaseCntrController.jpf.
at com.bea.wlw.netui.pageflow.FlowController.doReturnToPage(FlowController.java:1328)
at com.bea.wlw.netui.pageflow.FlowController.forwardTo(FlowController.java:1023)
at com.bea.wlw.netui.pageflow.PageFlowController.forwardTo(PageFlowController.java:606)
at com.bea.wlw.netui.pageflow.FlowController.internalExecute(FlowController.java:765)

...


鍘熷洜鍒嗘瀽鍜岃В鍐蟲柟娉?
When a new page flow is created and its current page is null (it mean you visit at the fist time),
 so such an exception like NoPreviousPageException occur if you use return-to="currentPage".

if a new page flow finish a successful forward, it will treat last page as current page

so that we can use current page to display error message conveniently.

Solution:

ensure page flow finish a successful forward and use current page again.

You can also use path="specificPage.jsp" instead of return-to="currentPage" 
if your original return-to is just one specific page.



rednight 2007-01-16 09:06 鍙戣〃璇勮
]]>
Memory Leak for ListCellRendererhttp://www.tkk7.com/rednight/archive/2007/01/16/94089.htmlrednightrednightTue, 16 Jan 2007 01:04:00 GMThttp://www.tkk7.com/rednight/archive/2007/01/16/94089.htmlhttp://www.tkk7.com/rednight/comments/94089.htmlhttp://www.tkk7.com/rednight/archive/2007/01/16/94089.html#Feedback0http://www.tkk7.com/rednight/comments/commentRss/94089.htmlhttp://www.tkk7.com/rednight/services/trackbacks/94089.html We have known, the ListCellRenderer interface has only one method public Component getListCellRendererComponent(), and it returns a Component. When a JList needs to compute its dimension or paint its cell item, this method will be called. So it will be called frequently, and we have a best practice, try to reuse object, avoid time-consumed computation and unnecessary operation in this method.

Recently found, there is a memory leak bug for list cell renderer in both JDK 1.4.x and JDK 5 (don鈥檛 know whether has the same bug in earlier JDK). The component returned from getListCellRendererComponent() method could not be GC, and all its referenced objects also could not be GC. Unfortunately, this bug is only fixed in JDK 6.

So currently, if a JList use the ListCellRenderer, but only holds a little resource (eg: the JList only has little items, and the component is returned from ListCellRenderer is a simple JLable), you may not care about the memory leak.

But if a JList use the ListCellRenderer, and holds a large resource, you should remember to use the following way to avoid memory leak.

Work Around: Subclass JList and invoke removeAll after painting is done:

聽聽聽聽聽聽 public class xxxList extends JList {

聽聽聽聽聽聽聽聽聽聽聽 private CellRendererPane renderer;

聽聽聽聽聽聽聽聽聽聽聽 private CellRendererPane getRenderer() {

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (renderer == null) {

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 for (int i=0; i<getComponents().length; i++) {

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 Component c= getComponents()[i];

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (c instanceof CellRendererPane) {

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 renderer = (CellRendererPane)c;

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 break;

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 return renderer;

聽聽聽聽聽聽聽聽聽聽聽 }

聽聽聽聽聽聽聽聽聽聽聽 protected void paintComponent(Graphics g) {

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 super.paintComponent(g);

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 CellRendererPane renderer = getRenderer();

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 if (renderer != null) {

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 renderer.removeAll();

聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 }

聽聽聽聽聽聽聽聽聽聽聽 }

聽聽聽聽聽聽聽 }


Please refer to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5044798 for more details.

rednight 2007-01-16 09:04 鍙戣〃璇勮
]]>
state patternhttp://www.tkk7.com/rednight/archive/2006/12/26/90105.htmlrednightrednightTue, 26 Dec 2006 06:46:00 GMThttp://www.tkk7.com/rednight/archive/2006/12/26/90105.htmlhttp://www.tkk7.com/rednight/comments/90105.htmlhttp://www.tkk7.com/rednight/archive/2006/12/26/90105.html#Feedback0http://www.tkk7.com/rednight/comments/commentRss/90105.htmlhttp://www.tkk7.com/rednight/services/trackbacks/90105.htmlThe logic to change state is only inside one method (initVesselView(鈥?) inside GrVessel.java.聽

if (viewType == VIEW_STOWAGE) {
聽聽聽聽聽聽聽聽聽聽聽 vslView_ = new VesselStowageView(leftPoint, bow2Left, leftCenter,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 rightCenter, shipWidth_);
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 else if (viewType == VIEW_SIDE) {
聽聽聽聽聽聽聽聽聽聽聽 vslView_ = new VesselSideView(leftPoint, bow2Left, leftCenter,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 rightCenter, shipWidth_);
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 else if (viewType == VIEW_PLAN) {
聽聽聽聽聽聽聽聽聽聽聽 vslView_ = new VesselPlanView(leftPoint, bow2Left, leftCenter,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 rightCenter, shipWidth_);
聽聽聽聽聽聽聽 }
聽聽聽聽聽聽聽 else {
聽聽聽聽聽聽聽聽聽聽聽 throw new IllegalArgumentException(
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "GrVessel::initVesselView-->Invalid view type!");
聽聽聽聽聽聽聽 }


We do not need to repeat this logic of changing view in many other method.
This is the benefit of State design pattern.
The 3 state classes here are VesselPlanView.java, VesselSideView.java and VesselStowageView.java

Please note that in the state classes, if a method is supported by stateA and not supported by stateB.聽
Then, in stateB, the method body will throw an exception (IllegalArgumentException) to indicate that coder call the wrong method in the wrong state.

Example, in VesselPlanView.java, public boolean addStowage(...).聽 This method is only meaningful to stowageView.

public boolean addStowage(IlvManager manager, List transformList, IlvGraphic stowage, String stadBayN,
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 boolean isSelect) {
聽聽聽聽聽聽聽 throw new IllegalArgumentException(
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 "GrVessel::addStowage-->be sure the vessel at stowage view!");
聽聽聽 }


Hence, in PlanView, the method body will throw exception.

Just to share with you a better way to code.



rednight 2006-12-26 14:46 鍙戣〃璇勮
]]>
Swing 妯″瀷榪囨護(hù)http://www.tkk7.com/rednight/archive/2006/11/11/80589.htmlrednightrednightSat, 11 Nov 2006 08:16:00 GMThttp://www.tkk7.com/rednight/archive/2006/11/11/80589.html闃呰鍏ㄦ枃

rednight 2006-11-11 16:16 鍙戣〃璇勮
]]>
java.lang.InstantiationException: org.apache.tools.ant.Main http://www.tkk7.com/rednight/archive/2006/11/09/80222.htmlrednightrednightThu, 09 Nov 2006 10:23:00 GMThttp://www.tkk7.com/rednight/archive/2006/11/09/80222.htmlhttp://www.tkk7.com/rednight/comments/80222.htmlhttp://www.tkk7.com/rednight/archive/2006/11/09/80222.html#Feedback1http://www.tkk7.com/rednight/comments/commentRss/80222.htmlhttp://www.tkk7.com/rednight/services/trackbacks/80222.html鍘熷洜涔嬩竴鏄湪鏈哄櫒涓瓨鍦?縐嶄笉鍚岀増鏈殑ANT,鎴戠鍒扮殑鎯呭喌鏄痗lasspath 涓嵆鏈墂eblogic.jar,鍙堟湁1.6.5鐨凙NT,
鍒犻櫎weblogic.jar鍚庤繍琛屽氨姝e父浜?img src ="http://www.tkk7.com/rednight/aggbug/80222.html" width = "1" height = "1" />

rednight 2006-11-09 18:23 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲区小说区图片区QVOD| 久久国产美女免费观看精品| 国产精品亚洲片在线观看不卡| 色窝窝免费一区二区三区| 国产一级a毛一级a看免费人娇| 亚洲熟妇无码AV| 亚洲男人电影天堂| 亚洲av之男人的天堂网站| 午夜亚洲av永久无码精品 | 夜夜春亚洲嫩草影院| 免费网站看v片在线香蕉| 免费观看激色视频网站(性色)| baoyu122.永久免费视频| 另类图片亚洲校园小说区| 亚洲永久网址在线观看| 亚洲精品免费在线视频| 亚洲国产高清视频| 国产亚洲一区二区三区在线| 亚洲成AV人在线观看网址| 国产一区二区三区在线免费| 处破痛哭A√18成年片免费| 三年片在线观看免费大全| 香蕉免费一区二区三区| 嫩草影院在线播放www免费观看| 国产午夜精品理论片免费观看| 国产A∨免费精品视频| 丰满少妇作爱视频免费观看| 麻豆91免费视频| 野花视频在线官网免费1| 直接进入免费看黄的网站| 男男黄GAY片免费网站WWW | 国产一区二区三区在线观看免费 | 亚洲精品乱码久久久久久V| 亚洲mv国产精品mv日本mv| 亚洲中文字幕久在线| 精品亚洲成A人无码成A在线观看 | 成人免费午夜在线观看| 成年女人看片免费视频播放器| 性感美女视频在线观看免费精品| 国产成人免费高清激情视频| 青青草免费在线视频|