summaryrefslogtreecommitdiffstats
path: root/standalone-container
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-03-09 17:03:32 +0100
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-03-09 17:30:13 +0100
commit1dd94fa117dc987a6b9411509fcc6f65fb8cec44 (patch)
tree7b71b7f15dfb433247ee4a6a6841d727462805a6 /standalone-container
parent4390a0a5c47681708ce4e6665fce64d4214d3461 (diff)
Remove pre-binding of server socket
Pre-binding of server socket is remnant of the Apache commons-daemon integration which was removed long time ago. This allowed the container to start with extra privileges and downgrade after binding the server socket.
Diffstat (limited to 'standalone-container')
-rw-r--r--standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneContainerActivator.java30
1 files changed, 2 insertions, 28 deletions
diff --git a/standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneContainerActivator.java b/standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneContainerActivator.java
index cfd5f753c4f..dbf0b748eea 100644
--- a/standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneContainerActivator.java
+++ b/standalone-container/src/main/java/com/yahoo/container/standalone/StandaloneContainerActivator.java
@@ -13,20 +13,15 @@ import com.yahoo.jdisc.http.ConnectorConfig;
import com.yahoo.vespa.model.VespaModel;
import com.yahoo.vespa.model.container.Container;
import com.yahoo.vespa.model.container.http.ConnectorFactory;
-import com.yahoo.vespa.model.container.http.Http;
import com.yahoo.vespa.model.container.http.JettyHttpServer;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.nio.channels.ServerSocketChannel;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
-import java.util.Hashtable;
import java.util.List;
import java.util.stream.Collectors;
@@ -35,29 +30,8 @@ import java.util.stream.Collectors;
*/
public class StandaloneContainerActivator implements BundleActivator {
- @Override
- public void start(BundleContext bundleContext) throws Exception {
- for (ConnectorConfig config: getConnectorConfigs(getContainer())) {
- ServerSocketChannel socketChannel = bindChannel(config);
- registerChannels(bundleContext, config.listenPort(), socketChannel);
- }
- }
-
- static void registerChannels(BundleContext bundleContext, int listenPort, ServerSocketChannel boundChannel) {
- Hashtable<String, Integer> properties = new Hashtable<>();
- properties.put("port", listenPort);
- bundleContext.registerService(ServerSocketChannel.class, boundChannel, properties);
- }
-
- static ServerSocketChannel bindChannel(ConnectorConfig channelInfo) throws IOException {
- ServerSocketChannel serverChannel = ServerSocketChannel.open();
- InetSocketAddress bindAddress = new InetSocketAddress(channelInfo.listenPort());
- serverChannel.socket().bind(bindAddress, channelInfo.acceptQueueSize());
- return serverChannel;
- }
-
- @Override
- public void stop(BundleContext bundleContext) throws Exception { }
+ @Override public void start(BundleContext bundleContext) {}
+ @Override public void stop(BundleContext bundleContext) {}
static Container getContainer(Module... modules) {
Module activatorModule = new ActivatorModule();