Reply<Session> initiate(final SessionConfiguration configuration) { requireNonNull(configuration, "configuration"); return new InitiateSessionReply(this, timeInMs() + configuration.timeoutInMs(), configuration); }
void onError(final GatewayError errorType, final String errorMessage) { if (errorType == UNABLE_TO_CONNECT) { addressIndex++; register(); sendMessage(); } else { onError(new FixGatewayException(String.format("%s: %s", errorType, errorMessage))); } }
boolean poll(final long timeInMs) { if (requiresResend) { sendMessage(); } return super.poll(timeInMs); }
Action onDisconnect(final int libraryId, final DisconnectReason reason) { final Action action = handler.onDisconnect(libraryId, session, reason); if (action != ABORT) { session.onDisconnect(); // We've been disconnected before an initiator session has finished logging on, eg: wrong msgSeqNum in logon if (initiateSessionReply != null) { initiateSessionReply.onError(UNABLE_TO_LOGON, "Disconnected before session active"); initiateSessionReply = null; } } return action; }
private void onSessionLogon(final Session session) { // Should only be fired if we already own the session and the client sends another logon to run and end of day. if (session.logonTime() != Session.NO_LOGON_TIME) { handler.onSessionStart(session); } if (initiateSessionReply != null) { initiateSessionReply.onComplete(session); // Don't want to hold a reference to the reply object for the // lifetime of the Session initiateSessionReply = null; } }
lastRecvSeqNum, sessionState, isReply ? reply.configuration() : null, sequenceIndex, enableLastMsgSeqNumProcessed);
InitiateSessionReply( final LibraryPoller libraryPoller, final long latestReplyArrivalTime, final SessionConfiguration configuration) { super(libraryPoller, latestReplyArrivalTime); this.configuration = configuration; if (libraryPoller.isConnected()) { sendMessage(); } }
private void sendMessage() { final List<String> hosts = configuration.hosts(); final IntArrayList ports = configuration.ports(); final int size = hosts.size(); if (addressIndex >= size) { onError(new FixGatewayException("Unable to connect to any of the addresses specified")); return; } final String host = hosts.get(addressIndex); final int port = ports.getInt(addressIndex); final long position = libraryPoller.saveInitiateConnection(host, port, correlationId, configuration); requiresResend = position < 0; }