本文整理匯總了Java中org.agrona.concurrent.EpochClock類的典型用法代碼示例。如果您正苦於以下問題:Java EpochClock類的具體用法?Java EpochClock怎麽用?Java EpochClock使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
EpochClock類屬於org.agrona.concurrent包,在下文中一共展示了EpochClock類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: SessionProxy
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
public SessionProxy(
final MutableAsciiBuffer buffer,
final GatewayPublication gatewayPublication,
final SessionIdStrategy sessionIdStrategy,
final SessionCustomisationStrategy customisationStrategy,
final EpochClock clock,
final long connectionId,
final int libraryId)
{
this.gatewayPublication = gatewayPublication;
this.sessionIdStrategy = sessionIdStrategy;
this.customisationStrategy = customisationStrategy;
this.clock = clock;
this.connectionId = connectionId;
this.libraryId = libraryId;
this.buffer = buffer;
lowSequenceNumber = new AsciiFormatter("MsgSeqNum too low, expecting %s but received %s");
timestampEncoder.initialise(clock.time());
}
示例2: PossDupEnabler
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
public PossDupEnabler(
final ExclusiveBufferClaim bufferClaim,
final IntPredicate claimer,
final PreCommit onPreCommit,
final Consumer<String> onIllegalStateFunc,
final ErrorHandler errorHandler,
final EpochClock clock,
final int maxPayloadLength)
{
this.bufferClaim = bufferClaim;
this.claimer = claimer;
this.onPreCommit = onPreCommit;
this.onIllegalStateFunc = onIllegalStateFunc;
this.errorHandler = errorHandler;
this.clock = clock;
this.maxPayloadLength = maxPayloadLength;
}
示例3: HistogramLogAgent
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
@SuppressWarnings("FinalParameters")
public HistogramLogAgent(
final List<Timer> timers,
final String logFile,
final long intervalInMs,
final ErrorHandler errorHandler,
final EpochClock milliClock,
HistogramHandler histogramHandler,
final String agentNamePrefix)
{
this.timers = timers;
this.intervalInMs = intervalInMs;
this.milliClock = milliClock;
this.agentNamePrefix = agentNamePrefix;
if (histogramHandler == null)
{
histogramHandler = new HistogramLogWriter(timers.size(), logFile, errorHandler);
}
this.histogramHandler = histogramHandler;
timers.forEach(timer -> this.histogramHandler.identifyTimer(timer.id(), timer.name()));
histogramHandler.onEndTimerIdentification();
}
示例4: LibraryPoller
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
LibraryPoller(
final LibraryConfiguration configuration,
final LibraryTimers timers,
final FixCounters fixCounters,
final LibraryTransport transport,
final FixLibrary fixLibrary,
final EpochClock clock)
{
this.libraryId = configuration.libraryId();
this.fixCounters = fixCounters;
this.transport = transport;
this.fixLibrary = fixLibrary;
this.sessionTimer = timers.sessionTimer();
this.receiveTimer = timers.receiveTimer();
this.configuration = configuration;
this.sessionIdStrategy = configuration.sessionIdStrategy();
this.sessionExistsHandler = configuration.sessionExistsHandler();
this.sentPositionHandler = configuration.sentPositionHandler();
this.clock = clock;
this.enginesAreClustered = configuration.libraryAeronChannels().size() > 1;
}
示例5: ControlSession
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
ControlSession(
final long controlSessionId,
final long correlationId,
final ControlSessionDemuxer demuxer,
final Publication controlPublication,
final ArchiveConductor conductor,
final EpochClock epochClock,
final ControlResponseProxy controlResponseProxy)
{
this.controlSessionId = controlSessionId;
this.correlationId = correlationId;
this.demuxer = demuxer;
this.controlPublication = controlPublication;
this.conductor = conductor;
this.epochClock = epochClock;
this.controlResponseProxy = controlResponseProxy;
}
示例6: CncFile
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
/**
* Map a pre-existing CnC file if one present and is active.
*
* Total length of CnC file will be mapped until {@link #close()} is called.
*
* @param directory for the CnC file
* @param filename of the CnC file
* @param versionFieldOffset to use for version field access
* @param timestampFieldOffset to use for timestamp field access
* @param timeoutMs for the activity check (in milliseconds) and for how long to wait for file to exist
* @param epochClock to use for time checks
* @param versionCheck to use for existing CnC file and version field
* @param logger to use to signal progress or null
*/
public CncFile(
final File directory,
final String filename,
final int versionFieldOffset,
final int timestampFieldOffset,
final long timeoutMs,
final EpochClock epochClock,
final IntConsumer versionCheck,
final Consumer<String> logger)
{
validateOffsets(versionFieldOffset, timestampFieldOffset);
this.cncDir = directory;
this.cncFile = new File(directory, filename);
this.mappedCncBuffer = mapExistingCncFile(
cncFile, versionFieldOffset, timestampFieldOffset, timeoutMs, epochClock, versionCheck, logger);
this.cncBuffer = new UnsafeBuffer(mappedCncBuffer);
this.versionFieldOffset = versionFieldOffset;
this.timestampFieldOffset = timestampFieldOffset;
}
示例7: CountersManager
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
/**
* Create a new counter buffer manager over two buffers.
*
* @param metaDataBuffer containing the types, keys, and labels for the counters.
* @param valuesBuffer containing the values of the counters themselves.
* @param labelCharset for the label encoding.
* @param epochClock to use for determining time for keep counter from being reused after being freed.
* @param freeToReuseTimeoutMs timeout (in milliseconds) to keep counter from being reused after being freed.
*/
public CountersManager(
final AtomicBuffer metaDataBuffer,
final AtomicBuffer valuesBuffer,
final Charset labelCharset,
final EpochClock epochClock,
final long freeToReuseTimeoutMs)
{
super(metaDataBuffer, valuesBuffer, labelCharset);
valuesBuffer.verifyAlignment();
this.epochClock = epochClock;
this.freeToReuseTimeoutMs = freeToReuseTimeoutMs;
if (metaDataBuffer.capacity() < (valuesBuffer.capacity() * 2))
{
throw new IllegalArgumentException("Meta data buffer not sufficiently large");
}
}
示例8: InitiatorSession
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
public InitiatorSession(
final int heartbeatInterval,
final long connectionId,
final EpochClock clock,
final SessionProxy proxy,
final GatewayPublication publication,
final SessionIdStrategy sessionIdStrategy,
final long sendingTimeWindow,
final AtomicCounter receivedMsgSeqNo,
final AtomicCounter sentMsgSeqNo,
final int libraryId,
final int initialSequenceNumber,
final int sequenceIndex,
final SessionState state,
final boolean resetSeqNum,
final long reasonableTransmissionTimeInMs,
final MutableAsciiBuffer asciiBuffer)
{
super(
heartbeatInterval,
connectionId,
clock,
state,
proxy,
publication,
sessionIdStrategy,
sendingTimeWindow,
receivedMsgSeqNo,
sentMsgSeqNo,
libraryId,
initialSequenceNumber,
sequenceIndex,
reasonableTransmissionTimeInMs,
asciiBuffer);
this.resetSeqNum = resetSeqNum;
}
示例9: AcceptorSession
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
public AcceptorSession(
final int defaultInterval,
final long connectionId,
final EpochClock clock,
final SessionProxy proxy,
final GatewayPublication publication,
final SessionIdStrategy sessionIdStrategy,
final long sendingTimeWindow,
final AtomicCounter receivedMsgSeqNo,
final AtomicCounter sentMsgSeqNo,
final int libraryId,
final int initialSequenceNumber,
final int sequenceIndex,
final SessionState state,
final long reasonableTransmissionTimeInMs,
final MutableAsciiBuffer asciiBuffer)
{
super(
defaultInterval,
connectionId,
clock,
state,
proxy,
publication,
sessionIdStrategy,
sendingTimeWindow,
receivedMsgSeqNo,
sentMsgSeqNo,
libraryId,
initialSequenceNumber,
sequenceIndex,
reasonableTransmissionTimeInMs,
asciiBuffer);
}
示例10: GatewaySessions
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
GatewaySessions(
final EpochClock clock,
final GatewayPublication outboundPublication,
final SessionIdStrategy sessionIdStrategy,
final SessionCustomisationStrategy customisationStrategy,
final FixCounters fixCounters,
final AuthenticationStrategy authenticationStrategy,
final MessageValidationStrategy validationStrategy,
final int sessionBufferSize,
final long sendingTimeWindowInMs,
final long reasonableTransmissionTimeInMs,
final ErrorHandler errorHandler,
final SessionContexts sessionContexts,
final SessionPersistenceStrategy sessionPersistenceStrategy)
{
this.clock = clock;
this.outboundPublication = outboundPublication;
this.sessionIdStrategy = sessionIdStrategy;
this.customisationStrategy = customisationStrategy;
this.fixCounters = fixCounters;
this.authenticationStrategy = authenticationStrategy;
this.validationStrategy = validationStrategy;
this.sessionBufferSize = sessionBufferSize;
this.sendingTimeWindowInMs = sendingTimeWindowInMs;
this.reasonableTransmissionTimeInMs = reasonableTransmissionTimeInMs;
this.errorHandler = errorHandler;
this.sessionContexts = sessionContexts;
this.sessionPersistenceStrategy = sessionPersistenceStrategy;
}
示例11: CatchupReplayer
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
CatchupReplayer(
final ReplayQuery inboundMessages,
final GatewayPublication inboundPublication,
final ErrorHandler errorHandler,
final long correlationId,
final long connectionId,
final int libraryId,
final int lastReceivedSeqNum,
final int currentSequenceIndex,
final int replayFromSequenceNumber,
final int replayFromSequenceIndex,
final GatewaySession session,
final long catchupTimeout,
final EpochClock clock)
{
this.inboundMessages = inboundMessages;
this.inboundPublication = inboundPublication;
this.errorHandler = errorHandler;
this.correlationId = correlationId;
this.connectionId = connectionId;
this.libraryId = libraryId;
this.lastReceivedSeqNum = lastReceivedSeqNum;
this.currentSequenceIndex = currentSequenceIndex;
this.replayFromSequenceNumber = replayFromSequenceNumber;
this.replayFromSequenceIndex = replayFromSequenceIndex;
this.session = session;
this.catchupEndTimeInMs = clock.time() + catchupTimeout;
possDupEnabler = new PossDupEnabler(
bufferClaim,
this::claimBuffer,
this::onPreCommit,
this::onIllegalState,
errorHandler,
clock,
inboundPublication.maxPayloadLength());
}
示例12: Replayer
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
public Replayer(
final ReplayQuery replayQuery,
final ExclusivePublication publication,
final ExclusiveBufferClaim bufferClaim,
final IdleStrategy idleStrategy,
final ErrorHandler errorHandler,
final int maxClaimAttempts,
final ClusterableSubscription subscription,
final String agentNamePrefix,
final EpochClock clock)
{
this.replayQuery = replayQuery;
this.publication = publication;
this.bufferClaim = bufferClaim;
this.idleStrategy = idleStrategy;
this.errorHandler = errorHandler;
this.maxClaimAttempts = maxClaimAttempts;
this.subscription = subscription;
this.agentNamePrefix = agentNamePrefix;
possDupEnabler = new PossDupEnabler(
bufferClaim,
this::claimBuffer,
this::onPreCommit,
this::onIllegalState,
this::onException,
clock,
publication.maxPayloadLength());
}
示例13: Catalog
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
Catalog(
final File archiveDir,
final FileChannel archiveDirChannel,
final int fileSyncLevel,
final EpochClock epochClock)
{
this(archiveDir, archiveDirChannel, fileSyncLevel, epochClock, true);
}
示例14: ConcurrentCountersManager
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
public ConcurrentCountersManager(
final AtomicBuffer metaDataBuffer,
final AtomicBuffer valuesBuffer,
final Charset labelCharset,
final EpochClock epochClock,
final long freeToReuseTimeoutMs)
{
super(metaDataBuffer, valuesBuffer, labelCharset, epochClock, freeToReuseTimeoutMs);
}
示例15: DistinctErrorLog
import org.agrona.concurrent.EpochClock; //導入依賴的package包/類
/**
* Create a new error log that will be written to a provided {@link AtomicBuffer}.
*
* @param buffer into which the observation records are recorded.
* @param clock to be used for time stamping records.
*/
public DistinctErrorLog(final AtomicBuffer buffer, final EpochClock clock)
{
buffer.verifyAlignment();
this.clock = clock;
this.buffer = buffer;
}