# HG changeset patch # User sugi # Date 1420460196 -32400 # Node ID c8f50c3ead48d63797096ffe897590bb98998f0c # Parent e59c8e99a5c14bc32e1943a0445b40f125a45c53 modify chapter3 diff -r e59c8e99a5c1 -r c8f50c3ead48 paper/chapter1.tex --- a/paper/chapter1.tex Sun Jan 04 04:43:51 2015 +0900 +++ b/paper/chapter1.tex Mon Jan 05 21:16:36 2015 +0900 @@ -236,4 +236,8 @@ \label{fig:topologymanagerandnode} \end{figure} -\section{Aliceによるプログラミング手法} \ No newline at end of file +\section{Aliceによるプログラミング手法} +\subsection{記述に関する注意点} +\subsubsection{nullpointerException} +\subsubsection{Message Packの使い方} +\subsubsection{singleton Code Segment} \ No newline at end of file diff -r e59c8e99a5c1 -r c8f50c3ead48 paper/chapter3.tex --- a/paper/chapter3.tex Sun Jan 04 04:43:51 2015 +0900 +++ b/paper/chapter3.tex Mon Jan 05 21:16:36 2015 +0900 @@ -62,6 +62,7 @@ \item 指定された時間が訪れるとheartbeatがRemote Data Segment(Node B)に送信される。\label{enum:send} \item \ref{enum:send}と同時にheartbeatを送信したRemote Data Segmentとの接続を切断する{\tt CLOSE}タスクが投入される。\label{enum:putCloseTask} \item \ref{enum:putCloseTask}で投入された{\tt CLOSE}タスクが実行されるまでに、Remote Data Segment(Node B)からのレスポンスがあった場合、RemoveTask(Code Segment)により{\tt CLOSE}タスクが削除される。 +%\item \ref{enum:putPingTask}に戻る。 \end{enumerate} \ref{enum:putPingTask}で作られる{\tt PING}タスクは、接続しているRemote Data Segmentの数だけ投入される。 @@ -70,6 +71,8 @@ 以上で説明した処理の流れは、接続状態に問題がない場合である。 接続状態に問題があり、{\tt CLOSE}タスクの実行されるまでにレスポンスがない場合は、{\tt CLOSE}タスクによりRemote Data Segmentが削除される。 + +heartbeatは、Node AからNode Bに一方向に送られる訳ではなく、Node BからNode Aにも送られている。 %Singleton Code Segmentの注意点 ids.initが必要とその理由の記述 \section{切断時の処理} @@ -96,5 +99,30 @@ \section{Multicast Data Segment} TreeVNCには、Multicastを利用して起動しているTreeVNCのRoot Nodeの情報の一覧にして表示する接続先自動検索システムという機能がある。この機能によりTreeVNCの起動の際にIPアドレスを入力する手間を省くことができる。 -現在のAliceは起動時にTopology ManagerのIPアドレスを入力する必要がある。そこで、Aliceにも同様なTopology Manager検索システムを実装するためにMulticast Data Segmentを追加した。 -Multicast Data Segmentは同じマルチキャストアドレスを持つ端末を1つのRemote Data Segmentとして扱う。 \ No newline at end of file +現在のAliceは起動時にTopology ManagerのIPアドレスを入力する必要があり、TreeVNCの接続先自動検索機能が必要と考えられる。 +その機能を実現するためにはMulticastに対応する必要がある。そこで、同じマルチキャストアドレスを持つ端末を1つのData Segmentとして扱うMuticast Data Segmentを追加した。 +Multicast Data Segmentは、Remote Data Segmentと同様のAPIを用いて扱うことができる。 + +\begin{figure}[htbp] +\begin{center} +\includegraphics[width=120mm]{images/multicast.pdf} +\end{center} +\caption{Multicast Data Segment} +\label{fig:multicast} +\end{figure} + +図 \ref{fig:multicast}はMulticast Data Segmentを図で表したものである。Multicast Data Segmentに対してputを行うとnode D、node E、node Fの3つのnodeに対してデータがputされる。同様にTakeを行うと3つのnodeからreplyが来る。 + +\subsection{Multicast Data Segmentの作り方} +Multicast Data SegmentもRemote Data Segment同様Managerを経由して操作を行う。Multicast DSMを作成するとMulticast Data Segmentに対する送受信用のスレッドが作成される。 + +\begin{itemize} +\item {\ttfamily public static MulticastDataSegmentManager \\ +connectMulticast(String connectionKey ,String MCSTADDR, int port, String nis, SocketType type)} +\end{itemize} + +DataSegment classのstaticメソッドである、connectMulticastを呼ぶことでMulticast DSMが作成される。 +第1引数はMulticast DSMへのアクセスするためのkeyを指定できる。第2引数はマルチキャストアドレスを、第3引数はポート番号を、第4引数はネットワークインターフェイスを指定する。第5引数はSocketTypeを指定する。 +SocketTypeには、{\tt Sender}と{\tt Receiver}と{\tt Both}が存在する。{\tt Sender}を指定した場合は、第2引数で指定したマルチキャストアドレスに対して送信処理を行うスレッドを作成する。{\tt Receiver}を指定した場合は、第2引数で指定したマルチキャストアドレスに対して送信されたデータを受信するスレッドを作成する。{\tt Both}は、送受信両方のスレッドを作成する。 + +Multicast Data Segmentとして扱いたい \ No newline at end of file diff -r e59c8e99a5c1 -r c8f50c3ead48 paper/images/multicast.graffle --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/paper/images/multicast.graffle Mon Jan 05 21:16:36 2015 +0900 @@ -0,0 +1,746 @@ + + + + + ActiveLayerIndex + 0 + ApplicationVersion + + com.omnigroup.OmniGraffle6 + 156.11.0.206384 + + AutoAdjust + + BackgroundGraphic + + Bounds + {{0, 0}, {558.99997329711914, 783}} + Class + SolidGraphic + ID + 2 + Style + + stroke + + Draws + NO + + + + BaseZoom + 0 + CanvasOrigin + {0, 0} + ColumnAlign + 1 + ColumnSpacing + 36 + CreationDate + 2012-02-09 04:46:08 +0000 + Creator + Kazuki AKAMINE + DisplayScale + 1 in = 1 in + GraphDocumentVersion + 11 + GraphicsList + + + Class + LineGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + Head + + ID + 45 + + ID + 46 + Points + + {431.4375, 217.6875} + {185.0625, 217.6875} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + Tail + + ID + 21 + + + + Class + Group + Graphics + + + Bounds + {{140.0625, 132.75}, {90, 27}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 14 + + ID + 40 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\deftab720 +\pard\pardeftab720\qc + +\f0\fs28 \cf0 Multicast DS} + + Wrap + NO + + + Bounds + {{147.75, 279}, {69, 27}} + Class + ShapedGraphic + FitText + YES + Flow + Resize + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 14 + + ID + 41 + Shape + Rectangle + Style + + fill + + Draws + NO + + shadow + + Draws + NO + + stroke + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fnil\fcharset0 HelveticaNeue;} +{\colortbl;\red255\green255\blue255;} +\deftab720 +\pard\pardeftab720\qc + +\f0\fs28 \cf0 224.0.0.1} + + Wrap + NO + + + Bounds + {{194.625, 223.87499999999997}, {82.125, 46.125}} + Class + ShapedGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 42 + Shape + Rectangle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Remote DS\ +node F} + + + + Bounds + {{95.625, 223.87499999999997}, {82.125, 46.125}} + Class + ShapedGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 43 + Shape + Rectangle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Remote DS\ +node E} + + + + Bounds + {{144, 164.8125}, {82.125, 46.125}} + Class + ShapedGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 44 + Shape + Rectangle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Remote DS\ +node D} + + + + Bounds + {{50.625, 129.375}, {268.875, 176.625}} + Class + ShapedGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 45 + Shape + Circle + Style + + shadow + + Draws + NO + + stroke + + Color + + b + 0.246914 + g + 0.246914 + r + 1 + + + + + + ID + 39 + + + Class + LineGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + Head + + ID + 21 + + ID + 23 + Points + + {250.3125, 73.6875} + {431.4375, 217.6875} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + Tail + + ID + 20 + + + + Class + LineGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + Head + + ID + 21 + + ID + 22 + Points + + {141.1875, 73.6875} + {431.4375, 217.6875} + + Style + + stroke + + HeadArrow + 0 + Legacy + + TailArrow + 0 + + + Tail + + ID + 11 + + + + Bounds + {{390.375, 194.625}, {82.125, 46.125}} + Class + ShapedGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 21 + Shape + Rectangle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Local DS\ +node A} + + + + Bounds + {{209.25, 50.625}, {82.125, 46.125}} + Class + ShapedGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 20 + Shape + Rectangle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Remote DS\ +node C} + + + + Bounds + {{100.125, 50.625}, {82.125, 46.125}} + Class + ShapedGraphic + FontInfo + + Color + + w + 0 + + Font + Helvetica + Size + 12 + + ID + 11 + Shape + Rectangle + Style + + shadow + + Draws + NO + + + Text + + Text + {\rtf1\ansi\ansicpg932\cocoartf1265\cocoasubrtf210 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural\qc + +\f0\fs24 \cf0 Remote DS\ +node B} + + + + GridInfo + + GuidesLocked + NO + GuidesVisible + YES + HPages + 1 + ImageCounter + 3 + KeepToScale + + Layers + + + Lock + NO + Name + レイヤー 1 + Print + YES + View + YES + + + LayoutInfo + + Animate + NO + circoMinDist + 18 + circoSeparation + 0.0 + layoutEngine + dot + neatoLineLength + 0.20000000298023224 + neatoSeparation + 0.0 + twopiSeparation + 0.0 + + LinksVisible + NO + MagnetsVisible + NO + MasterSheets + + ModificationDate + 2015-01-05 00:42:04 +0000 + Modifier + YuSugimoto + NotesVisible + NO + Orientation + 2 + OriginVisible + NO + PageBreaks + YES + PrintInfo + + NSBottomMargin + + float + 41 + + NSHorizonalPagination + + coded + BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG + + NSLeftMargin + + float + 18 + + NSPaperSize + + size + {594.99997329711914, 842} + + NSPrintReverseOrientation + + coded + BAtzdHJlYW10eXBlZIHoA4QBQISEhAhOU051bWJlcgCEhAdOU1ZhbHVlAISECE5TT2JqZWN0AIWEASqEhAFxlwCG + + NSRightMargin + + float + 18 + + NSTopMargin + + float + 18 + + + PrintOnePage + + ReadOnly + NO + RowAlign + 1 + RowSpacing + 36 + SheetTitle + キャンバス 1 + SmartAlignmentGuidesActive + YES + SmartDistanceGuidesActive + YES + UniqueID + 1 + UseEntirePage + + VPages + 1 + WindowInfo + + BottomSlabHeight + 434 + CurrentSheet + 0 + Expanded_Canvases + + Frame + {{42, 0}, {1200, 778}} + ShowInfo + + ShowRuler + + Sidebar + + SidebarWidth + 230 + VisibleRegion + {{0, 0}, {558.11967859136598, 543.58976352849731}} + Zoom + 1.1699999570846558 + ZoomValues + + + キャンバス 1 + 1.1699999570846558 + 1.1699999999999999 + + + + + diff -r e59c8e99a5c1 -r c8f50c3ead48 paper/images/multicast.pdf Binary file paper/images/multicast.pdf has changed diff -r e59c8e99a5c1 -r c8f50c3ead48 paper/source/CatchClosedEvent.java --- a/paper/source/CatchClosedEvent.java Sun Jan 04 04:43:51 2015 +0900 +++ b/paper/source/CatchClosedEvent.java Mon Jan 05 21:16:36 2015 +0900 @@ -1,6 +1,3 @@ -import alice.codesegment.CloseEventCodeSegment; -import alice.daemon.ConnectionInfo; - public class CatchClosedEvent extends CloseEventCodeSegment{ @Override