All Downloads are FREE. Search and download functionalities are using the official Maven repository.

javolution.lang.Parallelizable Maven / Gradle / Ivy

Go to download

Only the Java Core part of Javolution library, with slight modifications for use in MSFTBX.

There is a newer version: 6.11.8
Show newest version
/*
 * Javolution - Java(TM) Solution for Real-Time and Embedded Systems
 * Copyright (C) 2012 - Javolution (http://javolution.org/)
 * All rights reserved.
 * 
 * Permission to use, copy, modify, and distribute this software is
 * freely granted, provided that this notice is preserved.
 */
package javolution.lang;

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 

Indicates that a class, a method or a field can be used by multiple * threads concurrently and whether or not it is * {@link Parallelizable#mutexFree() mutex-free} (not blocking).

* * [code] * public class Operators { * @Parallelizable * public static final Reducer ANY = new Reducer() { ... } * * @Parallelizable(mutexFree = false, comment="Internal use of synchronization") * public static final Reducer MAX = new Reducer() { ... } * * @Parallelizable(mutexFree = false, comment="Internal use of synchronization") * public static final Reducer MIN = new Reducer() { ... } * * @Parallelizable * public static final Reducer AND = new Reducer() { ... } * * @Parallelizable * public static final Reducer OR = new Reducer() { ... } * * @Parallelizable(comment="Internal use of AtomicInteger") * public static final Reducer SUM = new Reducer() { ... } * }[/code] * *

Classes with no internal fields or {@code javolution.lang.Immutable * Immutable} are usually parallelizable and mutex-free.

* * @author Jean-Marie Dautelle * @version 6.0, July 21, 2013 * @see Wikipedia: Mutual Exclusion */ @Documented @Inherited @Target({ ElementType.TYPE, ElementType.FIELD, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) public @interface Parallelizable { /** * Indicates if this element can safely be used concurrently * (default {@code true}). */ boolean value() default true; /** * Indicates if this element does not use any form of mutex to * access shared resources (default {@code true}). To avoid * * priority inversion and possibly unbounded response times, * a real-time VM (with priority inheritance) is recommended * when using {@link Realtime real-time} elements which are not mutex-free. */ boolean mutexFree() default true; /** * Provides additional information (default {@code ""}). */ String comment() default ""; }