Class LeaseInitializer.UIDLease

java.lang.Object
com.j_spaces.core.LeaseInitializer.UIDLease
All Implemented Interfaces:
SmartExternalizable, LeaseContext<Object>, Externalizable, Serializable, Lease
Direct Known Subclasses:
LeaseInitializer.UpdateContextLease
Enclosing class:
LeaseInitializer

public static class LeaseInitializer.UIDLease extends Object implements LeaseContext<Object>, SmartExternalizable
See Also:
  • Constructor Details

    • UIDLease

      public UIDLease()
      default no-args public constructor for Externalizable impl
  • Method Details

    • getUID

      public String getUID()
      Description copied from interface: LeaseContext
      Returns UID of written Entry.
      Specified by:
      getUID in interface LeaseContext<Object>
      Returns:
      UID of written Entry.
    • getVersion

      public int getVersion()
      Description copied from interface: LeaseContext
      Returns the version of written \ updated entry.
      Specified by:
      getVersion in interface LeaseContext<Object>
      Returns:
      version of written \ updated entry.
    • getObject

      public Object getObject()
      Description copied from interface: LeaseContext
      returns the previous value associated with this update-or-write operation.
      • null, on a successful write
    • previous value, on successful update (Only if WriteModifiers.RETURN_PREV_ON_UPDATE is used, otherwise null)
    • Specified by:
      getObject in interface LeaseContext<Object>
      Returns:
      the associated object.
    • getExpiration

      public long getExpiration()
      Description copied from interface: Lease
      Returns a long that indicates the time that the lease will expire. This time is represented as milliseconds from the beginning of the epoch, relative to the local clock.
      Specified by:
      getExpiration in interface Lease
      Returns:
      a long that indicates the time that the lease will expire
    • writeExternal

      public void writeExternal(ObjectOutput out) throws IOException
      Specified by:
      writeExternal in interface Externalizable
      Throws:
      IOException
    • readExternal

      public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
      Specified by:
      readExternal in interface Externalizable
      Throws:
      IOException
      ClassNotFoundException
    • cancel

      public void cancel() throws UnknownLeaseException, RemoteException
      Description copied from interface: Lease
      Used by the lease holder to indicate that it is no longer interested in the resource or information held by the lease. If the leased information or resource could cause a callback to the lease holder (or some other object on behalf of the lease holder), the lease grantor should not issue such a callback after the lease has been cancelled. The overall effect of a cancel call is the same as lease expiration, but instead of happening at the end of a pre-agreed duration it happens immediately.
      Specified by:
      cancel in interface Lease
      Throws:
      UnknownLeaseException - the lease being cancelled is unknown to the lease grantor
      RemoteException
    • renew

      public void renew(long l)
      Description copied from interface: Lease
      Used to renew a lease for an additional period of time, specified in milliseconds. This duration is not added to the original lease, but is used to determine a new expiration time for the existing lease. If the renewal is granted this is reflected in value returned by getExpiration. If the renewal fails, the lease is left intact for the same duration that was in force prior to the call to renew.
      Specified by:
      renew in interface Lease
      Parameters:
      l - the requested duration in milliseconds
    • setSerialFormat

      public void setSerialFormat(int i)
      Description copied from interface: Lease
      Sets the format to use when serializing the lease.
      Specified by:
      setSerialFormat in interface Lease
      Parameters:
      i - DURATION or ABSOLUTE
      See Also:
    • getSerialFormat

      public int getSerialFormat()
      Description copied from interface: Lease
      Returns the format that will be used to serialize the lease.
      Specified by:
      getSerialFormat in interface Lease
      Returns:
      an int representing the serial format value
      See Also:
    • createLeaseMap

      public LeaseMap createLeaseMap(long l)
      Description copied from interface: Lease
      Creates a Map object that can contain leases whose renewal or cancellation can be batched, and adds the current lease to that map. The current lease is put in the map with the duration value given by the parameter.
      Specified by:
      createLeaseMap in interface Lease
      Parameters:
      l - the duration to put into a Long and use as the value for the current lease in the created LeaseMap
      Returns:
      the created LeaseMap object
    • canBatch

      public boolean canBatch(Lease lease)
      Description copied from interface: Lease
      Returns a boolean indicating whether or not the lease given as a parameter can be batched (placed in the same LeaseMap) with the current lease. Whether or not two Lease objects can be batched is an implementation detail determined by the objects.
      Specified by:
      canBatch in interface Lease
      Parameters:
      lease - the Lease to be evaluated
      Returns:
      a boolean indicating whether or not the lease given as a parameter can be batched (placed in the same LeaseMap) with the current lease