Havoc Penningtonãåæçã³ã¼ã«ããã¯ãéåæã³ã¼ã«ãã㯠ã
ometer.com 2011.07.24ã®ããã°ã¨ã³ããª
Callbacks, synchronous and asynchronous : Havoc's Blog
- 2011å¹´7æããnodeã³ã¢ãã¼ã ï¼äººã®ãã¡ã®ï¼äººã«ãªã£ã¦ãid:koichikï¼@koichikï¼ãããè¯è¨äºèªå®ãã¦ãã¨ã³ããª
- ã³ã¢ãã¼ã ã®äººãã¡ã¯ãJoyentããã¯ï¼äººãryan(@ryah)ãnpmã®äººï¼@izs)ãCloudkickãããï¼äººãBert Belder(@piscisaureus)ã«Paul Quernaãããã«Ben Noordhuisã¨Felix Geisendörferã«@koichikã
- informativeãªå 容ã ãæ¯ãç«ããªãããã©ä½ã¨ãæãèªãã§ã¿ã
以ä¸æãèªãã å 容
ãã®ã¨ã³ããª
- ã³ã¼ã«ããã¯ä½¿ã£ãAPIãã¶ã¤ã³ã§å®ã£ãæ¹ãããã«ã¼ã«ï¼ã¤
- åããã¼ãã§ç´°ã ããã¨ããã¯åã«æ¸ãã
- Boolean parameters are wrong : Havoc's Blog
åæçãªã³ã¼ã«ããã¯ã¨éåæã³ã¼ã«ããã¯ã®ãã¶ã¤ã³
- ããèãã¦ããã¼ã
- å®åã¬ãã«ã§APIãè¨è¨ãã人ã«ãAPIã使ã人ã«ãç½åã¨ãªããã
JVMåãã«ã³ã¼ããæ¸ãã¦ã人ã®é¢å¿ã®æ¨ç§»
- ä¼çµ±çã«ã¯ãããããã³ã°APIã¨ã¹ã¬ããã使ããã¦ã
- æè¿ã«ãªããã³ã¼ã«ããã¯ãã¼ã¹APIãèããããã«ãªã£ã¦ãã
ã³ã¼ã«ããã¯ãã¼ã¹APIãåæï¼éåæAPIã«ã¤ãã¦èãå§ãããã£ãã
- Hammersmithããã¸ã§ã¯ããå§ãããã¨ã大ãã
- Hammersmith
- Scalaã§æ¸ããã³ã¼ã«ããã¯ãã¼ã¹ã®MongoDBãã©ã¤ã
- jvmç³»è¨èªã§æ¸ãã¦ã人ãã¡ã«ã¯ä¸æ £ããªãããã¯ã ã¨æã
- ã¤ãã³ãã«ã¼ããã¼ã¹ã®ã¯ã©ã¤ã¢ã³ããµã¤ãã³ã¼ããæ¸ããçµé¨ãããã®ã§ãã®è¾ºã¯ãããªãå
¥ãã
- The Main Event Loop
- ï¼è£è¶³ï¼
- GNOME/GTK+ã§ã¯ã¤ãã³ãã«ã¼ããå®è£ ããã¦ã
ãããããåæçã³ã¼ã«ããã¯ï¼éåæã³ã¼ã«ããã¯
- åæçã³ã¼ã«ããã¯
- é¢æ°ããè¿ãåã«ãã³ã¼ã«ããã¯ãå¼ã³åºããã
- ã³ã¼ã«ããã¯ãåä¿¡ããAPIã¯ã¹ã¿ãã¯ã«ã¾ã æ®ã£ã¦ã
- ä¾ãã°ãlist.foreach(callback)
- ãªã¹ãï¼listï¼ã®åã¡ã³ãã¼ã«å¯¾ãã¦ã³ã¼ã«ããã¯ãå®è¡ãããå¾ã§é¢æ°ï¼foreachï¼ããæ»ã
- ããããåãã使ãå´ã¯å½ç¶æå¾ ãã
- éåæã³ã¼ã«ããã¯
- é 延ï¼deferredï¼ã³ã¼ã«ããã¯ãã¨å¼ã°ãããã¨ã
- é¢æ°ããæ»ã£ãå¾ã§ãã³ã¼ã«ããã¯ãå¼ã³åºããã
- ãããã¯é¢æ°ããæ»ãåã«å¥ã¹ã¬ããã®ã¹ã¿ãã¯ä¸ã§ã³ã¼ã«ããã¯ãå¼ã³åºããã
- é
延ã®ããã®ã¡ã«ããºã ã¨ãã¦ã¯ãã¹ã¬ãããã¡ã¤ã³ã«ã¼ã
- ã¡ã¤ã³ã«ã¼ãã®å¥åãã¤ãã³ãã«ã¼ããdispatcherãexecutor
- éåæã³ã¼ã«ããã¯ãã¿ãããã®ã¯ãIOå¦çããAPI
- ä¾ãã°ãsocket.connect(callback)
- é¢æ°(connectï¼ããæ»ã£ãæç¹ã§ã¯ãã³ã¼ã«ããã¯ã¯ã¾ã å¼ã³åºããã¦ãªã
- ããããåããæå¾ ããã¦ã
- ã³ãã¯ã·ã§ã³ãè²¼ããã¦ãã®ã確èªãã¦ããã³ã¼ã«ããã¯å¼ã³åºããããã
ã¬ã¤ãã©ã¤ã³ï¼ã¤
- ï¼ï¼ã³ã¼ã«ããã¯ã®ä»æ§ã¯äºè
æä¸ã«ãã
- ã常ã«åæçããã常ã«éåæã
- ãã©ã£ã¡ããã¯NG
- ï¼ï¼éåæã³ã¼ã«ããã¯ã®å¼ã³åºãå
ãéå®ãã
- ã¡ã¤ã³ã«ã¼ããã¡ã¤ã³ã®dispatchã·ã¹ãã ãetc.ãç´æ¥å¼ã³åºã
- ã³ã¼ã«ããã¯ãå¼ã³åºãã¡ã«ããºã ã®ä¸ã«éãã¬ã¼ã ã¨ããä½ããªããä¸è¦
- ç¹ã«ããããä¸éãã¬ã¼ã ãããã¯ãããã¨ããããªãå°æ´
åæçã³ã¼ã«ããã¯ãéåæã³ã¼ã«ããã¯ãã©ããéãã
- ãããããçã¿åºãåé¡ãéã
- çã¿åºãåé¡ã¯ãAPIä½ãå´ã»API使ãå´ãããããå½±é¿åãã
- åæçã³ã¼ã«ããã¯ã®ãã¤ã³ã
- ã¡ã¤ã³ã¹ã¬ããã§å¼ã³åºããã
- ã¹ã¬ããã»ã¼ããã©ããã¯æ°ã«ããªã
- C/C++ãªã©ã®è¨èªä½¿ã£ã¦ããã¼ã«ã«å¤æ°ãªã©ã®ã¹ã¿ãã¯ã¸ä¿åããã¦ããã¼ã¿ã¸ã¢ã¯ã»ã¹å ´åããã
- è¨èªãåãããç¾å¨ã®ã¹ã¬ããã«ç´ä»ããããã¼ã¿ã«ã¢ã¯ã»ã¹ããå ´åããã
- å¤ãã®Javaã®webãã¬ã¼ã ã¯ã¼ã¯ã§ã¯ãç¾å¨ã®ãã©ã³ã¶ã¯ã·ã§ã³ããªã¯ã¨ã¹ããå¦çããããã«ãã¹ã¬ããå é¨ã®ãã¼ã«ã«å¤æ°ãä½ã
- åæçã³ã¼ã«ããã¯ä½¿ãã¨ãã¯ãï¼å ´åã«ãããï¼ãã¢ããªã®ã¹ãã¼ããå¤åããªããã¨ã¿ãªãã
- ãªãã¸ã§ã¯ãã¯ãããã¿ã¤ãã¼ã¯ãªããã¨ã
- IOå¦çããªããã¨ã
- ããã°ã©ã ã®æ§é ã«å½±é¿ãä¸ããã¹ãã¼ããå¤ãã¦ãã¾ãå¦çãä¸åãªããã¨ã
- éåæã³ã¼ã«ããã¯ã®ãã¤ã³ã
- é
延å¦çã®ã¡ã«ããºã ãã¹ã¬ãããã¼ã¹ã®å ´å
- å¥ã¹ã¬ããã§ã³ã¼ã«ããã¯ãå¼ã³åºããããå ´åãã
- éåæã³ã¼ã«ããã¯ããã¯touchã§ããªããã®
- ãªãªã¸ãã«ã®ã¹ã¬ãããã¹ã¿ãã¯ã«ç´ä»ãããããã®
- ä¾ãã°ããã¼ã«ã«å¤æ°ãã¹ã¬ããå ã§ä¿æããã¦ããã¼ã«ã«ãã¼ã¿
- ãªãªã¸ãã«ã®ã¹ã¬ãããã¹ã¿ãã¯ã«ç´ä»ãããããã®
- ãªãªã¸ãã«ã¹ã¬ãããããã¯ããå¯è½æ§ãããã¨ããã³ã¼ã«ããã¯ã¯ãã®ã¹ã¬ããã®å¤ã§å¼ã³åºããã
- ä»ã®ã¹ã¬ãããã¤ãã³ããã¢ããªã®ã¹ãã¼ããå¤åãããå¯è½æ§ããããã¨ããããåæã«ãã¦ã³ã¼ã«ããã¯ã使ãã¹ã
- é
延å¦çã®ã¡ã«ããºã ãã¹ã¬ãããã¼ã¹ã®å ´å
- ãéåæã®æ¹ãåããã¨ããåªå£ãã¤ã話ãããªããããããã«ä½¿ãã©ãã
- list.foreach(callback)
- åæçã³ã¼ã«ããã¯ã§åºããä¾
- ãã®ã³ã¼ã使ã£ã¦ãã³ã¼ã«ããã¯ãé 延å®è¡ããã¦ç¾å¨ã®ã¹ã¬ããã§ã³ã¼ã«ããã¯ãä½ãããªãã£ãããããã¦ãé©ã
- socket.connetc(callback)
- éåæã³ã¼ã«ããã¯ã§åºããä¾
- ãã®ã³ã¼ã使ã£ã¦ãã³ã¼ã«ããã¯ãé 延å®è¡ãããªãã£ãããã³ã¼ã«ããã¯ä½¿ã£ã¦ãæå³ããªã
- ï¼ã¤ã®ä¾ã示ãã¦ããã¨
- ã³ã¼ã«ããã¯ã¯åæçãéåæãäºè æä¸ã«ãã
- åæã¨ãã©ãéåæãã¨ãã風ã«ããªã
- åæçã³ã¼ã«ããã¯ã¨éåæã³ã¼ã«ããã¯ã§ã¯ç®çãéã
- list.foreach(callback)
åæãéåæããçæ¹ã ãé¸ã¶ã両æ¹ï¼ï¼®ï¼§
- é »åºãã§ã¯ãªãããããããªã±ã¼ã¹
- ãã¾ã«ã³ã¼ã«ããã¯ãããã«å¼ã³åºããããã«ãã¦ããããã以å¤ã§ã¯ã³ã¼ã«ããã¯ã¯é 延å®è¡ãããã
- ãã¼ã¿ããã§ã«å ¥æå¯è½ãªç¶æ ã«ããå ´é¢ãªãããã«ã³ã¼ã«ããã¯ãå¼ã³åºãã¨ã
- ã½ã±ããã®æºåã¯ããã¦ãæéããããããã³ã¼ã«ããã¯ã¯é 延å®è¡
- ã³ã¼ã«ããã¯ãå®è¡ã§ããæ¡ä»¶ãæ´ã£ã¦ãã¨ãã¯åæçã«å®è¡ãããã以å¤ã¯éåæã§å®è¡ããããã«ãã¶ã¤ã³
- ããããæè»ãªãã¶ã¤ã³ããã£ã¦ã¿ãããªã
- ããã¯ãã¶ã¤ã³ã¨ãã¦ã¯æªãè¦æ¬
- åæã³ã¼ã«ããã¯ã¨éåæã³ã¼ã«ããã¯ãå¾ãã«ã¼ã«ã¯å¥ç©
- åæã³ã¼ã«ããã¯ã¨éåæã³ã¼ã«ããã¯ãçã¿åºãåé¡ã¯å¥ç©
- ãããããªã±ã¼ã¹
- ãã¹ãç°å¢ã§ã¯ã³ã¼ã«ããã¯ã¯éåæçã«å¼ã³åºã
- ãããã¯ã·ã§ã³ç°å¢ã§ã¯ãã³ã¼ã«ããã¯ãåæçã«å¼ã³åºããä¸æãããæ©ä¼ã¯ã¨ã¦ãæããªã
- éåæã«ãåæçã«ãæ¯ãèãã³ã¼ã«ããã¯ããã¶ã¤ã³ããã¹ããããã¨ã¯ã¨ã³ã¸ãã¢ã«ã¨ã£ã¦ã¨ã¦ãè² æ ã大ãã
- ã³ã¼ã«ããã¯ã®å¼ã³åºããé
延ããããå ´åãããAPI
- ããããå ´åã¯ãã¤ãå¼ã³åºããé 延ãããããã«ãã¶ã¤ã³ãã¹ã
- ãææ¬ã¨ãã¦GIOã©ã¤ãã©ãªã®ããã¥ã¡ã³ãã¼ã·ã§ã³ã®ãGSimpleAsyncResultã®é
ç®
- GSimpleAsyncResult
- GSimpleAsyncResultã¯ãéåæããã°ã©ãã³ã°ã®ä¸çã§promiseã¨ãfutureã¨å¼ã°ãããã®ã¨åçã®å½¹å²
- complete_in_idle()ã¡ã½ããã¨complete() ã¡ã½ãããGSimpleAsyncResultãæä¾ãã
- complete_in_idle()
- ã³ã¼ã«ããã¯å¼ã³åºããã¡ã¤ã³ã«ã¼ãã¸æ»ãã¾ã§é 延ããã
- idle handlerãGIOã¡ã¤ã³ã«ã¼ããæã
- complete()
- åæçã«ã³ã¼ã«ããã¯ãå¼ã³åºã
- complete_in_idle()ã¨complete() ã®ä½¿ãåãã«ã¤ãã¦ã®ã³ã¡ã³ããç§é¸
- ããã¯ãèµ·ãããªããã¨ã確å®ãã¦ãé 延ãããã³ã¼ã«ããã¯ã®ä¸ã§ãªããcomplete()使ã£ã¦ãOK
- ãã以å¤ã¯complete_in_idle()ãã¤ããã¹ã
- GIOã®ããã¥ã¡ã³ãã¯çµå§ãããªããªã§æ¸ããã¦ã
- GIOã使ã£ãã¨ã³ã¸ãã¢ãã¡ãçä¸ããçµé¨ãã
åæããããªã½ã¼ã¹ããã®ã³ã¼ã«ããã¯å¼ã³åºãã¯å¸¸ã«é 延ãããã¹ã
- è¨ãæ¹ãããã¨
- ããã¯ããå¯è½æ§ãåãé¤ãã¦ããã³ã¼ã«ããã¯å¼ã³åºãããã¹ã
- ããã¯å¯è½æ§ãåãé¤ãä¸çªæ¥½ãªæ¹æ³
- ã³ã¼ã«ããã¯ãéåæã«ãã¦ãã¾ã
- ããããã¨ãã¹ã¿ãã¯ãæ¶åããã¡ã¤ã³ã«ã¼ãã«æ»ãã¾ã§å®è¡ãé 延ããã
- ãããã¯ãã³ã¼ã«ããã¯ãå¥ã¹ã¬ããã®å®è¡ã¹ã¿ãã¯ã«è¿½å ããã¦å®è¡ããã
- APIéçºè
ãé ã«å
¥ãã¦ããã¹ããã¨
- APIãå©ç¨ããå¤é¨ã¢ããªãã³ã¼ã«ããã¯ããAPIã¸ã¢ã¯ã»ã¹ããå¯è½æ§ããããã¨
- ããããå¯è½æ§ãå¿ããAPIãã¶ã¤ã³ã ã¨
- ã¢ããªãAPIã¸ã¢ã¯ã»ã¹ãã¦ãã¨ãã«ããã¯ãçºçããã¨ãã¢ããªããããããã¯ã«ã¯ã¾ã
- å帰çããã¯ãAPIè¨è¨è ã使ã£ãå ´åããããããã¯ãç¡ã代ããã«æ£å½æ§åé¡ã®ãä¸è©±ã«ãªã
- ã¡ã¤ã³ã«ã¼ããã¹ã¬ããã¸æ»ãã¾ã§ã³ã¼ã«ããã¯å®è¡ãé
延ããã代ããã«ãåæããããªã½ã¼ã¹ããã¯ããããããã¯ã®å¯è½æ§ãåãé¤ãä½æ¥
- ã§ããªããã¨ã¯ãªãããè¦ããé
- ããã¯ã¯ã¹ã¿ãã¯ã®ä¸ãããã³ãã³æ¹§ãã¦ãã
- ã¹ã¿ãã¯ã«ããããããã¡ã½ãããã³ã¼ã«ããã¯ãè¿ãããã«ãã§ãã¯ãããã¨ã«è¿½ããããã¨ã«ãªã
- å é¨çã«ã¯ãã¹ã¿ãã¯ã®ããã¯ã¢ãããåã£ã¦ããã¹ã¦ã®ã³ã¼ã«ããã¯ãå¤é¨ã®ããã¯ãã«ãã¼ã«æ¸¡ããããã¯ãã«ãã¼å´ã§åãåã£ãã³ã¼ã«ããã¯ã®ããã¯ã解é¤ããã³ã¼ã«ããã¯ãå¼ã³åºããããã延ã ã¨
Hammersmithããã¸ã§ã¯ãåæãã¹ã¬ãããã¼ã«ä½¿ã£ã¦ãããããã¯ãåé¿
- Hammersmith
- ããã¸ã§ã¯ãåæã§ã¯ãããããã¯ãçã¾ããã±ã¼ã¹ããã£ã
- ãconnection.query({ cursor => /* iterate cursor here, touching connection again */ })ã
- ããã¯æ¬ä¼¼ã³ã¼ããããæ¸ãã¨ãããããã¯ã«
- corsorã®ç¹°ãè¿ã
- ç¹°ãè¿ããã³ã«MongoDBã®connectionãªãã¸ã§ã¯ãã¸æ»ã
- ã¯ã¨ãªã¼ã®ã³ã¼ã«ããã¯ã¯connectionãªãã¸ã§ã¯ãå é¨ã®ã³ã¼ãããå¼ã³åºãããã
- ããã§ã³ãã¯ã·ã§ã³ããã¯ãçºç
- åããªãæ¸ãæ¹ã ããã¨ã³ã¸ãã¢è¦ç¹ã§ã¿ãã¨èªç¶ã§ç°¡ä¾¿ãªæ¸ãæ¹
- ã©ã¤ãã©ãªãèªåã§ã³ã¼ã«ããã¯ãé 延ãã¦ãããªããªããèªåãé 延å¦çãæ¸ããªãã¨ãããªãããªããã
- ãã®æã®ãããããã¯ã®å¯¾å¦ã¯ããã¦ãã®ã¨ã³ã¸ãã¢ãä¸å¾æ
- ãã®æã®åé¡ã«ééãã¦è§£æ±ºãç¹°ãè¿ãã¦ãã¨ãã¡ããã¡ãããã³ã¼ãã®ä¸ã«é 延å¦çã®ã¡ã«ããºã ãæ£å¨ããç¶æ ã«
- ãconnection.query({ cursor => /* iterate cursor here, touching connection again */ })ã
- Hammersmithãçµé¨ãããããããã¯ã¯ãNettyããå¼ãç¶ãã§ãã¾ã£ããã®
- Hammersmithã§ã¯æ¥ç¶ã«Nettyã使ã£ã¦ã
- Nettyã«ã¯ã³ã¼ã«ããã¯ãé
延ãããä»çµã¿ãã¼ã
- ããã¯ä»æ¹ãªã
- Nettyéçºæç¹ã§ã®Javaã®ä½æ³ããããã°å½ç¶
- ã³ã¼ã«ããã¯é 延å®è¡ã®ããã®ããã©ã«ãã¨ãæ¨æºã¨ãé常ã®ãããã¨ããå¹ççæ¹æ³ãã¨ãã£ããã®ãçç¡ã ã£ã
- Hammersmithã§è¦ã¤ãããããããã¯ã¸ã®ãã¤ã¦ã®èªåã®è§£æ±º
- ã¢ããªã®ã³ã¼ã«ããã¯ãå®è¡ããããã ãã«ã¹ã¬ãããã¼ã«ã追å ãã
- ãã®ã¨ãã®Commit
- Nettyãæä¾ãã¦ãã¹ã¬ãããã¼ã«ç¨ã®ã¯ã©ã¹ã¯ãããããã¯ã解決ã§ããªãã£ã
- èªä½ã§ã¹ã¬ãããã¼ã«ç¨ã¯ã©ã¹ãæ¸ãã
- ã¹ã¬ãããã¼ã«ã使ã£ããããããã¯ã®è§£æ±º
- ãµã¤ãºããªã½ã¼ã¹å¶éãã¼ãã®ç¶æ ãããªãã¨ãã¾ããããªã
- ã¹ã¬ãããã¼ã«è¿½å ã§ä¸å¿è§£æ±ºã§ãã
- ã ããããªããæ¹ãå½ããåãªãã¦ç¶æ³ã¯ããªãã¾ãã
- éçºã«ä½¿ã£ã¦ãjarãã¡ã¤ã«ã«ã³ã¼ã«ããã¯APIãå ¥ã£ã¦ã¦ããããããå°ç¨ã®ã¹ã¬ãããã¼ã«ãæã£ã¦ãç¶æ³ã¯ã²ã©ã
- ãã®è¾ºãããããNettyã®ãã®åé¡ã¸ã®å¯¾å¿ãã¯ã£ããããªãçç±
- ä½ã¬ãã«ãããã¯ã¼ãã³ã°ã©ã¤ãã©ãªã§æ¹éãåºããã®ãé£ãããªã£ã¦ã
Hammersmithã§Akkaã®Actorã¢ãã«ãæ¡ç¨ãããã¨ã«ãã
- ã¹ã¬ãããã¼ã«ãããåªãã解決æ³ã模索
- Akkaã¤ãã£ã¦Hammersmithæ¸ãç´ãã
- Akka Project
- Akkaã§ä½¿ããã¦ãAcotrã¢ãã«
- Actor model
- ã³ã¼ã«ããã¯ã§ã¯ãªãã¡ãã»ã¼ã¸ãã¼ã¹
- ã¡ãã»ã¼ã¸ã¯å¸¸ã«ååçã«é 延å®è¡ããã
- Akka使ã£ãéçºã§ã¯ã¢ã¯ã¿ã¼ã¨ã®éä¿¡ã§ã¯ActorRefã使ããªãã¨ãããªã
- ã¢ã¯ã¿ã¼ã¸ã®ã¡ãã»ã¼ã¸ã¯ãã£ã¹ãããã£ã¼ï¼ï¼ã¤ãã³ãã«ã¼ãï¼ãçµç±ãã
- ä¾ãã°ï¼ã¤ã®ã¢ã¯ã¿ã¼ã¨ã®éä¿¡ããã¦ãå ´é¢
- ã!ããããã¯ãsend messageãã¡ã½ãã使ã£ã¦
- ã¡ãã»ã¼ã¸çºè¡ã¯ã¤ãã³ãã«ã¼ãçµç±
- ãããããã¯åé¡ããã®ã¢ãã«ã§è§£æ±ºãããã¨ãæå¾
ãã¦Hammersmithæ¸ãç´ãã
- ä¸æã§ããªãã£ããããã¯ãèµ·ããå¯è½æ§ã®ããã³ã¼ã«ããã¯å¼ã³åºããæ®ã£ã
- ã¢ã¯ã¿ã¼ãã¡ãã»ã¼ã¸å¦çãã¦ãéã¯ããã¯ãèµ·ãã
- Akkaã§ã¯ã¢ã¯ã¿ã¼ã§ã¯ãå¥ã®ã¢ã¯ã¿ã¼ãããããã¯Futureãªãã¸ã§ã¯ãããã®ã¡ãã»ã¼ã¸ãåä¿¡å¯è½
- Akkaã§ããããããã¯ã¯çºçããå ´åãã
- Akkaã§ã¯ãªãã¸ã§ã¯ãå ã®ã¡ãã»ã¼ã¸éä¿¡è ãChannnelã¨å¼ãã§ã
- Channelã¸ã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ã®ä¸ã§ã!ãã¡ã½ããã使ãã
- ã¢ã¯ã¿ã¼ãã!ãã§éä¿¡ããã¨ãããã¤ãã¡ãã»ã¼ã¸ã¯ãã£ã¹ãããã£ã¼ã¸æ»ãã¾ã§é
延ããã
- ãããfutureãªãã¸ã§ã¯ãã¸ã®éä¿¡ã®ã¨ãã®å ´åã常ã«é 延ãããªã
- ãChannel.!ãã¯APIãåæoréåæã®å®ç¾©ããç¬ç«ãã¦ã
- -ãããåé¡ãçãå¯è½æ§ããã
- ã¢ã¯ã¿ã¼ã¢ãã«ã§ã¯ãã¢ã¯ã¿ã¼ã®å®è¡ã¯ï¼ã¹ã¬ããã«ï¼ã¤
- -ã¢ã¯ã¿ã¼ãã¡ãã»ã¼ã¸ãå¦çãã¦ãéã¯ã¢ã¯ã¿ã¼ã¯ããã¯ãããã®ã§ã次ã®ã¡ãã»ã¼ã¸ã®å¦çã«é²ããã¨ãã§ããªã
- ã¢ã¯ã¿ã¼ããåæçå¼ã³åºããããã®ã¯å±éº
- ã¢ã¯ã¿ã¼ã§ãããããã¯ãçã¾ããã±ã¼ã¹
- åæçå¼ã³åºããã³ã¼ã«ããã¯å é¨ã§ã¢ã¯ã¿ã¼ãåã³å©ç¨ãããã¨ãã¦ãå ´åããããããã¯çºç
- MongoDBã®connectionãã¢ã¯ã¿ã¼ã§ã©ãããã¦ã¿ãããNetty使ã£ã¦ãã¨ãã¨åããããããã¯ãçºç
- ã¯ã¨ãªã®ã³ã¼ã«ããã¯ãåã³connectinã«ã¢ã¯ã»ã¹ãã¦cursorãç¹°ãè¿ããã¨ããåãããã¦ã
- ã¯ã¨ãªã®ã³ã¼ã«ããã¯ã®å¼ã³åºãå ã¯ãfutureã§ã!ãã¡ã½ãã
- Channelã§ã®ã!ãã¡ã½ããï¼Channel.!ï¼ã¯ãã®ã¨ã³ããªã§åºããã¬ã¤ãã©ã¤ã³ã®ï¼ã¤ç®ã«åãã¦ã
- ãã®å®è£ ããã¦ãèªåã¯ããã®ã!ãã常ã«éåæã ã¨ã¿ãªãã¦ã
- çµæã¨ãã¦ã¬ã¤ãã©ã¤ã³ã®ï¼ã¤ç®ãå®ã£ã¦ãªãã£ãå®ä¾ã«ããªã£ã
- Channelã®ãã¶ã¤ã³ãå¤æ´ãã¦è§£æ±ºããã¨ããæ¹å
- èªåãªããããã
- èªåãªãChannelãæåãã常ã«éåæãªAPIã¨ãã¦ãã¶ã¤ã³ãã
- ç¾ç¶ã®Akkaã®ãã¶ã¤ã³ã®å¶ç´ã§èªåãåã£ã解決
- ã¡ãã»ã¼ã¸ãè¿ãã¢ã¯ã¿ã¼ã¨ã¡ãã»ã¼ã¸ãå¦çããã¢ããªã±ã¼ã·ã§ã³ã®ãã³ãã©ã¼ãã¢ã¯ã¿ã¼ãã復帰ããã¢ã¯ã¿ã¼åå©ç¨ããããã«å®è£ ãããå ´å
- ã¡ãã»ã¼ã¸è¿ä¿¡ãé 延ãããä»çµã¿ãèªåã§å®è£ ããªãã¨ãããªã
- ãã®ããæ¹ã¯ãã¹ãã§ã¯ãªããã©ãç¾æç¹ã§ã¯èªåããã®ããæ¹ã§ãã£ã¦ã
- private def asyncSend(channel: AkkaChannel[Any], message: Any) = {Future(channel ! message, self.timeout)(self.dispatcher)}
- ãã®ããæ¹ã®å¼±ç¹
- ã¢ã¯ã¿ã¼ã¸ã®å¿çãï¼åé 延ããã¦ãfutureã¸ã®ï¼åã ãã®å¿çãé 延ãããç¹
Nettyãããªãã¨ãã¯ã¹ã¬ãããã¼ã«ãããªãã£ã
Akkaã®ã!ãã使ã£ããã£ã¹ãããã£ã¼ãæä¾ããã¦ããã¨èªä½ã¯ãããã¨
Nettyã¨éã£ã¦Akkaã«ã¯ã³ã¼ã«ããã¯ãé
延ãããæ¹æ³ã«ã¤ãã¦è¦è§£ãæã£ã¦ãã
ã³ã¼ã«ããã¯é
延å¦çãæåãããã®ãã§ãã¯ãç¹å®ã±ã¼ã¹ã ã¨ãããªãã¨ãããªã
æè¿Akkaããã¸ã§ã¯ãå
é¨ã§ããã®ç¹ã¯è§£æ±ºããã¤ã¤ããããã
ã¾ã¨ã
- ã³ã¼ã«ããã¯ä½¿ã£ãAPIã¯ãã¤ãã³ãã«ã¼ãã¨ç¸æ§ãã
- ã³ã¼ã«ããã¯å¼ã³åºããé 延ã§ããããã«ãã¦ãããã¨ããã³ã¼ã«ããã¯ä½¿ãAPIã§ã¯å¤§äºã ãã
- ã¯ã©ã¤ã¢ã³ããµã¤ãjsãnodeãUIãã¼ã«ãããï¼ex.GTK+ï¼ããã¾ãã³ã¼ã«ããã¯ã使ãã¦ãã®ã¯ã¤ãã³ãã«ã¼ãã®ããã
- æ´å²ã®æµ ãJVMã§ã³ã¼ã«ããã¯ä½¿ã£ãAPIãã¶ã¤ã³ã«ã¯ã¾ã æ£æ»æ³ããªã
- ã¤ãã³ãã«ã¼ããå®è£ ããã©ã¤ãã©ãªï¼Akkaã¯åªç§ï¼ä½¿ãã
- ã¤ãã³ãã«ã¼ããå®è£ ããã©ã¤ãã©ãªãèªä½ããã
- ã¹ã¬ãããã¼ã«ãç¡å°½èµã«ä½¿ãã¾ããã
- ã³ã¼ã«ããã¯ä½¿ã£ãAPIãã¶ã¤ã³ã¯ä»æµè¡ã£ã¦ã
- ã³ã¼ã«ããã¯ãã¼ã¹ã®APIä½ã£ã人ããããåªå 度é«ãã§ã¦ã©ãããã次第