This is an automated email from the ASF dual-hosted git repository. ralaoui pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/mina-vysper.git
The following commit(s) were added to refs/heads/master by this push: new e54ef1e Add StanzaHandlerExecutor and make it unavoidable to execute a StanzaHandler e54ef1e is described below commit e54ef1ed98fae8dbe9f6ddc04ffbb8e8deb5bd90 Author: Réda Housni Alaoui <reda.housniala...@gmail.com> AuthorDate: Wed Aug 28 01:17:36 2019 +0200 Add StanzaHandlerExecutor and make it unavoidable to execute a StanzaHandler --- .../inbound/DeliveringInternalInboundStanzaRelay.java | 2 +- .../java/org/apache/vysper/xmpp/server/XMPPServer.java | 2 +- .../xmpp/server/components/ComponentStanzaProcessor.java | 6 ++---- .../DeliveringInteralInboundStanzaRelayTestCase.java | 15 +++++---------- 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInternalInboundStanzaRelay.java b/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInternalInboundStanzaRelay.java index 86fe263..998f50c 100644 --- a/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInternalInboundStanzaRelay.java +++ b/server/core/src/main/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInternalInboundStanzaRelay.java @@ -151,7 +151,7 @@ public class DeliveringInternalInboundStanzaRelay implements StanzaRelay, Manage this.serverRuntimeContext = serverRuntimeContext; } - public void setStanzaHandlerExecutionContextFactory( + public void setStanzaHandlerExecutorFactory( StanzaHandlerExecutorFactory stanzaHandlerExecutorFactory) { this.inboundStanzaProtocolWorker = new InboundStanzaProtocolWorker(stanzaHandlerExecutorFactory); } diff --git a/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java b/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java index 58901bf..095f45e 100644 --- a/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java +++ b/server/core/src/main/java/org/apache/vysper/xmpp/server/XMPPServer.java @@ -217,7 +217,7 @@ public class XMPPServer { stanzaRelayBroker.setServerRuntimeContext(serverRuntimeContext); internalStanzaRelay.setServerRuntimeContext(serverRuntimeContext); - internalStanzaRelay.setStanzaHandlerExecutionContextFactory(stanzaHandlerExecutorFactory); + internalStanzaRelay.setStanzaHandlerExecutorFactory(stanzaHandlerExecutorFactory); externalStanzaRelay.setServerRuntimeContext(serverRuntimeContext); final LogStorageProvider logStorageProvider = this.storageProviderRegistry.retrieve(LogStorageProvider.class); diff --git a/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java b/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java index 518f24e..0ef52d1 100644 --- a/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java +++ b/server/core/src/main/java/org/apache/vysper/xmpp/server/components/ComponentStanzaProcessor.java @@ -89,11 +89,9 @@ public class ComponentStanzaProcessor implements StanzaProcessor { List<Stanza> responseStanzas = responseStanzaContainer.getResponseStanzas(); try { // module - StanzaHandlerExecutor executionContext = stanzaHandlerExecutorFactory - .build(new RelayingStanzaHandler()); + StanzaHandlerExecutor executor = stanzaHandlerExecutorFactory.build(new RelayingStanzaHandler()); for (Stanza responseStanza : responseStanzas) { - executionContext.execute(responseStanza, serverRuntimeContext, false, sessionContext, - sessionStateHolder); + executor.execute(responseStanza, serverRuntimeContext, false, sessionContext, sessionStateHolder); } } catch (ProtocolException e) { throw new RuntimeException(e); diff --git a/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java b/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java index 312823a..38aa8ec 100644 --- a/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java +++ b/server/core/src/test/java/org/apache/vysper/xmpp/delivery/inbound/DeliveringInteralInboundStanzaRelayTestCase.java @@ -92,8 +92,7 @@ public class DeliveringInteralInboundStanzaRelayTestCase extends TestCase { DefaultServerRuntimeContext serverRuntimeContext = new DefaultServerRuntimeContext(serverEntity, mock(StanzaRelay.class)); stanzaRelay.setServerRuntimeContext(serverRuntimeContext); - stanzaRelay - .setStanzaHandlerExecutionContextFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); + stanzaRelay.setStanzaHandlerExecutorFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); TestSessionContext sessionContext = TestSessionContext.createSessionContext(TO_ENTITY); sessionContext.setSessionState(SessionState.AUTHENTICATED); @@ -137,8 +136,7 @@ public class DeliveringInteralInboundStanzaRelayTestCase extends TestCase { serverRuntimeContext.getServerFeatures().setDeliverMessageToHighestPriorityResourcesOnly(false); stanzaRelay.setServerRuntimeContext(serverRuntimeContext); - stanzaRelay - .setStanzaHandlerExecutionContextFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); + stanzaRelay.setStanzaHandlerExecutorFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); TestSessionContext sessionContextTO_ENTITY_1_prio3 = createSessionForTo(TO_ENTITY, 3); // NON-NEGATIVE TestSessionContext sessionContextTO_ENTITY_2_prio0 = createSessionForTo(TO_ENTITY, 0); // NON-NEGATIVE @@ -173,8 +171,7 @@ public class DeliveringInteralInboundStanzaRelayTestCase extends TestCase { serverRuntimeContext.getServerFeatures().setDeliverMessageToHighestPriorityResourcesOnly(true); stanzaRelay.setServerRuntimeContext(serverRuntimeContext); - stanzaRelay - .setStanzaHandlerExecutionContextFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); + stanzaRelay.setStanzaHandlerExecutorFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); TestSessionContext sessionContextTO_ENTITY_1_prio3 = createSessionForTo(TO_ENTITY, 3); // HIGHEST PRIO TestSessionContext sessionContextTO_ENTITY_2_prio0 = createSessionForTo(TO_ENTITY, 1); // not receiving @@ -231,8 +228,7 @@ public class DeliveringInteralInboundStanzaRelayTestCase extends TestCase { mock(StanzaRelay.class)); stanzaRelay.setServerRuntimeContext(serverRuntimeContext); - stanzaRelay - .setStanzaHandlerExecutionContextFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); + stanzaRelay.setStanzaHandlerExecutorFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); stanzaRelay.setMaxThreadCount(1); TestSessionContext sessionContext = createSessionForTo(TO_ENTITY, 1); @@ -256,8 +252,7 @@ public class DeliveringInteralInboundStanzaRelayTestCase extends TestCase { mock(StanzaRelay.class)); stanzaRelay.setServerRuntimeContext(serverRuntimeContext); - stanzaRelay - .setStanzaHandlerExecutionContextFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); + stanzaRelay.setStanzaHandlerExecutorFactory(new SimpleStanzaHandlerExecutorFactory(stanzaRelay)); stanzaRelay.setMaxThreadCount(10); TestSessionContext sessionContext = createSessionForTo(TO_ENTITY, 1);