Class FeatureLock


  • public class FeatureLock
    extends Object
    Used in conjuction with FeatureLocking to lock features during a transaction. This class is responsible for supplying a unique Authorization ID and expiry period.

    A FeatureLock representing the current transaction has been provided as a static constant: TRANSACTION.

    Lock duration is measured in milliseconds, although you shoudl take into account the abilities of different databases and servers. WFS 1.1 measures lock expiry time in minuets, WFS 2.0 measures lick expiry time in seconds..

    Author:
    Jody Garnett, Refractions Research, Inc.
    See Also:
    Database Reseach, Transactional WFS Design, Design Implications
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected String authorization  
      protected long duration  
      static FeatureLock TRANSACTION
      Lock requested for the duration of the Transaction (until next commit or revert).
    • Constructor Summary

      Constructors 
      Constructor Description
      FeatureLock​(String authorization, long duration)
      Creates a new lock.
      FeatureLock​(String authorization, long duration, TimeUnit unit)
      Creates a new lock.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      String getAuthorization()
      Gets the ID used for transaction authorization.
      long getDuration()
      The expiry time for this lock (in milliseconds).
      • Methods inherited from class Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • TRANSACTION

        public static final FeatureLock TRANSACTION
        Lock requested for the duration of the Transaction (until next commit or revert).
      • authorization

        protected String authorization
      • duration

        protected long duration
    • Constructor Detail

      • FeatureLock

        public FeatureLock​(String authorization,
                           long duration)
        Creates a new lock.
        Parameters:
        authorization - LockId used to authorize the transaction
        duration - expiry period of this lock (in milliseconds)
      • FeatureLock

        public FeatureLock​(String authorization,
                           long duration,
                           TimeUnit unit)
        Creates a new lock.
        Parameters:
        authorization - LockId used to authorize the transaction
        duration - Expiry period
        unit - Time unit for expiry period
    • Method Detail

      • getAuthorization

        public String getAuthorization()
        Gets the ID used for transaction authorization.
        Returns:
        the authorization ID
      • getDuration

        public long getDuration()
        The expiry time for this lock (in milliseconds).
        Returns:
        expiry period in milliseconds