001 /**
002 * Copyright (C) 2009-2013 Barchart, Inc. <http://www.barchart.com/>
003 *
004 * All rights reserved. Licensed under the OSI BSD License.
005 *
006 * http://www.opensource.org/licenses/bsd-license.php
007 */
008 package com.barchart.udt.nio;
009
010 import java.io.IOException;
011 import java.net.Socket;
012 import java.net.SocketAddress;
013
014 import com.barchart.udt.net.NetServerSocketUDT;
015
016 public class NioServerSocketUDT extends NetServerSocketUDT {
017
018 protected final ServerSocketChannelUDT channelUDT;
019
020 protected NioServerSocketUDT(final ServerSocketChannelUDT channelUDT)
021 throws IOException {
022 super(channelUDT.socketUDT());
023 this.channelUDT = channelUDT;
024 }
025
026 @Override
027 public Socket accept() throws IOException {
028 throw new RuntimeException("feature not available");
029 }
030
031 @Override
032 public void bind(final SocketAddress endpoint) throws IOException {
033 final SelectorProviderUDT provider = //
034 (SelectorProviderUDT) channelUDT.provider();
035 final int backlog = provider.getAcceptQueueSize();
036 bind(endpoint, backlog);
037 }
038
039 @Override
040 public ServerSocketChannelUDT getChannel() {
041 return channelUDT;
042 }
043
044 }