Skip to content

Commit

Permalink
+ state machine (gen_fsm) impl, multiple doc fix.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlepex committed Nov 13, 2017
1 parent 5b0e83e commit f40b72e
Show file tree
Hide file tree
Showing 40 changed files with 1,570 additions and 1,215 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ Agent is a very simple (thin) wrapper around the TaskEnqueuer class.
Agent interface (method naming) is inspired by Elixir Agent module.
See https://hexdocs.pm/elixir/Agent.html

#### github.jcext.StateMachine<E>

https://dlepex.github.io/jcext/github/jcext/StateMachine.html

Experimental implementation of Erlang gen_statem (gen_fsm) behaviour in a "state functions mode". In this mode
each state has a corresponding function (StateFunc) that handles events in that state.

This test contains two example of state machines:
https://github.com/dlepex/jcext/blob/master/src/main/java/github/jcext/StateMachineTest.java


#### Javadoc

Expand Down
11 changes: 6 additions & 5 deletions docs/allclasses-frame.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ <h1 class="bar">All&nbsp;Classes</h1>
<li><a href="github/jcext/Enqueuer.html" title="class in github.jcext" target="classFrame">Enqueuer</a></li>
<li><a href="github/jcext/Enqueuer.Conf.html" title="class in github.jcext" target="classFrame">Enqueuer.Conf</a></li>
<li><a href="github/jcext/Enqueuer.QueueFactory.html" title="interface in github.jcext" target="classFrame"><span class="interfaceName">Enqueuer.QueueFactory</span></a></li>
<li><a href="github/jcext/applications/ErlangActor.html" title="class in github.jcext.applications" target="classFrame">ErlangActor</a></li>
<li><a href="github/jcext/applications/ErlangActor.ReceiverFunc.html" title="interface in github.jcext.applications" target="classFrame"><span class="interfaceName">ErlangActor.ReceiverFunc</span></a></li>
<li><a href="github/jcext/applications/ErlangActor.SpecialMsg.html" title="enum in github.jcext.applications" target="classFrame">ErlangActor.SpecialMsg</a></li>
<li><a href="github/jcext/applications/ExactDateScheduler.html" title="class in github.jcext.applications" target="classFrame">ExactDateScheduler</a></li>
<li><a href="github/jcext/applications/ExactDateScheduler.Conf.html" title="class in github.jcext.applications" target="classFrame">ExactDateScheduler.Conf</a></li>
<li><a href="github/jcext/applications/ExactDateScheduler.Task.html" title="interface in github.jcext.applications" target="classFrame"><span class="interfaceName">ExactDateScheduler.Task</span></a></li>
Expand All @@ -31,11 +28,15 @@ <h1 class="bar">All&nbsp;Classes</h1>
<li><a href="github/jcext/applications/NettyChannelWritesEnqueuer.html" title="class in github.jcext.applications" target="classFrame">NettyChannelWritesEnqueuer</a></li>
<li><a href="github/jcext/applications/NettyChannelWritesEnqueuer.Conf.html" title="class in github.jcext.applications" target="classFrame">NettyChannelWritesEnqueuer.Conf</a></li>
<li><a href="github/jcext/Poller.html" title="interface in github.jcext" target="classFrame"><span class="interfaceName">Poller</span></a></li>
<li><a href="github/jcext/StateMachine.html" title="class in github.jcext" target="classFrame">StateMachine</a></li>
<li><a href="github/jcext/StateMachine.Conf.html" title="class in github.jcext" target="classFrame">StateMachine.Conf</a></li>
<li><a href="github/jcext/StateMachine.NextState.html" title="class in github.jcext" target="classFrame">StateMachine.NextState</a></li>
<li><a href="github/jcext/StateMachine.StateFunc.html" title="interface in github.jcext" target="classFrame"><span class="interfaceName">StateMachine.StateFunc</span></a></li>
<li><a href="github/jcext/TaskEnqueuer.html" title="class in github.jcext" target="classFrame">TaskEnqueuer</a></li>
<li><a href="github/jcext/TaskEnqueuer.Conf.html" title="class in github.jcext" target="classFrame">TaskEnqueuer.Conf</a></li>
<li><a href="github/jcext/TaskEnqueuer.RejectsListener.html" title="interface in github.jcext" target="classFrame"><span class="interfaceName">TaskEnqueuer.RejectsListener</span></a></li>
<li><a href="github/jcext/applications/Timer.html" title="interface in github.jcext.applications" target="classFrame"><span class="interfaceName">Timer</span></a></li>
<li><a href="github/jcext/applications/Timer.DefaultImpl.html" title="class in github.jcext.applications" target="classFrame">Timer.DefaultImpl</a></li>
<li><a href="github/jcext/Timer.html" title="interface in github.jcext" target="classFrame"><span class="interfaceName">Timer</span></a></li>
<li><a href="github/jcext/Timer.DefaultImpl.html" title="class in github.jcext" target="classFrame">Timer.DefaultImpl</a></li>
</ul>
</div>
</body>
Expand Down
11 changes: 6 additions & 5 deletions docs/allclasses-noframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ <h1 class="bar">All&nbsp;Classes</h1>
<li><a href="github/jcext/Enqueuer.html" title="class in github.jcext">Enqueuer</a></li>
<li><a href="github/jcext/Enqueuer.Conf.html" title="class in github.jcext">Enqueuer.Conf</a></li>
<li><a href="github/jcext/Enqueuer.QueueFactory.html" title="interface in github.jcext"><span class="interfaceName">Enqueuer.QueueFactory</span></a></li>
<li><a href="github/jcext/applications/ErlangActor.html" title="class in github.jcext.applications">ErlangActor</a></li>
<li><a href="github/jcext/applications/ErlangActor.ReceiverFunc.html" title="interface in github.jcext.applications"><span class="interfaceName">ErlangActor.ReceiverFunc</span></a></li>
<li><a href="github/jcext/applications/ErlangActor.SpecialMsg.html" title="enum in github.jcext.applications">ErlangActor.SpecialMsg</a></li>
<li><a href="github/jcext/applications/ExactDateScheduler.html" title="class in github.jcext.applications">ExactDateScheduler</a></li>
<li><a href="github/jcext/applications/ExactDateScheduler.Conf.html" title="class in github.jcext.applications">ExactDateScheduler.Conf</a></li>
<li><a href="github/jcext/applications/ExactDateScheduler.Task.html" title="interface in github.jcext.applications"><span class="interfaceName">ExactDateScheduler.Task</span></a></li>
Expand All @@ -31,11 +28,15 @@ <h1 class="bar">All&nbsp;Classes</h1>
<li><a href="github/jcext/applications/NettyChannelWritesEnqueuer.html" title="class in github.jcext.applications">NettyChannelWritesEnqueuer</a></li>
<li><a href="github/jcext/applications/NettyChannelWritesEnqueuer.Conf.html" title="class in github.jcext.applications">NettyChannelWritesEnqueuer.Conf</a></li>
<li><a href="github/jcext/Poller.html" title="interface in github.jcext"><span class="interfaceName">Poller</span></a></li>
<li><a href="github/jcext/StateMachine.html" title="class in github.jcext">StateMachine</a></li>
<li><a href="github/jcext/StateMachine.Conf.html" title="class in github.jcext">StateMachine.Conf</a></li>
<li><a href="github/jcext/StateMachine.NextState.html" title="class in github.jcext">StateMachine.NextState</a></li>
<li><a href="github/jcext/StateMachine.StateFunc.html" title="interface in github.jcext"><span class="interfaceName">StateMachine.StateFunc</span></a></li>
<li><a href="github/jcext/TaskEnqueuer.html" title="class in github.jcext">TaskEnqueuer</a></li>
<li><a href="github/jcext/TaskEnqueuer.Conf.html" title="class in github.jcext">TaskEnqueuer.Conf</a></li>
<li><a href="github/jcext/TaskEnqueuer.RejectsListener.html" title="interface in github.jcext"><span class="interfaceName">TaskEnqueuer.RejectsListener</span></a></li>
<li><a href="github/jcext/applications/Timer.html" title="interface in github.jcext.applications"><span class="interfaceName">Timer</span></a></li>
<li><a href="github/jcext/applications/Timer.DefaultImpl.html" title="class in github.jcext.applications">Timer.DefaultImpl</a></li>
<li><a href="github/jcext/Timer.html" title="interface in github.jcext"><span class="interfaceName">Timer</span></a></li>
<li><a href="github/jcext/Timer.DefaultImpl.html" title="class in github.jcext">Timer.DefaultImpl</a></li>
</ul>
</div>
</body>
Expand Down
21 changes: 13 additions & 8 deletions docs/github/jcext/Enqueuer.Conf.html
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ <h2 title="Class Enqueuer.Conf" class="title">Class Enqueuer.Conf</h2>
<li class="blockList">
<dl>
<dt>Direct Known Subclasses:</dt>
<dd><a href="../../github/jcext/applications/ExactDateScheduler.Conf.html" title="class in github.jcext.applications">ExactDateScheduler.Conf</a>, <a href="../../github/jcext/applications/NettyChannelWritesEnqueuer.Conf.html" title="class in github.jcext.applications">NettyChannelWritesEnqueuer.Conf</a>, <a href="../../github/jcext/TaskEnqueuer.Conf.html" title="class in github.jcext">TaskEnqueuer.Conf</a></dd>
<dd><a href="../../github/jcext/applications/ExactDateScheduler.Conf.html" title="class in github.jcext.applications">ExactDateScheduler.Conf</a>, <a href="../../github/jcext/applications/NettyChannelWritesEnqueuer.Conf.html" title="class in github.jcext.applications">NettyChannelWritesEnqueuer.Conf</a>, <a href="../../github/jcext/StateMachine.Conf.html" title="class in github.jcext">StateMachine.Conf</a>, <a href="../../github/jcext/TaskEnqueuer.Conf.html" title="class in github.jcext">TaskEnqueuer.Conf</a></dd>
</dl>
<dl>
<dt>Enclosing class:</dt>
Expand All @@ -117,7 +117,13 @@ <h2 title="Class Enqueuer.Conf" class="title">Class Enqueuer.Conf</h2>
<br>
<pre>public static class <span class="typeNameLabel">Enqueuer.Conf</span>
extends java.lang.Object</pre>
<div class="block">Configuration object.</div>
<div class="block">Configuration object.
Most users will use either <a href="../../github/jcext/Enqueuer.Conf.html#setBoundedQueue-int-"><code>setBoundedQueue(int)</code></a> or <a href="../../github/jcext/Enqueuer.Conf.html#setUnboundedQueue--"><code>setUnboundedQueue()</code></a> method <p>
<b>By default the queue is unbounded</b><p></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../github/jcext/Enqueuer.Conf.html#setUnboundedQueue--"><code>setUnboundedQueue()</code></a></dd>
</dl>
</li>
</ul>
</div>
Expand Down Expand Up @@ -167,9 +173,7 @@ <h3>Method Summary</h3>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../github/jcext/Enqueuer.Conf.html#setBoundedQueue-int-">setBoundedQueue</a></span>(int&nbsp;capacity)</code>
<div class="block">By default the queue is bounded and its max size equal to <a href="../../github/jcext/Enqueuer.html#defaultCapacity"><code>Enqueuer.defaultCapacity</code></a></div>
</td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../github/jcext/Enqueuer.Conf.html#setBoundedQueue-int-">setBoundedQueue</a></span>(int&nbsp;capacity)</code>&nbsp;</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>&lt;T&gt;&nbsp;void</code></td>
Expand All @@ -196,7 +200,7 @@ <h3>Method Summary</h3>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../github/jcext/Enqueuer.Conf.html#setUnboundedQueue--">setUnboundedQueue</a></span>()</code>
<div class="block">This option is discouraged, most users should use bounded queues.</div>
<div class="block">Be careful and <b>prefer bounded queues</b> for the cases where you deal with external untrusted user input (heap overflow exploit).</div>
</td>
</tr>
<tr id="i8" class="altColor">
Expand Down Expand Up @@ -257,7 +261,6 @@ <h3>Method Detail</h3>
<li class="blockList">
<h4>setBoundedQueue</h4>
<pre>public&nbsp;void&nbsp;setBoundedQueue(int&nbsp;capacity)</pre>
<div class="block">By default the queue is bounded and its max size equal to <a href="../../github/jcext/Enqueuer.html#defaultCapacity"><code>Enqueuer.defaultCapacity</code></a></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>capacity</code> - max queue size.</dd>
Expand All @@ -271,7 +274,9 @@ <h4>setBoundedQueue</h4>
<li class="blockList">
<h4>setUnboundedQueue</h4>
<pre>public&nbsp;void&nbsp;setUnboundedQueue()</pre>
<div class="block">This option is discouraged, most users should use bounded queues.</div>
<div class="block">Be careful and <b>prefer bounded queues</b> for the cases where you deal with external untrusted user input (heap overflow exploit).<p>
Unbounded queues are the right choice when you can't afford item (or event) loss because it will lead to the state corruption
of your actor-like entity. However such entities should not be directly available to the untrusted party.</div>
</li>
</ul>
<a name="setAssociatedId-java.lang.Object-">
Expand Down
66 changes: 19 additions & 47 deletions docs/github/jcext/Enqueuer.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":6,"i3":10,"i4":10};
var methods = {"i0":10,"i1":10,"i2":6,"i3":10,"i4":10,"i5":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
Expand Down Expand Up @@ -73,13 +73,13 @@
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
Expand Down Expand Up @@ -162,27 +162,6 @@ <h3>Nested Class Summary</h3>
</table>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../github/jcext/Enqueuer.html#defaultCapacity">defaultCapacity</a></span></code>
<div class="block">Default bounded queue capacity.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
Expand Down Expand Up @@ -233,10 +212,14 @@ <h3>Method Summary</h3>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code>java.util.concurrent.Executor</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../github/jcext/Enqueuer.html#threadPool--">threadPool</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../github/jcext/Enqueuer.html#toString--">toString</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i4" class="altColor">
<tr id="i5" class="rowColor">
<td class="colFirst"><code>protected <a href="../../github/jcext/Enqueuer.html" title="class in github.jcext">Enqueuer</a>&lt;?&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../github/jcext/Enqueuer.html#underlyingEnq--">underlyingEnq</a></span>()</code>&nbsp;</td>
</tr>
Expand All @@ -256,26 +239,6 @@ <h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="defaultCapacity">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>defaultCapacity</h4>
<pre>public static final&nbsp;int defaultCapacity</pre>
<div class="block">Default bounded queue capacity.
Use system property <code>"jcext.enq.defaultCap"</code> to change it.
Default value is 8192</div>
</li>
</ul>
</li>
</ul>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
Expand Down Expand Up @@ -364,6 +327,15 @@ <h4>underlyingEnq</h4>
<pre>protected final&nbsp;<a href="../../github/jcext/Enqueuer.html" title="class in github.jcext">Enqueuer</a>&lt;?&gt;&nbsp;underlyingEnq()</pre>
</li>
</ul>
<a name="threadPool--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>threadPool</h4>
<pre>public final&nbsp;java.util.concurrent.Executor&nbsp;threadPool()</pre>
</li>
</ul>
<a name="toString--">
<!-- -->
</a>
Expand Down Expand Up @@ -430,13 +402,13 @@ <h4>toString</h4>
<ul class="subNavList">
<li>Summary:&nbsp;</li>
<li><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.summary">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li><a href="#field.detail">Field</a>&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#constructor.detail">Constr</a>&nbsp;|&nbsp;</li>
<li><a href="#method.detail">Method</a></li>
</ul>
Expand Down
4 changes: 2 additions & 2 deletions docs/github/jcext/Poller.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<div class="subNav">
<ul class="navList">
<li><a href="../../github/jcext/JcExt.html" title="class in github.jcext"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../github/jcext/TaskEnqueuer.html" title="class in github.jcext"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
<li><a href="../../github/jcext/StateMachine.html" title="class in github.jcext"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?github/jcext/Poller.html" target="_top">Frames</a></li>
Expand Down Expand Up @@ -265,7 +265,7 @@ <h4>pollByChunk</h4>
<div class="subNav">
<ul class="navList">
<li><a href="../../github/jcext/JcExt.html" title="class in github.jcext"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../github/jcext/TaskEnqueuer.html" title="class in github.jcext"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
<li><a href="../../github/jcext/StateMachine.html" title="class in github.jcext"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../index.html?github/jcext/Poller.html" target="_top">Frames</a></li>
Expand Down
Loading

0 comments on commit f40b72e

Please sign in to comment.