Annotation Type Synchronized


  • @Documented
    @Target({METHOD,TYPE})
    @Retention(RUNTIME)
    public @interface Synchronized
    Instead of synchronized methods you can mark these methods as "@Synchronized". The SynchronizedAspect in patterntesting.concurrent will use ReentrantLock to realize it and to avoid deadlocks. If you set the log level to TRACE you can get additional information about the locks and waiting threads.

    The default value for the timeout is 1800 seconds (30 minutes). If you want a shorter value you can use the timeout and unit attributes. Example: @Synchronized(timeout=10, unit=TimeUnit.SECONDS) will set the timeout to 10 seconds.

    Since:
    13.11.2008
    Author:
    oliver
    See Also:
    TimeUnit
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      long timeout
      The default timeout is 30 minutes (1800 seconds).
      java.util.concurrent.TimeUnit unit
      The unit of time (with TimeUnit.SECONDS as default).
    • Element Detail

      • timeout

        long timeout
        The default timeout is 30 minutes (1800 seconds).
        Returns:
        the long
        Default:
        1800L
      • unit

        java.util.concurrent.TimeUnit unit
        The unit of time (with TimeUnit.SECONDS as default).
        Returns:
        the time unit
        Default:
        java.util.concurrent.TimeUnit.SECONDS