com.thinkaurelius.titan.diskstorage.locking

## Class AbstractLocker.Builder<S,B extends AbstractLocker.Builder<S,B>>

- java.lang.Object
- - com.thinkaurelius.titan.diskstorage.locking.AbstractLocker.Builder<S,B>

- Type Parameters:
    `S` - The concrete type of `LockStatus`
    `B` - The concrete type of the subclass extending this builder
  Direct Known Subclasses:
    ConsistentKeyLocker.Builder
  Enclosing class:
    AbstractLocker<S extends LockStatus>

      public abstract static class AbstractLocker.Builder<S,B extends AbstractLocker.Builder<S,B>>
      extends Object

  Abstract builder for this Locker implementation. See `ConsistentKeyLocker` for an example of how to subclass this abstract builder into a concrete builder.

  If you're wondering why the bounds for the type parameter `B` looks so hideous, see:

  Using the builder pattern with subclasses by Eamonn McManus

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected LocalLockMediator<StoreTransaction>` | `llm`
    `protected Duration` | `lockExpire`
    `protected LockerState<S>` | `lockState`
    `protected org.slf4j.Logger` | `log`
    `protected StaticBuffer` | `rid`
    `protected ConsistentKeyLockerSerializer` | `serializer`
    `protected TimestampProvider` | `times`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractLocker.Builder()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract LocalLockMediator<StoreTransaction>` | `getDefaultMediator()` Get the default `LocalLockMediator` for Locker being built.
    `B` | `internalState(LockerState<S> state)` This method is only intended for testing.
    `B` | `lockExpire(Duration d)`
    `B` | `logger(org.slf4j.Logger log)`
    `B` | `mediator(LocalLockMediator<StoreTransaction> mediator)`
    `B` | `mediatorName(String name)` Retrieve the mediator associated with `name` via `LocalLockMediators#get(String)`.
    `protected void` | `preBuild()` Inspect and modify this builder's state after the client has called `build()`, but before a return object has been instantiated.
    `B` | `rid(StaticBuffer rid)`
    `protected abstract B` | `self()` Concrete subclasses should just "`return this;`".
    `B` | `serializer(ConsistentKeyLockerSerializer serializer)`
    `B` | `times(TimestampProvider times)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### rid

          protected StaticBuffer rid

    - #### times

          protected TimestampProvider times

    - #### serializer

          protected ConsistentKeyLockerSerializer serializer

    - #### llm

          protected LocalLockMediator<StoreTransaction> llm

    - #### lockState

          protected LockerState<S> lockState

    - #### lockExpire

          protected Duration lockExpire

    - #### log

          protected org.slf4j.Logger log

  - ### Constructor Detail

    - #### AbstractLocker.Builder

          public AbstractLocker.Builder()

  - ### Method Detail

    - #### self

          protected abstract B self()

      Concrete subclasses should just "`return this;`".
      Returns:
        concrete subclass instance

    - #### rid

          public B rid(StaticBuffer rid)

    - #### times

          public B times(TimestampProvider times)

    - #### serializer

          public B serializer(ConsistentKeyLockerSerializer serializer)

    - #### mediator

          public B mediator(LocalLockMediator<StoreTransaction> mediator)

    - #### mediatorName

          public B mediatorName(String name)

      Retrieve the mediator associated with `name` via `LocalLockMediators#get(String)`.
      Parameters:
        `name` - the mediator name
      Returns:
        this builder

    - #### logger

          public B logger(org.slf4j.Logger log)

    - #### lockExpire

          public B lockExpire(Duration d)

    - #### internalState

          public B internalState(LockerState<S> state)

      This method is only intended for testing. Calling this in production could cause lock failures.
      Parameters:
        `state` - the initial lock state for this instance
      Returns:
        this builder

    - #### preBuild

          protected void preBuild()

      Inspect and modify this builder's state after the client has called `build()`, but before a return object has been instantiated. This is useful for catching illegal values or translating placeholder configuration values into the objects they represent. This is intended to be called from subclasses' build() methods.

    - #### getDefaultMediator

          protected abstract LocalLockMediator<StoreTransaction> getDefaultMediator()

      Get the default `LocalLockMediator` for Locker being built. This is called when the client doesn't specify a locker.
      Returns:
        a lock mediator

Copyright © 2012–2014. All rights reserved.