void addSession( final long clusterSessionId, final int responseStreamId, final String responseChannel, final byte[] encodedPrincipal) { sessionByIdMap.put(clusterSessionId, new ClientSession( clusterSessionId, responseStreamId, responseChannel, encodedPrincipal, this)); }
void onLoadSession( final long clusterSessionId, final long correlationId, final long openedPosition, final long timeOfLastActivity, final CloseReason closeReason, final int responseStreamId, final String responseChannel) { sessionByIdMap.put(clusterSessionId, new ClusterSession( clusterSessionId, correlationId, openedPosition, timeOfLastActivity, responseStreamId, responseChannel, closeReason)); if (clusterSessionId >= nextSessionId) { nextSessionId = clusterSessionId + 1; } }
public void onConnect(final long correlationId, final int streamId, final String channel) { final ControlSession session = conductor.newControlSession(correlationId, streamId, channel, this); controlSessionByIdMap.put(session.sessionId(), session); }
public void onNewCounter(final long correlationId, final int counterId) { resourceByRegIdMap.put(correlationId, new Counter(correlationId, this, counterValuesBuffer, counterId)); onAvailableCounter(correlationId, counterId); }
private void createFile(final long correlationId, final long length, final String filename) { if (fileSessionByIdMap.containsKey(correlationId)) { throw new IllegalStateException("correlationId is in use: " + correlationId); } final File file = new File(storageDir, filename); if (file.exists() && !file.delete()) { throw new IllegalStateException("failed to delete existing file: " + file); } if (length == 0) { try { if (!file.createNewFile()) { throw new IllegalStateException("failed to create " + filename); } } catch (final IOException ex) { LangUtil.rethrowUnchecked(ex); } } else { fileSessionByIdMap.put(correlationId, new UnsafeBuffer(IoUtil.mapNewFile(file, length, false))); } }
private LogBuffers logBuffers(final long registrationId, final String logFileName) { LogBuffers logBuffers = logBuffersByIdMap.get(registrationId); if (null == logBuffers) { logBuffers = logBuffersFactory.map(logFileName); logBuffersByIdMap.put(registrationId, logBuffers); } logBuffers.incRef(); return logBuffers; }
public Map<Long, Long> create(final Object... entries) { final Long2ObjectHashMap<Long> map = new Long2ObjectHashMap<>( entries.length * 2, Hashing.DEFAULT_LOAD_FACTOR, false); for (final Object o : entries) { @SuppressWarnings("unchecked") final Map.Entry<Long, Long> e = (Map.Entry<Long, Long>)o; map.put(e.getKey(), e.getValue()); } return map; }
void onSessionOpen( final long clusterSessionId, final long timestampMs, final int responseStreamId, final String responseChannel, final byte[] encodedPrincipal) { clusterTimeMs = timestampMs; final ClientSession session = new ClientSession( clusterSessionId, responseStreamId, responseChannel, encodedPrincipal, this); if (Role.LEADER == role && ctx.isRespondingService()) { session.connect(aeron); } sessionByIdMap.put(clusterSessionId, session); service.onSessionOpen(session, timestampMs); }
void onReplaySessionOpen( final long logPosition, final long correlationId, final long clusterSessionId, final long timestamp, final int responseStreamId, final String responseChannel) { clusterTimeMs(timestamp); final ClusterSession session = new ClusterSession(clusterSessionId, responseStreamId, responseChannel); session.open(logPosition); session.lastActivity(timestamp, correlationId); sessionByIdMap.put(clusterSessionId, session); if (clusterSessionId >= nextSessionId) { nextSessionId = clusterSessionId + 1; } }
Subscription addSubscription( final String channel, final int streamId, final AvailableImageHandler availableImageHandler, final UnavailableImageHandler unavailableImageHandler) { clientLock.lock(); try { ensureActive(); ensureNotReentrant(); final long correlationId = driverProxy.addSubscription(channel, streamId); final Subscription subscription = new Subscription( this, channel, streamId, correlationId, availableImageHandler, unavailableImageHandler); resourceByRegIdMap.put(correlationId, subscription); awaitResponse(correlationId); return subscription; } finally { clientLock.unlock(); } }
public void onNewPublication( final long correlationId, final long registrationId, final int streamId, final int sessionId, final int publicationLimitId, final int statusIndicatorId, final String logFileName) { final ConcurrentPublication publication = new ConcurrentPublication( this, stashedChannel, streamId, sessionId, new UnsafeBufferPosition(counterValuesBuffer, publicationLimitId), statusIndicatorId, logBuffers(registrationId, logFileName), registrationId, correlationId); resourceByRegIdMap.put(correlationId, publication); }
public void onNewExclusivePublication( final long correlationId, final long registrationId, final int streamId, final int sessionId, final int publicationLimitId, final int statusIndicatorId, final String logFileName) { final ExclusivePublication publication = new ExclusivePublication( this, stashedChannel, streamId, sessionId, new UnsafeBufferPosition(counterValuesBuffer, publicationLimitId), statusIndicatorId, logBuffers(registrationId, logFileName), registrationId, correlationId); resourceByRegIdMap.put(correlationId, publication); }
sessionByIdMap.put(session.id(), session); appendSessionOpen(session, nowMs);
ctx); recordingSessionByIdMap.put(recordingId, session); recorder.addSession(session);
ctx); recordingSessionByIdMap.put(recordingId, session); catalog.extendRecording(recordingId, controlSession.sessionId(), correlationId); recorder.addSession(session);
private void addWorkflowToInMemoryState(final DeployedWorkflow deployedWorkflow) { final DirectBuffer bpmnProcessId = deployedWorkflow.getBpmnProcessId(); workflowsByKey.put(deployedWorkflow.getKey(), deployedWorkflow); Long2ObjectHashMap<DeployedWorkflow> versionMap = workflowsByProcessIdAndVersion.get(bpmnProcessId); if (versionMap == null) { versionMap = new Long2ObjectHashMap<>(); workflowsByProcessIdAndVersion.put(bpmnProcessId, versionMap); } final int version = deployedWorkflow.getVersion(); versionMap.put(version, deployedWorkflow); }
private LogBuffers logBuffers(final long registrationId, final String logFileName) { LogBuffers logBuffers = logBuffersByIdMap.get(registrationId); if (null == logBuffers) { logBuffers = logBuffersFactory.map(logFileName); logBuffersByIdMap.put(registrationId, logBuffers); } logBuffers.incRef(); return logBuffers; }
public ActorFuture<Void> pushDeployment( final long key, final long position, final DirectBuffer buffer) { final ActorFuture<Void> pushedFuture = new CompletableActorFuture<>(); final PendingDeploymentDistribution pendingDeploymentDistribution = new PendingDeploymentDistribution(buffer, position); deploymentsState.putPendingDeployment(key, pendingDeploymentDistribution); pendingDeploymentFutures.put(key, pushedFuture); pushDeploymentToPartitions(key); return pushedFuture; }
public void schedule(TimerSubscription timer, ActorClock now) { final long deadline = now.getTimeMillis() + timeUnit().convert(timer.getDeadline(), timer.getTimeUnit()); final long timerId = scheduleTimer(deadline); timer.setTimerId(timerId); timerJobMap.put(timerId, timer); }
public void schedule(TimerSubscription timer, ActorClock now) { final long deadline = now.getTimeMillis() + timeUnit().convert(timer.getDeadline(), timer.getTimeUnit()); final long timerId = scheduleTimer(deadline); timer.setTimerId(timerId); timerJobMap.put(timerId, timer); }