From 930b3f29f788d7866d66fcb9e946f5947782d968 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Mon, 8 Aug 2016 11:01:02 +0300 Subject: juick-ws: components as async beans --- .../src/main/java/com/juick/ws/components/CrosspostComponent.java | 4 ++-- .../src/main/java/com/juick/ws/components/JuickComponent.java | 8 ++++++++ juick-ws/src/main/java/com/juick/ws/components/PushComponent.java | 4 ++-- juick-ws/src/main/java/com/juick/ws/components/XMPPComponent.java | 4 ++-- 4 files changed, 14 insertions(+), 6 deletions(-) create mode 100644 juick-ws/src/main/java/com/juick/ws/components/JuickComponent.java (limited to 'juick-ws/src/main/java/com/juick/ws/components') 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 977e0ed0..14d65d07 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 @@ -52,7 +52,7 @@ import java.util.logging.Logger; * @author Ugnich Anton */ @Component -public class CrosspostComponent implements InitializingBean, DisposableBean, Stream.StreamListener, Message.MessageListener { +public class CrosspostComponent implements JuickComponent, DisposableBean, Stream.StreamListener, Message.MessageListener { private static Logger logger = Logger.getLogger(CrosspostComponent.class.getName()); @@ -68,7 +68,7 @@ public class CrosspostComponent implements InitializingBean, DisposableBean, Str @Async @Override - public void afterPropertiesSet() throws Exception { + public void init() { logger.info("component initialized"); try { twitter_consumer_key = env.getProperty("twitter_consumer_key", ""); diff --git a/juick-ws/src/main/java/com/juick/ws/components/JuickComponent.java b/juick-ws/src/main/java/com/juick/ws/components/JuickComponent.java new file mode 100644 index 00000000..0f53ed66 --- /dev/null +++ b/juick-ws/src/main/java/com/juick/ws/components/JuickComponent.java @@ -0,0 +1,8 @@ +package com.juick.ws.components; + +/** + * Created by vitalyster on 08.08.2016. + */ +public interface JuickComponent { + void init(); +} 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 325f4a7e..75c42b2c 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 @@ -69,7 +69,7 @@ import java.util.stream.Collectors; * @author Ugnich Anton */ @Component -public class PushComponent implements InitializingBean, DisposableBean, Stream.StreamListener, MessageListener { +public class PushComponent implements JuickComponent, DisposableBean, Stream.StreamListener, MessageListener { private static Logger logger = Logger.getLogger(PushComponent.class.getName()); @@ -84,7 +84,7 @@ public class PushComponent implements InitializingBean, DisposableBean, Stream.S @Async @Override - public void afterPropertiesSet() { + public void init() { logger.info("component initialized"); wns_application_sip = env.getProperty("wns_application_sip", ""); wns_client_secret = env.getProperty("wns_client_secret", ""); 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 c0216eb2..7240769e 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 @@ -39,7 +39,7 @@ import java.util.logging.Logger; * @author ugnich */ @Component -public class XMPPComponent implements InitializingBean, DisposableBean, Stream.StreamListener, +public class XMPPComponent implements JuickComponent, DisposableBean, Stream.StreamListener, Message.MessageListener, Iq.IqListener, Presence.PresenceListener { private static final Logger logger = Logger.getLogger(XMPPComponent.class.getName()); @@ -180,7 +180,7 @@ public class XMPPComponent implements InitializingBean, DisposableBean, Stream.S @Async @Override - public void afterPropertiesSet() { + public void init() { logger.info("component initialized"); try { -- cgit v1.2.3