@Override public int doWork() { return library.poll(FRAGMENT_LIMIT); }
public int doWork() throws Exception { return fixLibrary.poll(1); }
@Override public int doWork() { final int actions = library.poll(10); return actions + buyer.poll(); }
public static FixLibrary blockingConnect(final LibraryConfiguration configuration) { final FixLibrary library = FixLibrary.connect(configuration); while (!library.isConnected()) { library.poll(1); Thread.yield(); } return library; }
public static void main(final String[] args) { final LibraryConfiguration libraryConfiguration = new LibraryConfiguration() .libraryAeronChannels(singletonList(SoleEngine.AERON_CHANNEL)) .libraryIdleStrategy(new YieldingIdleStrategy()); libraryConfiguration.replyTimeoutInMs(1000); try (FixLibrary library = SampleUtil.blockingConnect(libraryConfiguration)) { System.out.println("Connected"); while (library.isConnected()) { library.poll(1); Thread.yield(); } } } }
void assertOriginalLibraryDoesNotReceiveMessages(final int initiatorMessageCount) { initiatingLibrary.poll(LIBRARY_LIMIT); assertThat("Messages received by wrong initiator", initiatingOtfAcceptor.messages(), hasSize(initiatorMessageCount)); }
public void poll() { if (scheduler != null) { scheduler.invokeFramer(); scheduler.invokeFramer(); } libraries.forEach((library) -> library.poll(LIBRARY_LIMIT)); }
private void sendLogonToAcceptor(final FixConnection connection) { assertEventuallyTrue( "Never sent logon", () -> { polled += library.poll(LIBRARY_LIMIT); return polled > 2; }); connection.readLogonReply(); }
static void awaitLibraryConnect(final FixLibrary library) { assertEventuallyTrue( () -> "Library hasn't seen Engine", () -> { library.poll(5); return library.isConnected(); }, AWAIT_TIMEOUT, () -> {} ); }
public static FixLibrary connect(final LibraryConfiguration configuration) { final FixLibrary library = FixLibrary.connect(configuration); assertEventuallyTrue( () -> "Unable to connect to engine", () -> { library.poll(LIBRARY_LIMIT); return library.isConnected(); }, DEFAULT_TIMEOUT_IN_MS, library::close); return library; }
while (reply.isExecuting()) idleStrategy.idle(library.poll(fragmentLimit));
library.poll(1);
@Test public void shouldNotNotifyLibraryOfSessionUntilLoggedOn() throws IOException { setup(true); final FakeOtfAcceptor fakeOtfAcceptor = new FakeOtfAcceptor(); final FakeHandler fakeHandler = new FakeHandler(fakeOtfAcceptor); try (FixLibrary library = newAcceptingLibrary(fakeHandler)) { try (FixConnection connection = FixConnection.initiate(port)) { library.poll(10); assertFalse(fakeHandler.hasSeenSession()); logon(connection); fakeHandler.awaitSessionIdFor(INITIATOR_ID, ACCEPTOR_ID, () -> library.poll(2), 1000); } } }
@Test public void libraryDetectsEngineDisconnect() { library = connectLibrary(); awaitLibraryConnect(library); CloseHelper.close(engine); assertEventuallyTrue( () -> "Engine still hasn't disconnected", () -> { library.poll(5); return !library.isConnected(); }, AWAIT_TIMEOUT, () -> { } ); }
library.poll(1);