2 // ========================================================================
3 // Copyright (c) 1995-2014 Mort Bay Consulting Pty. Ltd.
4 // ------------------------------------------------------------------------
5 // All rights reserved. This program and the accompanying materials
6 // are made available under the terms of the Eclipse Public License v1.0
7 // and Apache License v2.0 which accompanies this distribution.
9 // The Eclipse Public License is available at
10 // http://www.eclipse.org/legal/epl-v10.html
12 // The Apache License v2.0 is available at
13 // http://www.opensource.org/licenses/apache2.0.php
15 // You may elect to redistribute this code under either of these licenses.
16 // ========================================================================
19 package org.eclipse.jetty.server;
21 import java.util.Collection;
22 import java.util.List;
23 import java.util.concurrent.Executor;
25 import org.eclipse.jetty.io.ByteBufferPool;
26 import org.eclipse.jetty.io.EndPoint;
27 import org.eclipse.jetty.server.handler.ContextHandler;
28 import org.eclipse.jetty.util.annotation.ManagedAttribute;
29 import org.eclipse.jetty.util.annotation.ManagedObject;
30 import org.eclipse.jetty.util.component.Graceful;
31 import org.eclipse.jetty.util.component.LifeCycle;
32 import org.eclipse.jetty.util.thread.Scheduler;
35 * <p>A {@link Connector} accept connections and data from remote peers,
36 * and allows applications to send data to remote peers, by setting up
37 * the machinery needed to handle such tasks.</p>
39 @ManagedObject("Connector Interface")
40 public interface Connector extends LifeCycle, Graceful
43 * @return the {@link Server} instance associated with this {@link Connector}
45 public Server getServer();
48 * @return the {@link Executor} used to submit tasks
50 public Executor getExecutor();
53 * @return the {@link Scheduler} used to schedule tasks
55 public Scheduler getScheduler();
58 * @return the {@link ByteBufferPool} to acquire buffers from and release buffers to
60 public ByteBufferPool getByteBufferPool();
63 * @return the {@link ConnectionFactory} associated with the protocol name
65 public ConnectionFactory getConnectionFactory(String nextProtocol);
68 public <T> T getConnectionFactory(Class<T> factoryType);
71 * @return the default {@link ConnectionFactory} associated with the default protocol name
73 public ConnectionFactory getDefaultConnectionFactory();
75 public Collection<ConnectionFactory> getConnectionFactories();
77 public List<String> getProtocols();
80 * @return the max idle timeout for connections in milliseconds
82 @ManagedAttribute("maximum time a connection can be idle before being closed (in ms)")
83 public long getIdleTimeout();
86 * @return the underlying socket, channel, buffer etc. for the connector.
88 public Object getTransport();
91 * @return immutable collection of connected endpoints
93 public Collection<EndPoint> getConnectedEndPoints();
96 /* ------------------------------------------------------------ */
98 * Get the connector name if set.
99 * <p>A {@link ContextHandler} may be configured with
100 * virtual hosts in the form "@connectorName" and will only serve
101 * requests from the named connector.
102 * @return The connector name or null.
104 public String getName();