/** * <p>The default constructor requires values for all final member variables * of this. It expects all arguments but the {@link SourceSessionParams} to * be proper, so no checks are performed. The constructor is declared * package private since only {@link MessageBus} is supposed to instantiate * it.</p> * * @param mbus The message bus that created this instance. * @param params A parameter object that holds configuration parameters. */ SourceSession(MessageBus mbus, SourceSessionParams params) { this.mbus = mbus; sequencer = new Sequencer(mbus); if (!params.hasReplyHandler()) { throw new NullPointerException("Reply handler is null."); } replyHandler = params.getReplyHandler(); throttlePolicy = params.getThrottlePolicy(); timeout = params.getTimeout(); mbus.register(this); }
/** * Creates a new async session running on message bus logic with a specified reply handler. * * @param asyncParams Common asyncsession parameters, not used. * @param bus The message bus on which to run. * @param mbusParams Parameters concerning message bus configuration. * @param handler The external reply handler. */ MessageBusAsyncSession(AsyncParameters asyncParams, MessageBus bus, MessageBusParams mbusParams, ReplyHandler handler) { route = mbusParams.getRoute(); routeForGet = mbusParams.getRouteForGet(); traceLevel = mbusParams.getTraceLevel(); throttlePolicy = mbusParams.getSourceSessionParams().getThrottlePolicy(); if (handler == null) { handler = new MyReplyHandler(asyncParams.getResponseHandler(), responses); } session = bus.createSourceSession(handler, mbusParams.getSourceSessionParams()); }