This is an automated email from the ASF dual-hosted git repository. git-site-role pushed a commit to branch asf-site in repository https://gitbox.apache.org/repos/asf/mina-site.git
The following commit(s) were added to refs/heads/asf-site by this push: new 778867851 Updated site from master (4427e68ecb56f5bf9c387c2ac47f3d764525ba89) 778867851 is described below commit 778867851e7d5f0b8b5f5404f7dbc0a528d6f6ca Author: jenkins <bui...@apache.org> AuthorDate: Tue Oct 1 11:11:00 2024 +0000 Updated site from master (4427e68ecb56f5bf9c387c2ac47f3d764525ba89) --- content/index.xml | 2 +- content/mina-project/index.xml | 2 +- .../userguide/ch3-service/ch3.3-acceptor.html | 30 +++++++++++----------- content/sitemap.xml | 4 +-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/content/index.xml b/content/index.xml index 648ba065a..92964a36c 100644 --- a/content/index.xml +++ b/content/index.xml @@ -174,7 +174,7 @@ IoAcceptor Basically, this interface is named because of the accept() method, re <guid>https://mina.apache.org/mina-project/userguide/ch3-service/ch3.3-acceptor.html</guid> <description>3.3 - Acceptor In order to build a server, you need to select an implementation of the IoAcceptor interface. -IoAcceptor Basically, this interface is named because of the accept() method, responsible for the creation of new connection between a client and the server. The server accepts incoming connection request. +IoAcceptor Basically, this interface is named because of the accept() method, responsible for the creation of new connections between a client and the server. The server accepts incoming connections request. At some point, we could have named this interface &lsquo;Server&rsquo;. As we may deal with more than one kind of transport (TCP/UDP/&hellip;), we have more than one implementation for this interface.</description> </item> diff --git a/content/mina-project/index.xml b/content/mina-project/index.xml index 284675fd9..5b5b03cec 100644 --- a/content/mina-project/index.xml +++ b/content/mina-project/index.xml @@ -174,7 +174,7 @@ IoAcceptor Basically, this interface is named because of the accept() method, re <guid>https://mina.apache.org/mina-project/userguide/ch3-service/ch3.3-acceptor.html</guid> <description>3.3 - Acceptor In order to build a server, you need to select an implementation of the IoAcceptor interface. -IoAcceptor Basically, this interface is named because of the accept() method, responsible for the creation of new connection between a client and the server. The server accepts incoming connection request. +IoAcceptor Basically, this interface is named because of the accept() method, responsible for the creation of new connections between a client and the server. The server accepts incoming connections request. At some point, we could have named this interface &lsquo;Server&rsquo;. As we may deal with more than one kind of transport (TCP/UDP/&hellip;), we have more than one implementation for this interface.</description> </item> diff --git a/content/mina-project/userguide/ch3-service/ch3.3-acceptor.html b/content/mina-project/userguide/ch3-service/ch3.3-acceptor.html index e72f92c02..87730b134 100644 --- a/content/mina-project/userguide/ch3-service/ch3.3-acceptor.html +++ b/content/mina-project/userguide/ch3-service/ch3.3-acceptor.html @@ -147,21 +147,21 @@ <h1 id="33---acceptor">3.3 - Acceptor</h1> <p>In order to build a server, you need to select an implementation of the <em>IoAcceptor</em> interface.</p> <h2 id="ioacceptor">IoAcceptor</h2> -<p>Basically, this interface is named because of the <em>accept()</em> method, responsible for the creation of new connection between a client and the server. The server accepts incoming connection request.</p> +<p>Basically, this interface is named because of the <em>accept()</em> method, responsible for the creation of new connections between a client and the server. The server accepts incoming connections request.</p> <p>At some point, we could have named this interface ‘Server’.</p> <p>As we may deal with more than one kind of transport (TCP/UDP/…), we have more than one implementation for this interface. It would be very unlikely that you need to implement a new one.</p> <p>We have many of those implementing classes</p> <ul> -<li><strong>NioSocketAcceptor</strong> : the non-blocking Socket transport <em>IoAcceptor</em></li> -<li><strong>NioDatagramAcceptor</strong> : the non-blocking UDP transport <em>IoAcceptor</em></li> -<li><strong>AprSocketAcceptor</strong> : the blocking Socket transport <em>IoAcceptor</em>, based on APR</li> -<li><strong>VmPipeSocketAcceptor</strong> : the in-VM <em>IoAcceptor</em></li> +<li><strong>NioSocketAcceptor</strong>: the non-blocking Socket transport <em>IoAcceptor</em></li> +<li><strong>NioDatagramAcceptor</strong>: the non-blocking UDP transport <em>IoAcceptor</em></li> +<li><strong>AprSocketAcceptor</strong>: the blocking Socket transport <em>IoAcceptor</em>, based on APR</li> +<li><strong>VmPipeSocketAcceptor</strong>: the in-VM <em>IoAcceptor</em></li> </ul> <p>Just pick the one that fit your need.</p> -<p>Here is the class diagram for the <em>IoAcceptor</em> interfaces and classes :</p> +<p>Here is the class diagram for the <em>IoAcceptor</em> interfaces and classes:</p> <p><img src="/assets/img/mina/IoServiceAcceptor.png" alt=""></p> <h2 id="creation">Creation</h2> -<p>You first have to select the type of <em>IoAcceptor</em> you want to instantiate. This is a choice you will made early in the process, as it all boils down to which network protocol you will use. Let’s see with an example how it works :</p> +<p>You first have to select the type of <em>IoAcceptor</em> you want to instantiate. This is a choice you will made early in the process, as it all boils down to which network protocol you will use. Let’s see with an example how it works:</p> <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#a2f;font-weight:bold">public</span> <span style="color:#00a000">TcpServer</span><span style="color:#666">(</span><span style="color:#666">)</span> <span style="color:#a2f;font-weight:bold">throws</span> IOException <span style="color:#666">{</span> <span style="color:#080;font-style:italic">// Create a TCP acceptor </span><span style="color:#080;font-style:italic"></span> IoAcceptor acceptor <span style="color:#666">=</span> <span style="color:#a2f;font-weight:bold">new</span> NioSocketAcceptor<span style="color:#666">(</span><span style="color:#666">)</span><span style="color:#666">;</span> @@ -174,7 +174,7 @@ System<span style="color:#666">.</span><span style="color:#b44">out</span><span style="color:#666">.</span><span style="color:#b44">println</span><span style="color:#666">(</span><span style="color:#b44">"Server started..."</span><span style="color:#666">)</span><span style="color:#666">;</span> <span style="color:#666">}</span> -</code></pre></div><p>That’s it ! You have created a TCP server. If you want to start an UDP server, simply replace the first line of code :</p> +</code></pre></div><p>That’s it ! You have created a TCP server. If you want to start an UDP server, simply replace the first line of code:</p> <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#666">.</span><span style="color:#666">.</span><span style="color:#666">.</span> <span style="color:#080;font-style:italic">// Create an UDP acceptor </span><span style="color:#080;font-style:italic"></span>IoAcceptor acceptor <span style="color:#666">=</span> <span style="color:#a2f;font-weight:bold">new</span> NioDatagramAcceptor<span style="color:#666">(</span><span style="color:#666">)</span><span style="color:#666">;</span> @@ -183,24 +183,24 @@ <p>The service can be stopped by calling the <em>dispose()</em> method. The service will be stopped only when all the pending sessions have been processed :</p> <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#080;font-style:italic">// Stop the service, waiting for the pending sessions to be inactive </span><span style="color:#080;font-style:italic"></span>acceptor<span style="color:#666">.</span><span style="color:#b44">dispose</span><span style="color:#666">(</span><span style="color:#666">)</span><span style="color:#666">;</span> -</code></pre></div><p>You can also wait for every thread being executed to be properly completed by passing a boolean parameter to this method :</p> +</code></pre></div><p>You can also wait for every thread being executed to be properly completed by passing a boolean parameter to this method:</p> <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#080;font-style:italic">// Stop the service, waiting for the processing session to be properly completed </span><span style="color:#080;font-style:italic"></span>acceptor<span style="color:#666">.</span><span style="color:#b44">dispose</span><span style="color:#666">(</span> <span style="color:#a2f;font-weight:bold">true</span> <span style="color:#666">)</span><span style="color:#666">;</span> </code></pre></div><h2 id="status">Status</h2> -<p>You can get the <em>IoService</em> status by calling one of the following methods :</p> +<p>You can get the <em>IoService</em> status by calling one of the following methods:</p> <ul> -<li><em>isActive()</em> : true if the service can accept incoming requests</li> -<li><em>isDisposing()</em> : true if the <em>dispose()</em> method has been called. It does not tell if the service is actually stopped (some sessions might be processed)</li> -<li><em>isDisposed()</em> : true if the <em>dispose(boolean)</em> method has been called, and the executing threads have been completed.</li> +<li><em>isActive()</em>: true if the service can accept incoming requests</li> +<li><em>isDisposing()</em>: true if the <em>dispose()</em> method has been called. It does not tell if the service is actually stopped (some sessions might be processed)</li> +<li><em>isDisposed()</em>: true if the <em>dispose(boolean)</em> method has been called, and the executing threads have been completed.</li> </ul> <h2 id="managing-the-iohandler">Managing the IoHandler</h2> <p>You can add or get the associated <em>IoHandler</em> when the service has been instantiated. You just have to call the <em>setHandler(IoHandler)</em> or <em>getHandler()</em> methods.</p> <h2 id="managing-the-filters-chain">Managing the Filters chain</h2> -<p>if you want to manage the filters chain, you will have to call the <em>getFilterChain()</em> method. Here is an example :</p> +<p>if you want to manage the filters chain, you will have to call the <em>getFilterChain()</em> method. Here is an example:</p> <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#080;font-style:italic">// Add a logger filter </span><span style="color:#080;font-style:italic"></span>DefaultIoFilterChainBuilder chain <span style="color:#666">=</span> acceptor<span style="color:#666">.</span><span style="color:#b44">getFilterChain</span><span style="color:#666">(</span><span style="color:#666">)</span><span style="color:#666">;</span> chain<span style="color:#666">.</span><span style="color:#b44">addLast</span><span style="color:#666">(</span><span style="color:#b44">"logger"</span><span style="color:#666">,</span> <span style="color:#a2f;font-weight:bold">new</span> LoggingFilter<span style="color:#666">(</span><span style="color:#666">)</span><span style="color:#666">)</span><span style="color:#666">;</span> -</code></pre></div><p>You can also create the chain before and set it into the service :</p> +</code></pre></div><p>You can also create the chain before and set it into the service:</p> <div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-java" data-lang="java"><span style="color:#080;font-style:italic">// Add a logger filter </span><span style="color:#080;font-style:italic"></span>DefaultIoFilterChainBuilder chain <span style="color:#666">=</span> <span style="color:#a2f;font-weight:bold">new</span> DefaultIoFilterChainBuilder<span style="color:#666">(</span><span style="color:#666">)</span><span style="color:#666">;</span> chain<span style="color:#666">.</span><span style="color:#b44">addLast</span><span style="color:#666">(</span><span style="color:#b44">"logger"</span><span style="color:#666">,</span> <span style="color:#a2f;font-weight:bold">new</span> LoggingFilter<span style="color:#666">(</span><span style="color:#666">)</span><span style="color:#666">)</span><span style="color:#666">;</span> diff --git a/content/sitemap.xml b/content/sitemap.xml index b6ca38b74..d8b833d9e 100644 --- a/content/sitemap.xml +++ b/content/sitemap.xml @@ -79,7 +79,7 @@ <url> <loc>https://mina.apache.org/mina-project/userguide/ch3-service/ch3.3-acceptor.html</loc> - <lastmod>2020-02-24T11:41:02+01:00</lastmod> + <lastmod>2024-10-01T13:05:59+02:00</lastmod> </url> <url> @@ -914,7 +914,7 @@ <url> <loc>https://mina.apache.org/mina-project.html</loc> - <lastmod>2024-09-16T09:40:09+02:00</lastmod> + <lastmod>2024-10-01T13:05:59+02:00</lastmod> </url> <url>