You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* A Multi-Threading framework, allowing asynchronous programming
6
-
* A new IO (Input/Output) model, flexible, and providing asynchronous operations
6
+
* A new IO (Input/Output) model, much more flexible, and supporting asynchronous operations
7
7
8
8
It does not have any dependency, however the library [net.lecousin.framework.system](https://github.com/lecousin/java-framework-system"java-framework-system")
9
9
is recommended for better performances on disk operations (detection of physical drives).
The multi-threading system of this library is based on _physical_ resources for better performance:
23
+
The multi-threading system is based on _physical_ resources for better performance:
24
24
* One thread by available processor (CPU)
25
25
* One thread by physical drive
26
26
27
27
Each unit of work is a _Task_, that may succeed with a result, fail with an exception, or be cancelled.
28
28
A task must use only one physical resource, so a process implying both CPU work and some operations on a drive
29
29
must be split into several tasks.
30
30
31
+
Because the multi-threading system allocates a single thread by CPU, if long running tasks are running, other
32
+
tasks may wait for those tasks to finish if all CPUs are used. While this may be acceptable on a single application
33
+
environment, it is recommended to split such long running tasks into smaller tasks.
34
+
31
35
A task should not, but is allowed to block. In this case the blocked thread is interrupted and a new thread
32
36
is automatically launched to process other tasks for the same physical resource. Once the task is unblocked,
33
-
the thread is resumed as soon as another thread is available and can be stopped.
34
-
35
-
By default, the order tasks are executed is based on tasks' priority,
36
-
then for the same priority in a first-in-first-out order.
37
-
This may be changed by providing a new implementation of TaskPriorityManager.
37
+
the thread is resumed as soon as another thread is available and can be stopped. For this, synchronized
38
+
sections should be avoided as much as possible (or be very short), instead a _synchronization point_ should
39
+
be used.
38
40
39
41
Different kinds of _synchronization point_ are available in the package net.lecousin.framework.concurrent.synch,
40
42
such as JoinPoint, SynchronizationPoint, AsyncWork... They allow to wait for one or more asynchronous operations
41
43
to finish (successfully or not), by listening to them.
42
44
45
+
By default, the order tasks are executed is based on tasks' priority,
46
+
then for the same priority in a first-in-first-out order.
47
+
This may be changed by providing a new implementation of TaskPriorityManager.
48
+
43
49
## IO Model
44
50
45
51
The model provided by Java is very basic and mainly based on streams (reading or writing forward).
46
52
47
-
Our model add two main additions:
48
-
* Flexibility by using interfaces that define the capabilities of an Input/Output implementation such as Readable, Writable, Seekable, Resizable, Buffered...
Copy file name to clipboardExpand all lines: net.lecousin.core/src/test/java/net/lecousin/framework/core/tests/io/impl/TestFragmentedSubIOReadable.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ public TestFragmentedSubIOReadable(FragmentedFile f) {
Copy file name to clipboardExpand all lines: net.lecousin.core/src/test/java/net/lecousin/framework/core/tests/io/impl/TestFragmentedSubIOReadableSeekable.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -31,7 +31,7 @@ public TestFragmentedSubIOReadableSeekable(FragmentedFile f) {
0 commit comments