From 351a61da81baccae4392fc65bb09e5e19860eaa5 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 8 Aug 2016 00:05:21 +0300 Subject: juick-ws: async components --- juick-ws/src/main/java/com/juick/ws/XMPPConnection.java | 3 +++ juick-ws/src/main/java/com/juick/ws/components/CrosspostComponent.java | 2 ++ juick-ws/src/main/java/com/juick/ws/components/PushComponent.java | 2 ++ juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java | 2 ++ 4 files changed, 9 insertions(+) diff --git a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java index 430a7d59..8a55dc7e 100644 --- a/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java +++ b/juick-ws/src/main/java/com/juick/ws/XMPPConnection.java @@ -11,6 +11,7 @@ import com.juick.xmpp.extensions.JuickMessage; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import org.springframework.web.socket.TextMessage; @@ -38,6 +39,8 @@ public class XMPPConnection implements InitializingBean, Stream.StreamListener, MessageSerializer ms; WebsocketComponent wsHandler; + @Async + @Override public void afterPropertiesSet() { xmppPassword = env.getProperty("xmpp_password"); ms = new MessageSerializer(); diff --git a/juick-ws/src/main/java/com/juick/ws/components/CrosspostComponent.java b/juick-ws/src/main/java/com/juick/ws/components/CrosspostComponent.java index 1a6bd20e..ea397c28 100644 --- a/juick-ws/src/main/java/com/juick/ws/components/CrosspostComponent.java +++ b/juick-ws/src/main/java/com/juick/ws/components/CrosspostComponent.java @@ -30,6 +30,7 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import javax.crypto.Mac; @@ -68,6 +69,7 @@ public class CrosspostComponent implements InitializingBean, DisposableBean, Str @Inject Environment env; + @Async @Override public void afterPropertiesSet() throws Exception { logger.info("component initialized"); diff --git a/juick-ws/src/main/java/com/juick/ws/components/PushComponent.java b/juick-ws/src/main/java/com/juick/ws/components/PushComponent.java index bf56fb4b..11e20ed4 100644 --- a/juick-ws/src/main/java/com/juick/ws/components/PushComponent.java +++ b/juick-ws/src/main/java/com/juick/ws/components/PushComponent.java @@ -50,6 +50,7 @@ import org.springframework.beans.factory.InitializingBean; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.datasource.DriverManagerDataSource; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import javax.inject.Inject; @@ -83,6 +84,7 @@ public class PushComponent implements InitializingBean, DisposableBean, Stream.S @Inject Environment env; + @Async @Override public void afterPropertiesSet() { logger.info("component initialized"); diff --git a/juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java b/juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java index 327b8e71..c0216eb2 100644 --- a/juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java +++ b/juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java @@ -15,6 +15,7 @@ import org.springframework.beans.factory.DisposableBean; import org.springframework.beans.factory.InitializingBean; import org.springframework.core.env.Environment; import org.springframework.jdbc.core.JdbcTemplate; +import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import org.xmlpull.v1.XmlPullParserException; @@ -177,6 +178,7 @@ public class XMPPComponent implements InitializingBean, DisposableBean, Stream.S } } + @Async @Override public void afterPropertiesSet() { -- cgit v1.2.3