diff options
author | kamaci <furkankamaci@gmail.com> | 2020-10-19 00:01:12 +0300 |
---|---|---|
committer | kamaci <furkankamaci@gmail.com> | 2020-10-19 00:01:12 +0300 |
commit | 3cd7831692b1725713e297372a0181e5ae614eb9 (patch) | |
tree | 46725cd3575e53ff9ff40b44236b34a323f804ac /src/main/java/org/traccar/sms/smpp | |
parent | 98c2e3da5ea0670360078a3f278ddef7d9e39953 (diff) | |
download | trackermap-server-3cd7831692b1725713e297372a0181e5ae614eb9.tar.gz trackermap-server-3cd7831692b1725713e297372a0181e5ae614eb9.tar.bz2 trackermap-server-3cd7831692b1725713e297372a0181e5ae614eb9.zip |
Anonymous types are replaced with lambda.
Diffstat (limited to 'src/main/java/org/traccar/sms/smpp')
-rw-r--r-- | src/main/java/org/traccar/sms/smpp/SmppClient.java | 63 |
1 files changed, 26 insertions, 37 deletions
diff --git a/src/main/java/org/traccar/sms/smpp/SmppClient.java b/src/main/java/org/traccar/sms/smpp/SmppClient.java index 874253d36..5e157d0de 100644 --- a/src/main/java/org/traccar/sms/smpp/SmppClient.java +++ b/src/main/java/org/traccar/sms/smpp/SmppClient.java @@ -16,19 +16,6 @@ */ package org.traccar.sms.smpp; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledFuture; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.TimeUnit; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.traccar.Context; -import org.traccar.notification.MessageException; -import org.traccar.sms.SmsManager; - import com.cloudhopper.commons.charset.CharsetUtil; import com.cloudhopper.smpp.SmppBindType; import com.cloudhopper.smpp.SmppConstants; @@ -44,6 +31,17 @@ import com.cloudhopper.smpp.type.RecoverablePduException; import com.cloudhopper.smpp.type.SmppChannelException; import com.cloudhopper.smpp.type.SmppTimeoutException; import com.cloudhopper.smpp.type.UnrecoverablePduException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.traccar.Context; +import org.traccar.notification.MessageException; +import org.traccar.sms.SmsManager; + +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; public class SmppClient implements SmsManager { @@ -122,25 +120,19 @@ public class SmppClient implements SmsManager { enquireLinkPeriod = Context.getConfig().getInteger("sms.smpp.enquireLinkPeriod", 60000); enquireLinkTimeout = Context.getConfig().getInteger("sms.smpp.enquireLinkTimeout", 10000); - enquireLinkExecutor = Executors.newScheduledThreadPool(1, new ThreadFactory() { - @Override - public Thread newThread(Runnable runnable) { - Thread thread = new Thread(runnable); - String name = sessionConfig.getName(); - thread.setName("EnquireLink-" + name); - return thread; - } + enquireLinkExecutor = Executors.newScheduledThreadPool(1, runnable -> { + Thread thread = new Thread(runnable); + String name = sessionConfig.getName(); + thread.setName("EnquireLink-" + name); + return thread; }); reconnectionDelay = Context.getConfig().getInteger("sms.smpp.reconnectionDelay", 10000); - reconnectionExecutor = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() { - @Override - public Thread newThread(Runnable runnable) { - Thread thread = new Thread(runnable); - String name = sessionConfig.getName(); - thread.setName("Reconnection-" + name); - return thread; - } + reconnectionExecutor = Executors.newSingleThreadScheduledExecutor(runnable -> { + Thread thread = new Thread(runnable); + String name = sessionConfig.getName(); + thread.setName("Reconnection-" + name); + return thread; }); scheduleReconnect(); @@ -257,14 +249,11 @@ public class SmppClient implements SmsManager { @Override public void sendMessageAsync(final String destAddress, final String message, final boolean command) { - executorService.execute(new Runnable() { - @Override - public void run() { - try { - sendMessageSync(destAddress, message, command); - } catch (MessageException | InterruptedException | IllegalStateException error) { - LOGGER.warn("SMS sending error", error); - } + executorService.execute(() -> { + try { + sendMessageSync(destAddress, message, command); + } catch (MessageException | InterruptedException | IllegalStateException error) { + LOGGER.warn("SMS sending error", error); } }); } |