├── .gitignore ├── LICENSE.txt ├── api ├── pom.xml └── src │ ├── main │ ├── java │ │ ├── java │ │ │ └── nio │ │ │ │ └── channels │ │ │ │ └── FileChannel.java │ │ ├── org │ │ │ └── xnio │ │ │ │ ├── AbstractConvertingIoFuture.java │ │ │ │ ├── AbstractIoFuture.java │ │ │ │ ├── AutomaticReference.java │ │ │ │ ├── Bits.java │ │ │ │ ├── BrokenPipeException.java │ │ │ │ ├── BufferAllocator.java │ │ │ │ ├── Buffers.java │ │ │ │ ├── ByteBufferSlicePool.java │ │ │ │ ├── ByteString.java │ │ │ │ ├── Cancellable.java │ │ │ │ ├── ChainedChannelListener.java │ │ │ │ ├── ChannelDestination.java │ │ │ │ ├── ChannelExceptionHandler.java │ │ │ │ ├── ChannelListener.java │ │ │ │ ├── ChannelListeners.java │ │ │ │ ├── ChannelPipe.java │ │ │ │ ├── ChannelSource.java │ │ │ │ ├── ClosedWorkerException.java │ │ │ │ ├── Closer.java │ │ │ │ ├── CompressionType.java │ │ │ │ ├── Connection.java │ │ │ │ ├── DelegatingChannelListener.java │ │ │ │ ├── FailedIoFuture.java │ │ │ │ ├── FileAccess.java │ │ │ │ ├── FileChangeCallback.java │ │ │ │ ├── FileChangeEvent.java │ │ │ │ ├── FileSystemWatcher.java │ │ │ │ ├── FinishedIoFuture.java │ │ │ │ ├── FutureResult.java │ │ │ │ ├── IoFuture.java │ │ │ │ ├── IoUtils.java │ │ │ │ ├── LocalSocketAddress.java │ │ │ │ ├── MessageConnection.java │ │ │ │ ├── ObjectProperties.java │ │ │ │ ├── Option.java │ │ │ │ ├── OptionMap.java │ │ │ │ ├── Options.java │ │ │ │ ├── PollingFileSystemWatcher.java │ │ │ │ ├── Pool.java │ │ │ │ ├── Pooled.java │ │ │ │ ├── Property.java │ │ │ │ ├── ReadPropertyAction.java │ │ │ │ ├── Result.java │ │ │ │ ├── Sequence.java │ │ │ │ ├── SequenceOption.java │ │ │ │ ├── SingleOption.java │ │ │ │ ├── SslClientAuthMode.java │ │ │ │ ├── StreamConnection.java │ │ │ │ ├── TranslatingResult.java │ │ │ │ ├── TypeOption.java │ │ │ │ ├── TypeSequenceOption.java │ │ │ │ ├── Version.java │ │ │ │ ├── Xnio.java │ │ │ │ ├── XnioExecutor.java │ │ │ │ ├── XnioFileChannel.java │ │ │ │ ├── XnioIoFactory.java │ │ │ │ ├── XnioIoThread.java │ │ │ │ ├── XnioProvider.java │ │ │ │ ├── XnioWorker.java │ │ │ │ ├── _private │ │ │ │ └── Messages.java │ │ │ │ ├── channels │ │ │ │ ├── AcceptListenerSettable.java │ │ │ │ ├── AcceptingChannel.java │ │ │ │ ├── AssembledChannel.java │ │ │ │ ├── AssembledConnectedChannel.java │ │ │ │ ├── AssembledConnectedMessageChannel.java │ │ │ │ ├── AssembledConnectedSslStreamChannel.java │ │ │ │ ├── AssembledConnectedStreamChannel.java │ │ │ │ ├── AssembledMessageChannel.java │ │ │ │ ├── AssembledSslChannel.java │ │ │ │ ├── AssembledStreamChannel.java │ │ │ │ ├── BlockingByteChannel.java │ │ │ │ ├── BlockingReadableByteChannel.java │ │ │ │ ├── BlockingWritableByteChannel.java │ │ │ │ ├── BoundChannel.java │ │ │ │ ├── BoundMultipointMessageChannel.java │ │ │ │ ├── ByteChannel.java │ │ │ │ ├── ChannelFactory.java │ │ │ │ ├── Channels.java │ │ │ │ ├── CloseListenerSettable.java │ │ │ │ ├── CloseableChannel.java │ │ │ │ ├── ConcurrentStreamChannelAccessException.java │ │ │ │ ├── Configurable.java │ │ │ │ ├── ConnectedChannel.java │ │ │ │ ├── ConnectedMessageChannel.java │ │ │ │ ├── ConnectedSslStreamChannel.java │ │ │ │ ├── ConnectedStreamChannel.java │ │ │ │ ├── EmptyStreamSourceChannel.java │ │ │ │ ├── FixedLengthOverflowException.java │ │ │ │ ├── FixedLengthStreamSinkChannel.java │ │ │ │ ├── FixedLengthStreamSourceChannel.java │ │ │ │ ├── FixedLengthUnderflowException.java │ │ │ │ ├── FramedMessageChannel.java │ │ │ │ ├── MessageChannel.java │ │ │ │ ├── MulticastMessageChannel.java │ │ │ │ ├── MultipointMessageChannel.java │ │ │ │ ├── NullStreamSinkChannel.java │ │ │ │ ├── ProtectedWrappedChannel.java │ │ │ │ ├── PushBackStreamChannel.java │ │ │ │ ├── ReadListenerSettable.java │ │ │ │ ├── ReadTimeoutException.java │ │ │ │ ├── ReadableMessageChannel.java │ │ │ │ ├── ReadableMultipointMessageChannel.java │ │ │ │ ├── SimpleAcceptingChannel.java │ │ │ │ ├── SocketAddressBuffer.java │ │ │ │ ├── SplitStreamSinkChannel.java │ │ │ │ ├── SplitStreamSourceChannel.java │ │ │ │ ├── SslChannel.java │ │ │ │ ├── StreamChannel.java │ │ │ │ ├── StreamSinkChannel.java │ │ │ │ ├── StreamSourceChannel.java │ │ │ │ ├── SuspendableAcceptChannel.java │ │ │ │ ├── SuspendableChannel.java │ │ │ │ ├── SuspendableReadChannel.java │ │ │ │ ├── SuspendableWriteChannel.java │ │ │ │ ├── TranslatingSuspendableChannel.java │ │ │ │ ├── UnsupportedOptionException.java │ │ │ │ ├── WrappedChannel.java │ │ │ │ ├── WritableMessageChannel.java │ │ │ │ ├── WritableMultipointMessageChannel.java │ │ │ │ ├── WriteListenerSettable.java │ │ │ │ ├── WriteTimeoutException.java │ │ │ │ └── package-info.java │ │ │ │ ├── conduits │ │ │ │ ├── AbstractConduit.java │ │ │ │ ├── AbstractMessageSinkConduit.java │ │ │ │ ├── AbstractMessageSourceConduit.java │ │ │ │ ├── AbstractSinkConduit.java │ │ │ │ ├── AbstractSourceConduit.java │ │ │ │ ├── AbstractStreamSinkConduit.java │ │ │ │ ├── AbstractStreamSourceConduit.java │ │ │ │ ├── AbstractSynchronizedConduit.java │ │ │ │ ├── AbstractSynchronizedSinkConduit.java │ │ │ │ ├── AbstractSynchronizedSourceConduit.java │ │ │ │ ├── BlockingStreamSinkConduit.java │ │ │ │ ├── BlockingStreamSourceConduit.java │ │ │ │ ├── BufferedStreamSinkConduit.java │ │ │ │ ├── BufferedStreamSourceConduit.java │ │ │ │ ├── Conduit.java │ │ │ │ ├── ConduitReadableByteChannel.java │ │ │ │ ├── ConduitReadableMessageChannel.java │ │ │ │ ├── ConduitStreamSinkChannel.java │ │ │ │ ├── ConduitStreamSourceChannel.java │ │ │ │ ├── ConduitWritableByteChannel.java │ │ │ │ ├── ConduitWritableMessageChannel.java │ │ │ │ ├── Conduits.java │ │ │ │ ├── DeflatingStreamSinkConduit.java │ │ │ │ ├── EmptyStreamSourceConduit.java │ │ │ │ ├── FixedLengthStreamSinkConduit.java │ │ │ │ ├── FixedLengthStreamSourceConduit.java │ │ │ │ ├── FramingMessageSinkConduit.java │ │ │ │ ├── FramingMessageSourceConduit.java │ │ │ │ ├── InflatingStreamSourceConduit.java │ │ │ │ ├── MessageSinkConduit.java │ │ │ │ ├── MessageSourceConduit.java │ │ │ │ ├── MessageStreamSinkConduit.java │ │ │ │ ├── MessageStreamSourceConduit.java │ │ │ │ ├── NullStreamSinkConduit.java │ │ │ │ ├── PushBackStreamSourceConduit.java │ │ │ │ ├── ReadReadyHandler.java │ │ │ │ ├── SinkConduit.java │ │ │ │ ├── SourceConduit.java │ │ │ │ ├── StreamSinkChannelWrappingConduit.java │ │ │ │ ├── StreamSinkConduit.java │ │ │ │ ├── StreamSourceChannelWrappingConduit.java │ │ │ │ ├── StreamSourceConduit.java │ │ │ │ ├── SynchronizedMessageSinkConduit.java │ │ │ │ ├── SynchronizedMessageSourceConduit.java │ │ │ │ ├── SynchronizedStreamSinkConduit.java │ │ │ │ ├── SynchronizedStreamSourceConduit.java │ │ │ │ ├── TerminateHandler.java │ │ │ │ ├── WriteReadyHandler.java │ │ │ │ └── package-info.java │ │ │ │ ├── http │ │ │ │ ├── HandshakeChecker.java │ │ │ │ ├── HttpUpgrade.java │ │ │ │ ├── HttpUpgradeParser.java │ │ │ │ └── RedirectException.java │ │ │ │ ├── management │ │ │ │ ├── XnioProviderMXBean.java │ │ │ │ ├── XnioServerMXBean.java │ │ │ │ └── XnioWorkerMXBean.java │ │ │ │ ├── package-info.java │ │ │ │ ├── sasl │ │ │ │ ├── SaslQop.java │ │ │ │ ├── SaslStrength.java │ │ │ │ ├── SaslUnwrappingConduit.java │ │ │ │ ├── SaslUtils.java │ │ │ │ ├── SaslWrapper.java │ │ │ │ ├── SaslWrappingConduit.java │ │ │ │ └── package-info.java │ │ │ │ ├── ssl │ │ │ │ ├── AbstractAcceptingSslChannel.java │ │ │ │ ├── JsseAcceptingSslStreamConnection.java │ │ │ │ ├── JsseSslConduitEngine.java │ │ │ │ ├── JsseSslStreamConnection.java │ │ │ │ ├── JsseSslStreamSinkConduit.java │ │ │ │ ├── JsseSslStreamSourceConduit.java │ │ │ │ ├── JsseSslUtils.java │ │ │ │ ├── JsseXnioSsl.java │ │ │ │ ├── SslConnection.java │ │ │ │ ├── XnioSsl.java │ │ │ │ └── package-info.java │ │ │ │ └── streams │ │ │ │ ├── BufferPipeInputStream.java │ │ │ │ ├── BufferPipeOutputStream.java │ │ │ │ ├── BufferedChannelInputStream.java │ │ │ │ ├── ChannelInputStream.java │ │ │ │ ├── ChannelOutputStream.java │ │ │ │ ├── LimitedInputStream.java │ │ │ │ ├── LimitedOutputStream.java │ │ │ │ ├── Pipe.java │ │ │ │ ├── ReaderInputStream.java │ │ │ │ ├── Streams.java │ │ │ │ ├── WriterOutputStream.java │ │ │ │ └── package-info.java │ │ └── overview.html │ └── resources │ │ └── org │ │ └── xnio │ │ └── Version.properties │ └── test │ ├── java │ ├── java │ │ └── nio │ │ │ └── channels │ │ │ └── FileChannel.java │ └── org │ │ └── xnio │ │ ├── AbstractConvertingIoFutureTestCase.java │ │ ├── AbstractIoFutureTestCase.java │ │ ├── AssertReadWrite.java │ │ ├── BitsTestCase.java │ │ ├── BuffersTestCase.java │ │ ├── ByteStringTestCase.java │ │ ├── ChannelListenersTestCase.java │ │ ├── CloserTestCase.java │ │ ├── FailedIoFutureTestCase.java │ │ ├── FileSystemWatcherTestCase.java │ │ ├── FinishedIoFutureTestCase.java │ │ ├── FutureResultTestCase.java │ │ ├── IoUtilsTestCase.java │ │ ├── LocalSocketAddressTestCase.java │ │ ├── OptionMapTestCase.java │ │ ├── OptionTestCase.java │ │ ├── OptionsTestCase.java │ │ ├── PropertyTestCase.java │ │ ├── SequenceTestCase.java │ │ ├── XnioFileChannelTestCase.java │ │ ├── XnioTestCase.java │ │ ├── XnioWorkerTestCase.java │ │ ├── channels │ │ ├── AbstractBlockingReadableByteChannelTest.java │ │ ├── AbstractBlockingWritableByteChannelTest.java │ │ ├── BlockingByteChannelReadTestCase.java │ │ ├── BlockingByteChannelWriteTestCase.java │ │ ├── BlockingReadableByteChannelTestCase.java │ │ ├── BlockingWritableByteChannelTestCase.java │ │ ├── ChannelsTestCase.java │ │ ├── EmptyStreamSourceChannelTestCase.java │ │ ├── FramedMessageChannelTestCase.java │ │ ├── PushBackStreamChannelTestCase.java │ │ └── SocketAddressBufferTestCase.java │ │ ├── http │ │ └── HttpParserTestCase.java │ │ ├── mock │ │ ├── AcceptingChannelMock.java │ │ ├── ConduitMock.java │ │ ├── ConnectedStreamChannelMock.java │ │ ├── MessageChannelMock.java │ │ ├── MessageConnectionMock.java │ │ ├── Mock.java │ │ ├── MulticastMessageChannelMock.java │ │ ├── StreamConnectionMock.java │ │ ├── XnioIoThreadMock.java │ │ ├── XnioMock.java │ │ └── XnioWorkerMock.java │ │ ├── racecondition │ │ ├── CloseReadingSslChannelTestCase.java │ │ ├── CloseWritingSslChannelTestCase.java │ │ ├── ResumeReadsOnHandlingReadableChannelTestCase.java │ │ ├── ResumeWritesOnHandlingWritableChannelTestCase.java │ │ ├── SetReadListenerOnHandlingReadableChannelTestCase.java │ │ ├── SetReadReadyOnHandlingReadableChannelTestCase.java │ │ ├── SetReadRequiresWriteOnWritingSslChannelTestCase.java │ │ ├── SetWriteListenerOnHandlingWritableChannelTestCase.java │ │ ├── SetWriteReadyOnHandlingWritableChannelTestCase.java │ │ └── SetWriteRequiresReadOnReadingSslChannelTestCase.java │ │ ├── ssl │ │ ├── AbstractConnectedSslStreamChannelTest.java │ │ ├── AbstractSslConnectionTest.java │ │ ├── AbstractSslTest.java │ │ ├── ChannelDelegationTestCase.java │ │ ├── ConnectedSslStreamChannelBufferOverflowTestCase.java │ │ ├── ConnectedSslStreamChannelReadTestCase.java │ │ ├── ConnectedSslStreamChannelReadWriteTestCase.java │ │ ├── ConnectedSslStreamChannelWriteTestCase.java │ │ ├── JsseSslStreamConnectionBufferOverflowTestCase.java │ │ ├── JsseSslStreamConnectionTestCase.java │ │ ├── JsseSslStreamSinkConduitTestCase.java │ │ ├── JsseSslStreamSourceConduitTestCase.java │ │ ├── JsseXnioSslTestCase.java │ │ ├── SslStreamConnectionValidationTestCase.java │ │ ├── StartTLSChannelTestCase.java │ │ ├── StartTLSConnectionTestCase.java │ │ └── mock │ │ │ ├── SSLContextMock.java │ │ │ └── SSLEngineMock.java │ │ └── streams │ │ ├── AbstractChannelInputStreamTest.java │ │ ├── AbstractChannelStreamTest.java │ │ ├── BufferPipeInputStreamTestCase.java │ │ ├── BufferPipeOutputStreamTestCase.java │ │ ├── BufferedChannelInputStreamTestCase.java │ │ ├── ChannelInputStreamTestCase.java │ │ ├── ChannelOutputStreamTestCase.java │ │ ├── LimitedInputStreamTestCase.java │ │ ├── LimitedOutputStreamTestCase.java │ │ ├── PipeTestCase.java │ │ ├── ReaderInputStreamTestCase.java │ │ ├── StreamsTestCase.java │ │ └── WriterOutputStreamTestCase.java │ └── resources │ ├── META-INF │ └── services │ │ └── org.xnio.XnioProvider │ ├── keystore.jks │ ├── org │ └── xnio │ │ └── racecondition │ │ ├── CloseReadingSslChannelTestCase.btm │ │ ├── CloseWritingSslChannelTestCase.btm │ │ ├── ResumeReadsOnHandlingReadableChannelTestCase.btm │ │ ├── ResumeWritesOnHandlingWritableChannelTestCase.btm │ │ ├── SetReadListenerOnHandlingReadableChannelTestCase.btm │ │ ├── SetReadReadyOnHandlingReadableChannelTestCase.btm │ │ ├── SetReadRequiresWriteOnWritingSslChannelTestCase.btm │ │ ├── SetWriteListenerOnHandlingWritableChannelTestCase.btm │ │ ├── SetWriteReadyOnHandlingWritableChannelTestCase.btm │ │ └── SetWriteRequiresReadOnReadingSslChannelTestCase.btm │ └── security.policy ├── nio-impl ├── pom.xml └── src │ ├── main │ ├── java │ │ └── org │ │ │ └── xnio │ │ │ └── nio │ │ │ ├── AbstractNioChannel.java │ │ │ ├── AbstractNioStreamConnection.java │ │ │ ├── Log.java │ │ │ ├── NioHandle.java │ │ │ ├── NioPipeSinkConduit.java │ │ │ ├── NioPipeSourceConduit.java │ │ │ ├── NioPipeStreamConnection.java │ │ │ ├── NioSocketConduit.java │ │ │ ├── NioSocketStreamConnection.java │ │ │ ├── NioTcpServer.java │ │ │ ├── NioTcpServerHandle.java │ │ │ ├── NioUdpChannel.java │ │ │ ├── NioUdpChannelHandle.java │ │ │ ├── NioXnio.java │ │ │ ├── NioXnioProvider.java │ │ │ ├── NioXnioWorker.java │ │ │ ├── SelectorUtils.java │ │ │ ├── Version.java │ │ │ ├── WatchServiceFileSystemWatcher.java │ │ │ └── WorkerThread.java │ └── resources │ │ ├── META-INF │ │ └── services │ │ │ └── org.xnio.XnioProvider │ │ └── org │ │ └── xnio │ │ └── nio │ │ └── Version.properties │ └── test │ ├── java │ └── org │ │ └── xnio │ │ └── nio │ │ └── test │ │ ├── AbstractNioChannelPipeTest.java │ │ ├── AbstractNioStreamChannelTest.java │ │ ├── AbstractNioTcpTest.java │ │ ├── AbstractStreamSinkSourceChannelTest.java │ │ ├── CatchingChannelListener.java │ │ ├── ConnectionOptionSetupTestCase.java │ │ ├── FileSystemWatcherTestCase.java │ │ ├── FullDuplexChannelPipeTestCase.java │ │ ├── HalfDuplexChannelPipeTestCase.java │ │ ├── IllegalConnectionTestCase.java │ │ ├── MultiThreadedNioSslTcpChannelTestCase.java │ │ ├── MultiThreadedNioSslTcpConnectionTestCase.java │ │ ├── MultiThreadedNioStartTLSTcpChannelTestCase.java │ │ ├── MultiThreadedNioStartTLSTcpConnectionTestCase.java │ │ ├── MultiThreadedNioTcpChannelTestCase.java │ │ ├── MultiThreadedNioTcpConnectionTestCase.java │ │ ├── NioFullDuplexChannelPipeTestCase.java │ │ ├── NioHalfDuplexChannelPipeTestCase.java │ │ ├── NioSslTcpChannelTestCase.java │ │ ├── NioSslTcpConnectionTestCase.java │ │ ├── NioStartTLSTcpChannelTestCase.java │ │ ├── NioStartTLSTcpConnectionTestCase.java │ │ ├── NioTcpChannelTestCase.java │ │ ├── NioTcpConnectionTestCase.java │ │ ├── NioUdpTestCase.java │ │ ├── OptionHelper.java │ │ ├── TcpChannelTestCase.java │ │ ├── TcpConnectionTestCase.java │ │ ├── TcpServerTest.java │ │ ├── TestChannelListener.java │ │ ├── UdpChannelTestCase.java │ │ ├── XnioWorkerTestCase.java │ │ └── racecondition │ │ └── NullHelper.java │ └── resources │ ├── keystore.jks │ ├── logging.properties │ └── org │ └── xnio │ └── nio │ └── test │ └── racecondition │ ├── SetConnFullDuringAwaitTestCase │ └── UnsetConnFullDuringAwaitTestCase └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | .project 2 | .classpath 3 | .settings 4 | *.iml 5 | target 6 | .idea 7 | *.ipr 8 | *~ 9 | out 10 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/BrokenPipeException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * 4 | * Copyright 2012 Red Hat, Inc. and/or its affiliates, and individual 5 | * contributors as indicated by the @author tags. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package org.xnio; 21 | 22 | import java.io.IOException; 23 | 24 | /** 25 | * An exception that signifies that a pipe, stream, or channel was closed from the read side while the write side was 26 | * still writing. 27 | * 28 | * @author David M. Lloyd 29 | */ 30 | public class BrokenPipeException extends IOException { 31 | 32 | /** 33 | * Constructs a {@code BrokenPipeException} with no detail message. The cause is not initialized, and may 34 | * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}. 35 | */ 36 | public BrokenPipeException() { 37 | } 38 | 39 | /** 40 | * Constructs a {@code BrokenPipeException} with the specified detail message. The cause is not initialized, and may 41 | * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}. 42 | * 43 | * @param msg the detail message 44 | */ 45 | public BrokenPipeException(final String msg) { 46 | super(msg); 47 | } 48 | 49 | /** 50 | * Constructs a {@code BrokenPipeException} with the specified cause. The detail message is set to: 51 | *
(cause == null ? null : cause.toString())52 | * (which typically contains the class and detail message of {@code cause}). 53 | * 54 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 55 | */ 56 | public BrokenPipeException(final Throwable cause) { 57 | super(cause); 58 | } 59 | 60 | /** 61 | * Constructs a {@code BrokenPipeException} with the specified detail message and cause. 62 | * 63 | * @param msg the detail message 64 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 65 | */ 66 | public BrokenPipeException(final String msg, final Throwable cause) { 67 | super(msg, cause); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/BufferAllocator.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * 4 | * Copyright 2011 Red Hat, Inc. and/or its affiliates, and individual 5 | * contributors as indicated by the @author tags. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package org.xnio; 21 | 22 | import java.nio.Buffer; 23 | import java.nio.ByteBuffer; 24 | 25 | /** 26 | * A simple allocator for buffers. 27 | * 28 | * @param the buffer type 29 | * 30 | * @author David M. Lloyd 31 | */ 32 | public interface BufferAllocator { 33 | 34 | /** 35 | * Allocate a buffer of the given size. 36 | * 37 | * @param size the size 38 | * @return the buffer 39 | * @throws IllegalArgumentException if the given buffer size is less than zero 40 | */ 41 | B allocate(int size) throws IllegalArgumentException; 42 | 43 | /** 44 | * A simple allocator for heap-array-backed byte buffers. 45 | */ 46 | BufferAllocator
(cause == null ? null : cause.toString())51 | * (which typically contains the class and detail message of {@code cause}). 52 | * 53 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 54 | */ 55 | public ClosedWorkerException(final Throwable cause) { 56 | super(cause); 57 | } 58 | 59 | /** 60 | * Constructs a {@code ClosedWorkerException} with the specified detail message and cause. 61 | * 62 | * @param msg the detail message 63 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 64 | */ 65 | public ClosedWorkerException(final String msg, final Throwable cause) { 66 | super(msg, cause); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/Closer.java: -------------------------------------------------------------------------------- 1 | 2 | package org.xnio; 3 | 4 | import java.io.Closeable; 5 | 6 | /** 7 | * A {@code Runnable} that closes some resource. 8 | * 9 | * @apiviz.exclude 10 | */ 11 | public final class Closer implements Runnable { 12 | private final Closeable resource; 13 | 14 | public Closer(final Closeable resource) { 15 | this.resource = resource; 16 | } 17 | 18 | public void run() { 19 | IoUtils.safeClose(resource); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/CompressionType.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * 4 | * Copyright 2012 Red Hat, Inc. and/or its affiliates. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.xnio; 20 | 21 | /** 22 | * Supported compression types. 23 | * 24 | * @author David M. Lloyd 25 | */ 26 | public enum CompressionType { 27 | /** 28 | * ZLIB compatible compression. 29 | */ 30 | DEFLATE, 31 | /** 32 | * GZIP compatible compression. 33 | */ 34 | GZIP, 35 | ; 36 | } 37 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/DelegatingChannelListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * 4 | * Copyright 2012 Red Hat, Inc. and/or its affiliates, and individual 5 | * contributors as indicated by the @author tags. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package org.xnio; 21 | 22 | import java.nio.channels.Channel; 23 | 24 | /** 25 | * A base class for a channel listener which performs an action and then calls a delegate listener. 26 | * 27 | * @author David M. Lloyd 28 | */ 29 | public abstract class DelegatingChannelListener
(cause == null ? null : cause.toString())52 | * (which typically contains the class and detail message of {@code cause}). 53 | * 54 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 55 | */ 56 | public FixedLengthOverflowException(final Throwable cause) { 57 | super(cause); 58 | } 59 | 60 | /** 61 | * Constructs a {@code FixedLengthOverflowException} with the specified detail message and cause. 62 | * 63 | * @param msg the detail message 64 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 65 | */ 66 | public FixedLengthOverflowException(final String msg, final Throwable cause) { 67 | super(msg, cause); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/channels/FixedLengthUnderflowException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source. 3 | * Copyright 2012 Red Hat, Inc., and individual contributors 4 | * as indicated by the @author tags. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.xnio.channels; 20 | 21 | import java.io.IOException; 22 | 23 | /** 24 | * Exception thrown when a fixed-length write channel is not written to its full length. 25 | * 26 | * @author David M. Lloyd 27 | */ 28 | public class FixedLengthUnderflowException extends IOException { 29 | 30 | private static final long serialVersionUID = 7294784996964683484L; 31 | 32 | /** 33 | * Constructs a {@code UnfinishedWriteException} with no detail message. The cause is not initialized, and may 34 | * subsequently be initialized by a call to {@link #initCause(Throwable) initCause}. 35 | */ 36 | public FixedLengthUnderflowException() { 37 | } 38 | 39 | /** 40 | * Constructs a {@code UnfinishedWriteException} with the specified detail message. The cause is not initialized, 41 | * and may subsequently be initialized by a call to {@link #initCause(Throwable) initCause}. 42 | * 43 | * @param msg the detail message 44 | */ 45 | public FixedLengthUnderflowException(final String msg) { 46 | super(msg); 47 | } 48 | 49 | /** 50 | * Constructs a {@code UnfinishedWriteException} with the specified cause. The detail message is set to: 51 | *
(cause == null ? null : cause.toString())52 | * (which typically contains the class and detail message of {@code cause}). 53 | * 54 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 55 | */ 56 | public FixedLengthUnderflowException(final Throwable cause) { 57 | super(cause); 58 | } 59 | 60 | /** 61 | * Constructs a {@code UnfinishedWriteException} with the specified detail message and cause. 62 | * 63 | * @param msg the detail message 64 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 65 | */ 66 | public FixedLengthUnderflowException(final String msg, final Throwable cause) { 67 | super(msg, cause); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/channels/MessageChannel.java: -------------------------------------------------------------------------------- 1 | 2 | package org.xnio.channels; 3 | 4 | import org.xnio.ChannelListener; 5 | 6 | /** 7 | * A channel that sends and receives whole messages. 8 | */ 9 | public interface MessageChannel extends ReadableMessageChannel, WritableMessageChannel, SuspendableChannel { 10 | 11 | /** {@inheritDoc} */ 12 | ChannelListener.Setter extends MessageChannel> getReadSetter(); 13 | 14 | /** {@inheritDoc} */ 15 | ChannelListener.Setter extends MessageChannel> getCloseSetter(); 16 | 17 | /** {@inheritDoc} */ 18 | ChannelListener.Setter extends MessageChannel> getWriteSetter(); 19 | } 20 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/channels/MultipointMessageChannel.java: -------------------------------------------------------------------------------- 1 | 2 | package org.xnio.channels; 3 | 4 | import org.xnio.ChannelListener; 5 | 6 | /** 7 | * A point-to-multipoint message channel. This type of channel is capable of sending to and receiving from multiple 8 | * peer endpoints; as such, the incoming and outgoing messages are each associated with a peer address. 9 | */ 10 | public interface MultipointMessageChannel extends ReadableMultipointMessageChannel, WritableMultipointMessageChannel, SuspendableChannel { 11 | 12 | /** {@inheritDoc} */ 13 | ChannelListener.Setter extends MultipointMessageChannel> getReadSetter(); 14 | 15 | /** {@inheritDoc} */ 16 | ChannelListener.Setter extends MultipointMessageChannel> getCloseSetter(); 17 | 18 | /** {@inheritDoc} */ 19 | ChannelListener.Setter extends MultipointMessageChannel> getWriteSetter(); 20 | } 21 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/channels/ProtectedWrappedChannel.java: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * JBoss, Home of Professional Open Source 4 | * 5 | * Copyright 2012 Red Hat, Inc. and/or its affiliates. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package org.xnio.channels; 21 | 22 | import java.nio.channels.Channel; 23 | 24 | /** 25 | * A protected, wrapped channel. A guard object is required to gain access to the underlying channel. 26 | * 27 | * @param
(cause == null ? null : cause.toString())50 | * (which typically contains the class and detail message of {@code cause}). 51 | * 52 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 53 | */ 54 | public ReadTimeoutException(final Throwable cause) { 55 | initCause(cause); 56 | } 57 | 58 | /** 59 | * Constructs a {@code ReadTimeoutException} with the specified detail message and cause. 60 | * 61 | * @param msg the detail message 62 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 63 | */ 64 | public ReadTimeoutException(final String msg, final Throwable cause) { 65 | super(msg); 66 | initCause(cause); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/channels/ReadableMessageChannel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * 4 | * Copyright 2008 Red Hat, Inc. and/or its affiliates. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.xnio.channels; 20 | 21 | import java.io.IOException; 22 | import java.nio.ByteBuffer; 23 | import org.xnio.ChannelListener; 24 | 25 | /** 26 | * A channel that can receive messages. Such a channel receives whole messages only. 27 | */ 28 | public interface ReadableMessageChannel extends SuspendableReadChannel, Configurable { 29 | /** 30 | * Receive a message. 31 | * 32 | * @param buffer the buffer that will hold the message 33 | * @return the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition 34 | * @throws IOException if an I/O error occurs 35 | */ 36 | int receive(ByteBuffer buffer) throws IOException; 37 | 38 | /** 39 | * Receive a message. 40 | * 41 | * @param buffers the buffers that will hold the message 42 | * @return the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition 43 | * @throws IOException if an I/O error occurs 44 | */ 45 | long receive(ByteBuffer[] buffers) throws IOException; 46 | 47 | /** 48 | * Receive a message. 49 | * 50 | * @param buffers the buffers that will hold the message 51 | * @param offs the offset into the array of buffers of the first buffer to read into 52 | * @param len the number of buffers to fill 53 | * @return the size of the received message, 0 if no message is available, and -1 if the message channel has reached an end-of-file condition 54 | * @throws IOException if an I/O error occurs 55 | */ 56 | long receive(ByteBuffer[] buffers, int offs, int len) throws IOException; 57 | 58 | /** {@inheritDoc} */ 59 | ChannelListener.Setter extends ReadableMessageChannel> getReadSetter(); 60 | 61 | /** {@inheritDoc} */ 62 | ChannelListener.Setter extends ReadableMessageChannel> getCloseSetter(); 63 | } 64 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/channels/SimpleAcceptingChannel.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * 4 | * Copyright 2011 Red Hat, Inc. and/or its affiliates, and individual 5 | * contributors as indicated by the @author tags. 6 | * 7 | * Licensed under the Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance with the License. 9 | * You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, software 14 | * distributed under the License is distributed on an "AS IS" BASIS, 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and 17 | * limitations under the License. 18 | */ 19 | 20 | package org.xnio.channels; 21 | 22 | import java.io.IOException; 23 | import org.xnio.ChannelListener; 24 | 25 | /** 26 | * A channel which can accept connections. 27 | * 28 | * @param
(cause == null ? null : cause.toString())50 | * (which typically contains the class and detail message of {@code cause}). 51 | * 52 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 53 | */ 54 | public WriteTimeoutException(final Throwable cause) { 55 | initCause(cause); 56 | } 57 | 58 | /** 59 | * Constructs a {@code WriteTimeoutException} with the specified detail message and cause. 60 | * 61 | * @param msg the detail message 62 | * @param cause the cause (which is saved for later retrieval by the {@link #getCause()} method) 63 | */ 64 | public WriteTimeoutException(final String msg, final Throwable cause) { 65 | super(msg); 66 | initCause(cause); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/channels/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * The core XNIO channel API. 3 | */ 4 | package org.xnio.channels; 5 | -------------------------------------------------------------------------------- /api/src/main/java/org/xnio/conduits/AbstractConduit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * JBoss, Home of Professional Open Source 3 | * 4 | * Copyright 2013 Red Hat, Inc. and/or its affiliates. 5 | * 6 | * Licensed under the Apache License, Version 2.0 (the "License"); 7 | * you may not use this file except in compliance with the License. 8 | * You may obtain a copy of the License at 9 | * 10 | * http://www.apache.org/licenses/LICENSE-2.0 11 | * 12 | * Unless required by applicable law or agreed to in writing, software 13 | * distributed under the License is distributed on an "AS IS" BASIS, 14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | * See the License for the specific language governing permissions and 16 | * limitations under the License. 17 | */ 18 | 19 | package org.xnio.conduits; 20 | 21 | import static org.xnio._private.Messages.msg; 22 | 23 | import org.xnio.XnioWorker; 24 | 25 | /** 26 | * An abstract base class for filtering conduits. 27 | * 28 | * @author David M. Lloyd 29 | */ 30 | public abstract class AbstractConduit
5 | * In addition to interfaces that are used and implemented by users of XNIO, this package contains several utility
6 | * classes which, while not required to write an XNIO application, simplify boilerplate tasks associated with low-level
7 | * I/O operations.
8 | */
9 |
10 | package org.xnio;
11 |
--------------------------------------------------------------------------------
/api/src/main/java/org/xnio/sasl/SaslQop.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source
3 | *
4 | * Copyright 2009 Red Hat, Inc. and/or its affiliates.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package org.xnio.sasl;
20 |
21 | import static org.xnio._private.Messages.msg;
22 |
23 | import javax.security.sasl.Sasl;
24 |
25 | /**
26 | * The SASL quality-of-protection value.
27 | *
28 | * @see Sasl#QOP
29 | */
30 | public enum SaslQop {
31 |
32 | /**
33 | * A QOP value specifying authentication only.
34 | */
35 | AUTH("auth"),
36 | /**
37 | * A QOP value specifying authentication plus integrity protection.
38 | */
39 | AUTH_INT("auth-int"),
40 | /**
41 | * A QOP value specifying authentication plus integrity and confidentiality protection.
42 | */
43 | AUTH_CONF("auth-conf"),
44 | ;
45 |
46 | private final String s;
47 |
48 | SaslQop(String s) {
49 | this.s = s;
50 | }
51 |
52 | /**
53 | * Get the SASL QOP level for the given string.
54 | *
55 | * @param name the QOP level
56 | * @return the QOP value
57 | */
58 | public static SaslQop fromString(String name) {
59 | if ("auth".equals(name)) {
60 | return AUTH;
61 | } else if ("auth-int".equals(name)) {
62 | return AUTH_INT;
63 | } else if ("auth-conf".equals(name)) {
64 | return AUTH_CONF;
65 | } else {
66 | throw msg.invalidQop(name);
67 | }
68 | }
69 |
70 | /**
71 | * Get the string representation of this SASL QOP value.
72 | *
73 | * @return the string representation
74 | */
75 | public String getString() {
76 | return s;
77 | }
78 |
79 | /**
80 | * Get the human-readable string representation of this SASL QOP value.
81 | *
82 | * @return the string representation
83 | */
84 | public String toString() {
85 | return s;
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/api/src/main/java/org/xnio/sasl/SaslStrength.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source
3 | *
4 | * Copyright 2009 Red Hat, Inc. and/or its affiliates.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package org.xnio.sasl;
20 |
21 | /**
22 | * The SASL cipher strength value.
23 | *
24 | * @see javax.security.sasl.Sasl#STRENGTH
25 | */
26 | public enum SaslStrength {
27 |
28 | /**
29 | * Specify low cipher strength.
30 | */
31 | LOW,
32 | /**
33 | * Specify medium cipher strength.
34 | */
35 | MEDIUM,
36 | /**
37 | * Specify high cipher strength.
38 | */
39 | HIGH,
40 | }
41 |
--------------------------------------------------------------------------------
/api/src/main/java/org/xnio/sasl/package-info.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Utility classes for using SASL mechanisms atop NIO or XNIO APIs.
3 | */
4 | package org.xnio.sasl;
5 |
--------------------------------------------------------------------------------
/api/src/main/java/org/xnio/ssl/JsseAcceptingSslStreamConnection.java:
--------------------------------------------------------------------------------
1 | /*
2 | * JBoss, Home of Professional Open Source
3 | *
4 | * Copyright 2013 Red Hat, Inc. and/or its affiliates.
5 | *
6 | * Licensed under the Apache License, Version 2.0 (the "License");
7 | * you may not use this file except in compliance with the License.
8 | * You may obtain a copy of the License at
9 | *
10 | * http://www.apache.org/licenses/LICENSE-2.0
11 | *
12 | * Unless required by applicable law or agreed to in writing, software
13 | * distributed under the License is distributed on an "AS IS" BASIS,
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | * See the License for the specific language governing permissions and
16 | * limitations under the License.
17 | */
18 |
19 | package org.xnio.ssl;
20 |
21 | import java.nio.ByteBuffer;
22 |
23 | import javax.net.ssl.SSLContext;
24 | import javax.net.ssl.SSLEngine;
25 |
26 | import org.xnio.OptionMap;
27 | import org.xnio.Pool;
28 | import org.xnio.StreamConnection;
29 | import org.xnio.channels.AcceptingChannel;
30 |
31 | /**
32 | * Accepting channel for StreamConnections with SSL.
33 | *
34 | * @author Flavia Rainone
35 | *
36 | */
37 | final class JsseAcceptingSslStreamConnection extends AbstractAcceptingSslChannel