src/main/java/com/github/mongobee/Mongobee.java
private void initDependencies() {
    this.timeUtils = new TimeUtils();
    this.dao = new ChangeEntryDao(DEFAULT_CHANGELOG_COLLECTION_NAME, DEFAULT_LOCK_COLLECTION_NAME);
    this.lockRepository = new LockRepository(DEFAULT_LOCK_COLLECTION_NAME);
    this.lockChecker = new LockChecker(lockRepository, timeUtils)
        .setLockAcquiredForMillis(DEFAULT_LOCK_ACTIVE_MILLIS)
        .setLockMaxTries(DEFAULT_LOCK_MAX_TRIES)
        .setLockMaxWaitMillis(DEFAULT_LOCK_MAX_WAIT_MILLIS);
    PreInterceptor preInterceptor = new PreInterceptor() {
      @Override
      public void before() {
        try {
          lockChecker.ensureLockDefault();
        } catch (MongobeeLockException e) {
          throw new RuntimeException(e);
        }
      }
    };

    proxyFactory = new ProxyFactory(
        preInterceptor,
        PROXY_CREATOR_METHODS,
        UNCHECKED_PROXY_METHODS);

    service = new ChangeService();
  }
//Ideally this beans are injected from outside
Ideally this beans are injected from outside
Ideally this beans are injected from outside
private void initDependencies() {
    this.timeUtils = new TimeUtils();
    this.dao = new ChangeEntryDao(DEFAULT_CHANGELOG_COLLECTION_NAME, DEFAULT_LOCK_COLLECTION_NAME);
    this.lockRepository = new LockRepository(DEFAULT_LOCK_COLLECTION_NAME);
    this.lockChecker = new LockChecker(lockRepository, timeUtils)
        .setLockAcquiredForMillis(DEFAULT_LOCK_ACTIVE_MILLIS)
        .setLockMaxTries(DEFAULT_LOCK_MAX_TRIES)
        .setLockMaxWaitMillis(DEFAULT_LOCK_MAX_WAIT_MILLIS);
    PreInterceptor preInterceptor = new PreInterceptor() {
      @Override
      public void before() {
        try {
          lockChecker.ensureLockDefault();
        } catch (MongobeeLockException e) {
          throw new RuntimeException(e);
        }
      }
    };
    proxyFactory = new ProxyFactory(
        preInterceptor,
        PROXY_CREATOR_METHODS,
        UNCHECKED_PROXY_METHODS);
    service = new ChangeService();
  }
private void initDependencies ( ) { this . timeUtils = new TimeUtils ( ) ; this . dao = new ChangeEntryDao ( DEFAULT_CHANGELOG_COLLECTION_NAME , DEFAULT_LOCK_COLLECTION_NAME ) ; this . lockRepository = new LockRepository ( DEFAULT_LOCK_COLLECTION_NAME ) ; this . lockChecker = new LockChecker ( lockRepository , timeUtils ) . setLockAcquiredForMillis ( DEFAULT_LOCK_ACTIVE_MILLIS ) . setLockMaxTries ( DEFAULT_LOCK_MAX_TRIES ) . setLockMaxWaitMillis ( DEFAULT_LOCK_MAX_WAIT_MILLIS ) ; PreInterceptor preInterceptor = new PreInterceptor ( ) { @ Override public void before ( ) { try { lockChecker . ensureLockDefault ( ) ; } catch ( MongobeeLockException e ) { throw new RuntimeException ( e ) ; } } } ; proxyFactory = new ProxyFactory ( preInterceptor , PROXY_CREATOR_METHODS , UNCHECKED_PROXY_METHODS ) ; service = new ChangeService ( ) ; }
Ideally this beans are injected from outside
Ideally this beans are injected from outside