Skip to content

Commit

Permalink
Deprecated NIO flavor of Restlet API
Browse files Browse the repository at this point in the history
      - Deprecated NIO flavor of Restlet API for removal in next major release, with plan to use
        virtual threads instead to achieve additional scalability and reactive behavior.
  • Loading branch information
jlouvel committed Oct 28, 2024
1 parent 42d09a7 commit 5e50013
Show file tree
Hide file tree
Showing 34 changed files with 94 additions and 0 deletions.
2 changes: 2 additions & 0 deletions changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Changes log
- Renamed extension Inject into Guice as it isn't truly generic.
- Updated the links in all Javadocs file for accuracy.
- Deprecated GAE, GWT, OSGi and RDF extensions for removal in next major release.
- Deprecated NIO flavor of Restlet API for removal in next major release, with plan to use
virtual threads instead to achieve additional scalability and reactive behavior.

- 2.5 Milestone 1 (03/09/2020)
- Bugs fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ public String getReasonPhrase() {
}

@Override
@Deprecated
public WritableByteChannel getRequestEntityChannel() {
return null;
}
Expand All @@ -180,6 +181,7 @@ public OutputStream getRequestHeadStream() {
}

@Override
@Deprecated
public ReadableByteChannel getResponseEntityChannel(long size) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ public String getReasonPhrase() {
return httpResponse == null ? null : httpResponse.getReason();
}

@Deprecated
public WritableByteChannel getRequestEntityChannel() {
return null;
}
Expand All @@ -148,6 +149,7 @@ public OutputStream getRequestHeadStream() {
return null;
}

@Deprecated
public ReadableByteChannel getResponseEntityChannel(long size) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,9 @@ protected Representation getRepresentation(InputStream stream) {
*
* @param channel The response channel.
* @return The wrapping representation.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
protected Representation getRepresentation(java.nio.channels.ReadableByteChannel channel) {
return new org.restlet.representation.ReadableRepresentation(channel, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ public HttpClientHelper getHelper() {
* Returns the request entity channel if it exists.
*
* @return The request entity channel if it exists.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public abstract java.nio.channels.WritableByteChannel getRequestEntityChannel();

/**
Expand Down Expand Up @@ -165,7 +167,9 @@ public Representation getResponseEntity(Response response) {
*
* @param size The expected entity size or -1 if unknown.
* @return The response channel if it exists.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public abstract java.nio.channels.ReadableByteChannel getResponseEntityChannel(long size);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public long getAvailableSize() {
* instance of FileChannel is returned.
*
* @return A readable byte channel.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
@Override
public ReadableByteChannel getChannel() throws IOException {
if (isDecoding()) {
Expand Down Expand Up @@ -227,7 +229,9 @@ public void write(OutputStream outputStream) throws IOException {
* Writes the representation to a byte channel.
*
* @param writableChannel A writable byte channel.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
@Override
public void write(WritableByteChannel writableChannel) throws IOException {
if (isDecoding()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ public long getAvailableSize() {
* instance of FileChannel is returned.
*
* @return A readable byte channel.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
@Override
public ReadableByteChannel getChannel() throws IOException {
if (canEncode()) {
Expand Down Expand Up @@ -270,6 +272,7 @@ public void write(OutputStream outputStream) throws IOException {
}
}

@Deprecated
@Override
public void write(WritableByteChannel writableChannel) throws IOException {
if (canEncode()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public long getAvailableSize() {
}

@Override
@Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
Expand Down Expand Up @@ -117,6 +118,7 @@ public void write(OutputStream outputStream) throws IOException {
}

@Override
@Deprecated
public void write(WritableByteChannel writableChannel) throws IOException {
OutputStream os = IoUtils.getStream(writableChannel);
write(os);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ protected Representation getRepresentation(InputStream stream) {
}

@Override
@Deprecated
public WritableByteChannel getRequestEntityChannel() {
return null;
}
Expand Down Expand Up @@ -171,6 +172,7 @@ public OutputStream getRequestStream() {
}

@Override
@Deprecated
public ReadableByteChannel getResponseEntityChannel(long size) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
* NIO channel that can indicate if it is blocking or non blocking.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public interface BlockableChannel extends Channel {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
* Readable byte channel wrapping an input stream.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public class InputStreamChannel implements ReadableByteChannel, BlockableChannel {

/** The underlying input stream. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public static void copy(InputStream inputStream, java.io.RandomAccessFile random
* @param readableChannel The readable channel.
* @param writableChannel The writable channel.
* @throws IOException
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public static void copy(ReadableByteChannel readableChannel, WritableByteChannel writableChannel)
throws IOException {
if ((readableChannel != null) && (writableChannel != null)) {
Expand Down Expand Up @@ -276,7 +278,9 @@ public static long getAvailableSize(Representation representation) {
*
* @param inputStream The input stream to convert.
* @return A readable byte channel.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public static ReadableByteChannel getChannel(InputStream inputStream) throws IOException {
ReadableByteChannel result = null;

Expand All @@ -294,7 +298,9 @@ public static ReadableByteChannel getChannel(InputStream inputStream) throws IOE
*
* @param outputStream The output stream.
* @return A writable byte channel.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public static WritableByteChannel getChannel(OutputStream outputStream) {
return (outputStream != null) ? Channels.newChannel(outputStream) : null;
}
Expand All @@ -308,7 +314,9 @@ public static WritableByteChannel getChannel(OutputStream outputStream) {
* from.
* @return A readable byte channel.
* @throws IOException
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public static ReadableByteChannel getChannel(final Representation representation) throws IOException {
ReadableByteChannel result = null;

Expand Down Expand Up @@ -443,7 +451,9 @@ public static java.io.OutputStream getStream(java.io.Writer writer, CharacterSet
*
* @param readableChannel The readable byte channel.
* @return An input stream based on a given readable byte channel.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public static InputStream getStream(ReadableByteChannel readableChannel) {
InputStream result = null;

Expand Down Expand Up @@ -531,7 +541,9 @@ public void run() {
*
* @param writableChannel The writable byte channel.
* @return An output stream based on a given writable byte channel.
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public static OutputStream getStream(WritableByteChannel writableChannel) {
OutputStream result = null;

Expand Down Expand Up @@ -613,7 +625,9 @@ public static boolean isBlocking(Channel channel) {
* @param selector The associated selector.
* @param selectionKey The used selection key.
* @throws IOException
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public static void release(Selector selector, SelectionKey selectionKey) throws IOException {
if (selectionKey != null) {
// The key you registered on the temporary selector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
* Input stream connected to a non-blocking readable channel.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public class NbChannelInputStream extends InputStream {

/** The internal byte buffer. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
* Output stream connected to a non-blocking writable channel.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public class NbChannelOutputStream extends OutputStream {

/** The internal byte buffer. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
* Readable byte channel that is based on a selectable channel.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public interface ReadableSelectionChannel extends SelectionChannel, ReadableByteChannel {

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* NIO channel that is based on a selectable channel.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public interface SelectionChannel extends Channel, BlockableChannel {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
* Factory used to dispatch/share <code>Selector</code>.
*
* @author Jean-Francois Arcand
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public class SelectorFactory {
/** The maximum number of <code>Selector</code> to create. */
public static final int MAX_SELECTORS = 20;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
* Callback interface when a NIO selection occurs on the selectable object.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public interface WakeupListener {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ protected byte[] getBuffer() {
}

@Override
@Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
Expand Down Expand Up @@ -172,6 +173,7 @@ public void write(OutputStream outputStream) throws IOException {
}

@Override
@Deprecated
public void write(WritableByteChannel writableChannel) throws IOException {
buffer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
* Representation based on a NIO byte channel.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public abstract class ChannelRepresentation extends Representation {
/**
* Constructor.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public CharacterRepresentation(MediaType mediaType) {
}

@Override
@Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
Expand All @@ -52,6 +53,7 @@ public void write(OutputStream outputStream) throws IOException {
}

@Override
@Deprecated
public void write(java.nio.channels.WritableByteChannel writableChannel) throws IOException {
OutputStream os = IoUtils.getStream(writableChannel);
write(os);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ public long exhaust() throws IOException {
}

@Override
@Deprecated
public ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(getStream());
}
Expand Down Expand Up @@ -245,6 +246,7 @@ public void write(OutputStream outputStream) throws IOException {
}

@Override
@Deprecated
public void write(WritableByteChannel writableChannel) throws IOException {
OutputStream os = IoUtils.getStream(writableChannel);
write(os);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public EmptyRepresentation() {
}

@Override
@Deprecated
public java.nio.channels.ReadableByteChannel getChannel() throws IOException {
return null;
}
Expand All @@ -58,6 +59,7 @@ public void write(java.io.Writer writer) throws IOException {
}

@Override
@Deprecated
public void write(java.nio.channels.WritableByteChannel writableChannel) throws IOException {
// Do nothing
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public FileRepresentation(String path, MediaType mediaType, int timeToLive) {
* @return A readable byte channel.
*/
@Override
@Deprecated
public FileChannel getChannel() throws IOException {
try {
return new FileInputStream(this.file).getChannel();
Expand Down Expand Up @@ -238,6 +239,7 @@ public void write(OutputStream outputStream) throws IOException {
* @param writableChannel A writable byte channel.
*/
@Override
@Deprecated
public void write(WritableByteChannel writableChannel) throws IOException {
IoUtils.copy(getChannel(), writableChannel);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public OutputRepresentation(MediaType mediaType, long expectedSize) {
}

@Override
@Deprecated
public ReadableByteChannel getChannel() throws IOException {
return IoUtils.getChannel(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
* Transient representation based on a readable NIO byte channel.
*
* @author Jerome Louvel
* @deprecated NIO will be removed in next major release.
*/
@Deprecated
public class ReadableRepresentation extends ChannelRepresentation {

/** The representation's input stream. */
Expand Down
Loading

0 comments on commit 5e50013

Please sign in to comment.