@Override public void afterReceive(boolean messageReceived, MessageSource<?> source) { if (this.logger.isTraceEnabled()) { this.logger.trace("Poll produced " + (messageReceived ? "a" : "no") + " message"); } this.factory.clearThreadKey(); if (!this.fair && !messageReceived) { configureSource(source); } }
@Test public void testDelegates() { assertEquals(foo.mockSession, this.dsf.getSession("foo")); assertEquals(bar.mockSession, this.dsf.getSession("bar")); assertEquals(bar.mockSession, this.dsf.getSession("junk")); assertEquals(bar.mockSession, this.dsf.getSession()); this.dsf.setThreadKey("foo"); assertEquals(foo.mockSession, this.dsf.getSession("foo")); this.dsf.clearThreadKey(); TestSessionFactory factory = new TestSessionFactory(); this.sessionFactoryLocator.addSessionFactory("baz", factory); this.dsf.setThreadKey("baz"); assertEquals(factory.mockSession, this.dsf.getSession("baz")); this.dsf.clearThreadKey(); assertSame(factory, sessionFactoryLocator.removeSessionFactory("baz")); }