2. "The ability to simplify means to eliminate the
unnecessary so that the necessary may speak."
Hans Hoffmann
3. What is Javolution?
● Javolution is a Java API for real-time software
systems
● Real-time systems imply:
● Higher execution speed
● Time predictability
4. Advantages
● Some classes are easier to use than standard
classes in some SDKs or APIs.
● Example: „You don't need to guess the capacity
of a TextBuilder, FastTable or a FastMap, their
size expand gently without ever incurring
expensive resize/copy or rehash operations
(unlike StringBuilder, ArrayList or HashMap).
„ [1]
5. Advantages (continued)
● Javolution makes it easy for concurrent
algorithms to take advantage of multi-
processors systems. [1]
● Example: Class ConcurrentContext
● When a thread enters a concurrent context, it
may call the execute method, then continue
with a concurrent thread immediately (or the
thread itself if there is no concurrent thread
immediately available)
6. Advantages (continued)
● Real-time collection classes
● Example: ArrayList (standard) vs. FastTable
(Javolution:
● ArrayList may throw
ConcurrentModificationException
● FastTable does not throw it (more thread-safe)
8. Advantages (continued)
● Most Javolution classes are stateless ([1])
● state passed through parameters to methods or
available through Context classes
● This design approach makes Javolution and
any product based on Javolution highly
parrallelizable with no need for synchronization
9. Important Features
● Context classes allow true separation of
concerns (eg. logging, performance, etc.)
● Testing framework
● Allows assertions on execution time in
nanoseconds
● World's fastest and first hard real-time XML
marshalling/unmarshalling facility([1])
11. Context
● This class represents an execution context;
they can be associated to particular threads or
objects.
● Applications may extend this to facilitate
separation of concerns
● Extended by:
● ConcurrentContext (see slide 5)
● SecurityContext
12. SecurityContext
● Used for separating security concerns.
Example for addressing security requirements
([1])
public static boolean isReadAllowed(Table table) {
SecurityContext policy = SecurityContext.current();
return (policy instanceof DatabaseAccess.Permission) ?
((DatabaseAccess.Permission)policy).isReadable(table) :
false;
}
13. High Performance IO Classes
● CharSequenceReader
● UTF8ByteBufferReader
● UTF8ByteBufferWriter
● UTF8StreamReader
● UTF8StreamWriter
● Differences between this and standard
StreamWriters:
– Instances of this class can be reused for different output
streams.
– Wrapping using a java.io.BufferedWriter is unnescessary
as instances of this class embed their own data buffers.
14. The Realtime Package
● RealTimeInterface: defines RTSJ safe classes
● RealtimeThread: time-predictable threads
● Reflection.Constructor and Reflection.Method:
● Achieves some of the features provided by
reflection
● Reflection is known to be slow
15. The javolution.util Package
● Includes a lot of Javolution collection classes
that have counterparts in standard Java
packages.
● Examples:
– FastMap<K,V> - HashMap<K,V>
– FastSet<E> - Set<E>
– FastTable<E> - ArrayList<E>
16. The javolution.util Package
(continued)
● StandardLog class: represents a specialized
logging context forwarding events to a standard
logger (java.util.logging.Logger) ([1])
● ReentrantLock: same functionality as standard
locks
19. Sample application
● Application is similar reaction time tests in
driving schools
● Used for testing and improving reaction times
● User is shown some letters
● He is supposed to press a key as fast as he can
if a vocal appears, before it disappears
● Otherwise he is not supposed to press anything
20. Sample application (continued)
● Uses RealtimeThread for controlling the output
and measuring reaction times
● Also measures delays caused by threads
● Uses FastSet to keep records of events