Interface ContractController<T>

All Known Implementing Classes:
ContractMaintainer

interface ContractController<T>
The ContractController forms the interface to the lease management system. There are two actions permitted for leased resources, these are lease issue and lease renewal. When the lease is first issued it is scheduled for the contract duration. Once issued the lease can be renewed with another duration, which can be less than the previous duration used.
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    cancel(Contract<T> contract)
    This will cancel the lease and release the resource.
    void
    This method is used to cancel all outstanding leases and to close the controller.
    void
    issue(Contract<T> contract)
    This method will establish a contract for the given duration.
    void
    renew(Contract<T> contract)
    This ensures that the contract is renewed for the duration on the contract, which may have changed since it was issued or last renewed.
  • Method Details

    • issue

      void issue(Contract<T> contract) throws LeaseException
      This method will establish a contract for the given duration. If the contract duration expires before it is renewed then a notification is sent, typically to a Cleaner to to signify that the resource should be released. The contract can also be cancelled by providing a zero length duration.
      Parameters:
      contract - a contract representing a leased resource
      Throws:
      Exception - if the lease could not be done
      LeaseException
    • renew

      void renew(Contract<T> contract) throws LeaseException
      This ensures that the contract is renewed for the duration on the contract, which may have changed since it was issued or last renewed. If the duration on the contract has changed this will insure the previous contract duration is revoked and the new duration is used to maintain the leased resource.
      Parameters:
      contract - a contract representing a leased resource
      Throws:
      Exception - if the lease could not be done
      LeaseException
    • cancel

      void cancel(Contract<T> contract) throws LeaseException
      This will cancel the lease and release the resource. This has the same effect as the renew method with a zero length duration. Once this has been called the Cleaner used should be notified immediately. If the lease has already expired this throws an exception.
      Parameters:
      contract - a contract representing a leased resource
      Throws:
      Exception - if the expiry has been passed
      LeaseException
    • close

      void close()
      This method is used to cancel all outstanding leases and to close the controller. Closing the controller ensures that it can no longer be used to issue or renew leases. All resources occupied by the controller are released, including threads, memory, and all leased resources occupied by the instance.