View Javadoc

1   //
2   //  ========================================================================
3   //  Copyright (c) 1995-2013 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.
8   //
9   //      The Eclipse Public License is available at
10  //      http://www.eclipse.org/legal/epl-v10.html
11  //
12  //      The Apache License v2.0 is available at
13  //      http://www.opensource.org/licenses/apache2.0.php
14  //
15  //  You may elect to redistribute this code under either of these licenses.
16  //  ========================================================================
17  //
18  
19  package org.eclipse.jetty.server;
20  
21  import java.util.Collection;
22  import java.util.List;
23  import java.util.concurrent.Executor;
24  
25  import org.eclipse.jetty.io.ByteBufferPool;
26  import org.eclipse.jetty.util.annotation.ManagedAttribute;
27  import org.eclipse.jetty.util.annotation.ManagedObject;
28  import org.eclipse.jetty.util.component.Graceful;
29  import org.eclipse.jetty.util.component.LifeCycle;
30  import org.eclipse.jetty.util.thread.Scheduler;
31  
32  /**
33   * <p>A {@link Connector} accept connections and data from remote peers,
34   * and allows applications to send data to remote peers, by setting up
35   * the machinery needed to handle such tasks.</p>
36   */
37  @ManagedObject("Connector Interface")
38  public interface Connector extends LifeCycle, Graceful
39  {
40      /**
41       * @return the {@link Server} instance associated with this {@link Connector}
42       */
43      public Server getServer();
44  
45      /**
46       * @return the {@link Executor} used to submit tasks
47       */
48      public Executor getExecutor();
49  
50      /**
51       * @return the {@link Scheduler} used to schedule tasks
52       */
53      public Scheduler getScheduler();
54  
55      /**
56       * @return the {@link ByteBufferPool} to acquire buffers from and release buffers to
57       */
58      public ByteBufferPool getByteBufferPool();
59  
60      /**
61       * @return the {@link ConnectionFactory} associated with the protocol name
62       */
63      public ConnectionFactory getConnectionFactory(String nextProtocol);
64      
65  
66      public <T> T getConnectionFactory(Class<T> factoryType);
67      
68      /**
69       * @return the default {@link ConnectionFactory} associated with the default protocol name
70       */
71      public ConnectionFactory getDefaultConnectionFactory();
72      
73      public Collection<ConnectionFactory> getConnectionFactories();
74      
75      public List<String> getProtocols();
76      
77      /**
78       * @return the max idle timeout for connections in milliseconds
79       */
80      @ManagedAttribute("maximum time a connection can be idle before being closed (in ms)")
81      public long getIdleTimeout();
82  
83      /**
84       * @return the underlying socket, channel, buffer etc. for the connector.
85       */
86      public Object getTransport();
87      
88  
89  }