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
014package org.hornetq.spi.core.remoting;
015
016import java.util.Map;
017import java.util.Set;
018import java.util.concurrent.Executor;
019import java.util.concurrent.ScheduledExecutorService;
020
021import org.hornetq.core.server.cluster.ClusterConnection;
022
023/**
024 * A factory for creating acceptors.
025 * <p/>
026 * An Acceptor is an endpoint that a {@link org.hornetq.spi.core.remoting.Connector} will connect to and is used by the remoting service.
027 *
028 * @author <a href="ataylor@redhat.com">Andy Taylor</a>
029 * @author <a href="tim.fox@jboss.com">Tim Fox</a>
030 * @author <a href="jmesnil@redhat.com">Jeff Mesnil</a>
031 */
032public interface AcceptorFactory
033{
034   /**
035    * Create a new instance of an Acceptor.
036    *
037    * @param configuration       the configuration
038    * @param handler             the handler
039    * @param decoder             the decoder
040    * @param listener            the listener
041    * @param threadPool          the threadpool
042    * @param scheduledThreadPool a scheduled thread pool
043    * @return an acceptor
044    */
045   Acceptor createAcceptor(ClusterConnection clusterConnection,
046                           final Map<String, Object> configuration,
047                           BufferHandler handler,
048                           BufferDecoder decoder,
049                           ConnectionLifeCycleListener listener,
050                           Executor threadPool,
051                           ScheduledExecutorService scheduledThreadPool);
052
053   /**
054    * Returns the allowable properties for this acceptor.
055    * <p/>
056    * This will differ between different acceptor implementations.
057    *
058    * @return the allowable properties.
059    */
060   Set<String> getAllowableProperties();
061}