Class DefaultJournalService

  • All Implemented Interfaces:
    pro.fessional.wings.faceless.service.journal.JournalService

    
    public class DefaultJournalService
     implements JournalService
                        
    Since:

    2019-09-11

    Author:

    trydofor

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
      public final static String SEQ_JOURNAL
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      JournalService.Journal create(long parentId, AtomicLong dummyId, long nowUtc, @NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo) For internal debugging purposes, insert records with a new transaction (REQUIRES_NEW) if not using a dummy connection.
      <R> R submit(int aliveSd, AtomicLong dummyId, @NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo, @NotNull() Function<JournalService.Journal, R> commitSet) For internal debugging purposes, insert records with a new transaction (REQUIRES_NEW) if not using a dummy connection.
      long elapse(AtomicLong dummyId, @NotNull() JournalService.Journal journal) For internal debugging purposes, using the default connection without an explicit transaction, can ignore error.
      long elapse(@NotNull() JournalService.Journal journal) set and return elapse mills of the journal, can ignore error.
      JournalService.Journal create(long parentId, @NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo) create new Journal without the context.
      <R> R submit(@NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo, @NotNull() Function<JournalService.Journal, R> commitSet) Submit the operation (event) with journal and return some result.
      void setPropagation(Propagation propagation)
      void setDummyLightId(AtomicLong dummyLightId) create journal by dummyLightId getAndIncrement
      void setAliveSecond(int aliveSecond)
      create new journal if the existing to alive,
      * negative - use the old
      * zero - new one every time
      * positive - new one if older
      
      • Methods inherited from class pro.fessional.wings.faceless.service.journal.JournalService

        commit, commit, commit, commit, commit, commit, commit, commit, commit, create, create, create, create, create, create, create, create, submit, submit, submit, submit, submit, submit, submit, submit
      • Methods inherited from class java.lang.Object

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

      • create

        @NotNull()@ApiStatus.Internal() JournalService.Journal create(long parentId, AtomicLong dummyId, long nowUtc, @NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo)

        For internal debugging purposes, insert records with a new transaction (REQUIRES_NEW) if not using a dummy connection.

      • submit

        @NotNull()@ApiStatus.Internal() <R> R submit(int aliveSd, AtomicLong dummyId, @NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo, @NotNull() Function<JournalService.Journal, R> commitSet)

        For internal debugging purposes, insert records with a new transaction (REQUIRES_NEW) if not using a dummy connection. However, update the elapsed time using the default connection without an explicit transaction.

      • elapse

        @ApiStatus.Internal() long elapse(AtomicLong dummyId, @NotNull() JournalService.Journal journal)

        For internal debugging purposes, using the default connection without an explicit transaction, can ignore error.

      • elapse

         long elapse(@NotNull() JournalService.Journal journal)

        set and return elapse mills of the journal, can ignore error. SHOULD use the default connection without an explicit transaction. NOTE: submit/commit auto elapse, but create not.

      • create

        @NotNull() JournalService.Journal create(long parentId, @NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo)

        create new Journal without the context. SHOULD create journal in REQUIRES_NEW.

        Parameters:
        parentId - parent id, default 0;
        eventName - event name
        loginInfo - login info ,eg.
        targetKey - key/id of target
        otherInfo - other info of operation
        Returns:

        Journal without the context

      • submit

        @NotNull() <R> R submit(@NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo, @NotNull() Function<JournalService.Journal, R> commitSet)

        Submit the operation (event) with journal and return some result. SHOULD create journal in REQUIRES_NEW, but not affect commitSet

        Parameters:
        eventName - event name
        loginInfo - login info ,eg.
        targetKey - key/id of target
        otherInfo - other info of operation
        commitSet - operations
        Returns:

        the result

      • setAliveSecond

         void setAliveSecond(int aliveSecond)
        create new journal if the existing to alive,
        * negative - use the old
        * zero - new one every time
        * positive - new one if older