Issue #3162 - Reverting not-relevant OSGi changes

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2019-01-30 12:43:36 -06:00 committed by Simone Bordet
parent e135197066
commit 72ad74866c
2 changed files with 10 additions and 9 deletions

View File

@ -19,10 +19,9 @@
package org.eclipse.jetty.osgi.test; package org.eclipse.jetty.osgi.test;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.websocket.api.Session; import org.eclipse.jetty.websocket.api.Session;
import org.eclipse.jetty.websocket.api.StatusCode; import org.eclipse.jetty.websocket.api.StatusCode;
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose; import org.eclipse.jetty.websocket.api.annotations.OnWebSocketClose;
@ -36,7 +35,6 @@ import org.eclipse.jetty.websocket.api.annotations.WebSocket;
@WebSocket(maxTextMessageSize = 64 * 1024) @WebSocket(maxTextMessageSize = 64 * 1024)
public class SimpleEchoSocket public class SimpleEchoSocket
{ {
private static final Logger LOG = Log.getLogger(SimpleEchoSocket.class);
private final CountDownLatch closeLatch; private final CountDownLatch closeLatch;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private Session session; private Session session;
@ -54,8 +52,7 @@ public class SimpleEchoSocket
@OnWebSocketClose @OnWebSocketClose
public void onClose(int statusCode, String reason) public void onClose(int statusCode, String reason)
{ {
LOG.debug("Connection closed: {} - {}", statusCode, reason); //System.out.printf("Connection closed: %d - %s%n",statusCode,reason);
this.session = null; this.session = null;
this.closeLatch.countDown(); // trigger latch this.closeLatch.countDown(); // trigger latch
} }
@ -63,11 +60,16 @@ public class SimpleEchoSocket
@OnWebSocketConnect @OnWebSocketConnect
public void onConnect(Session session) public void onConnect(Session session)
{ {
LOG.debug("Got connect: {}", session); //System.out.printf("Got connect: %s%n",session);
this.session = session; this.session = session;
try try
{ {
session.getRemote().sendString("Foo"); Future<Void> fut;
//System.err.println("Sending Foo!");
fut = session.getRemote().sendStringByFuture("Foo");
fut.get(2,TimeUnit.SECONDS); // wait for send to complete.
//System.err.println("Foo complete");
session.close(StatusCode.NORMAL,"I'm done"); session.close(StatusCode.NORMAL,"I'm done");
} }
@ -80,6 +82,6 @@ public class SimpleEchoSocket
@OnWebSocketMessage @OnWebSocketMessage
public void onMessage(String msg) public void onMessage(String msg)
{ {
LOG.debug("Got msg: {}", msg); //System.out.printf("Got msg: %s%n",msg);
} }
} }

View File

@ -55,7 +55,6 @@ public class TestJettyOSGiBootWithWebSocket
public static Option[] configure() public static Option[] configure()
{ {
ArrayList<Option> options = new ArrayList<>(); ArrayList<Option> options = new ArrayList<>();
options.add(TestOSGiUtil.optionalRemoteDebug());
options.add(CoreOptions.junitBundles()); options.add(CoreOptions.junitBundles());
options.addAll(TestOSGiUtil.configureJettyHomeAndPort(false, "jetty-http-boot-with-websocket.xml")); options.addAll(TestOSGiUtil.configureJettyHomeAndPort(false, "jetty-http-boot-with-websocket.xml"));
options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.sql.*","javax.xml.*", "javax.activation.*")); options.add(CoreOptions.bootDelegationPackages("org.xml.sax", "org.xml.*", "org.w3c.*", "javax.sql.*","javax.xml.*", "javax.activation.*"));