Interface Synchronizable

  • @Deprecated(since="2021-05-27")
    public interface Synchronizable
    The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.

    Implementations of this interface expose a lock object via getLock() so that callers can synchronize externally on that lock:

      if (iterator instanceof Synchronizable)
          Object element = null;
          synchronized (((Synchronizable)iterator).getLock())
              if (iterator.hasNext())
                  element =;

    In the example above, the calls to hasNext() and next() are performed "atomically".

    • Method Detail

      • getLock

        Object getLock()
        the lock object to synchronize on