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/api | |
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/api')
-rw-r--r-- | src/main/java/org/traccar/api/AsyncSocketServlet.java | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/main/java/org/traccar/api/AsyncSocketServlet.java b/src/main/java/org/traccar/api/AsyncSocketServlet.java index 9318b6fc6..51fbfb478 100644 --- a/src/main/java/org/traccar/api/AsyncSocketServlet.java +++ b/src/main/java/org/traccar/api/AsyncSocketServlet.java @@ -15,9 +15,6 @@ */ package org.traccar.api; -import org.eclipse.jetty.websocket.servlet.ServletUpgradeRequest; -import org.eclipse.jetty.websocket.servlet.ServletUpgradeResponse; -import org.eclipse.jetty.websocket.servlet.WebSocketCreator; import org.eclipse.jetty.websocket.servlet.WebSocketServlet; import org.eclipse.jetty.websocket.servlet.WebSocketServletFactory; import org.traccar.Context; @@ -30,15 +27,12 @@ public class AsyncSocketServlet extends WebSocketServlet { @Override public void configure(WebSocketServletFactory factory) { factory.getPolicy().setIdleTimeout(Context.getConfig().getLong("web.timeout", ASYNC_TIMEOUT)); - factory.setCreator(new WebSocketCreator() { - @Override - public Object createWebSocket(ServletUpgradeRequest req, ServletUpgradeResponse resp) { - if (req.getSession() != null) { - long userId = (Long) req.getSession().getAttribute(SessionResource.USER_ID_KEY); - return new AsyncSocket(userId); - } else { - return null; - } + factory.setCreator((req, resp) -> { + if (req.getSession() != null) { + long userId = (Long) req.getSession().getAttribute(SessionResource.USER_ID_KEY); + return new AsyncSocket(userId); + } else { + return null; } }); } |