001    /*
002     * Copyright 2009 Red Hat, Inc.
003     * Red Hat licenses this file to you under the Apache License, version
004     * 2.0 (the "License"); you may not use this file except in compliance
005     * with the License.  You may obtain a copy of the License at
006     *    http://www.apache.org/licenses/LICENSE-2.0
007     * Unless required by applicable law or agreed to in writing, software
008     * distributed under the License is distributed on an "AS IS" BASIS,
009     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
010     * implied.  See the License for the specific language governing
011     * permissions and limitations under the License.
012     */
013    
014    package org.hornetq.spi.core.remoting;
015    
016    import java.util.Map;
017    import java.util.Set;
018    import java.util.concurrent.Executor;
019    import java.util.concurrent.ScheduledExecutorService;
020    
021    /**
022     * A factory for creating acceptors.
023     * <p/>
024     * An Acceptor is an endpoint that a {@link org.hornetq.spi.core.remoting.Connector} will connect to and is used by the remoting service.
025     *
026     * @author <a href="ataylor@redhat.com">Andy Taylor</a>
027     * @author <a href="tim.fox@jboss.com">Tim Fox</a>
028     * @author <a href="jmesnil@redhat.com">Jeff Mesnil</a>
029     */
030    public interface AcceptorFactory
031    {
032       /**
033        * Create a new instance of an Acceptor.
034        *
035        * @param configuration       the configuration
036        * @param handler             the handler
037        * @param decoder             the decoder
038        * @param listener            the listener
039        * @param threadPool          the threadpool
040        * @param scheduledThreadPool a scheduled thread pool
041        * @return an acceptor
042        */
043       Acceptor createAcceptor(final Map<String, Object> configuration,
044                               BufferHandler handler,
045                               BufferDecoder decoder,
046                               ConnectionLifeCycleListener listener,
047                               Executor threadPool,
048                               ScheduledExecutorService scheduledThreadPool);
049    
050       /**
051        * Returns the allowable properties for this acceptor.
052        * <p/>
053        * This will differ between different acceptor implementations.
054        *
055        * @return the allowable properties.
056        */
057       Set<String> getAllowableProperties();
058    }