Class DefaultJournalService
-
- All Implemented Interfaces:
-
pro.fessional.wings.faceless.service.journal.JournalService
public class DefaultJournalService implements JournalService
- Since:
2019-09-11
trydofor
-
-
Field Summary
Fields Modifier and Type Field Description public final static StringSEQ_JOURNAL
-
Constructor Summary
Constructors Constructor Description DefaultJournalService(LightIdService lightIdService, BlockIdProvider blockIdProvider, CommitJournalModify journalModify)
-
Method Summary
Modifier and Type Method Description JournalService.Journalcreate(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> Rsubmit(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. longelapse(AtomicLong dummyId, @NotNull() JournalService.Journal journal)For internal debugging purposes, using the default connection without an explicit transaction, can ignore error. longelapse(@NotNull() JournalService.Journal journal)set and return elapse mills of the journal, can ignore error. JournalService.Journalcreate(long parentId, @NotNull() String eventName, @Nullable() String loginInfo, @Nullable() String targetKey, @Nullable() String otherInfo)create new Journal without the context. <R> Rsubmit(@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. voidsetPropagation(Propagation propagation)voidsetDummyLightId(AtomicLong dummyLightId)create journal by dummyLightId getAndIncrement voidsetAliveSecond(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
-
-
Constructor Detail
-
DefaultJournalService
DefaultJournalService(LightIdService lightIdService, BlockIdProvider blockIdProvider, CommitJournalModify journalModify)
-
-
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 nameloginInfo- login info ,eg.targetKey- key/id of targetotherInfo- 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 nameloginInfo- login info ,eg.targetKey- key/id of targetotherInfo- other info of operationcommitSet- operations- Returns:
the result
-
setPropagation
void setPropagation(Propagation propagation)
-
setDummyLightId
void setDummyLightId(AtomicLong dummyLightId)
create journal by dummyLightId getAndIncrement
-
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
-
-
-
-