Make AvailableEncoders & AvailableDecoders implement Closable.
Signed-off-by: Lachlan Roberts <lachlan@webtide.com>
This commit is contained in:
parent
ab08d1a1c6
commit
5b13006a59
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.javax.common.decoders;
|
package org.eclipse.jetty.websocket.javax.common.decoders;
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -29,7 +30,7 @@ import org.eclipse.jetty.websocket.core.exception.InvalidSignatureException;
|
||||||
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
|
import org.eclipse.jetty.websocket.core.exception.InvalidWebSocketException;
|
||||||
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
import org.eclipse.jetty.websocket.core.internal.util.ReflectUtils;
|
||||||
|
|
||||||
public class AvailableDecoders implements Iterable<RegisteredDecoder>
|
public class AvailableDecoders implements Iterable<RegisteredDecoder>, Closeable
|
||||||
{
|
{
|
||||||
private final List<RegisteredDecoder> registeredDecoders = new ArrayList<>();
|
private final List<RegisteredDecoder> registeredDecoders = new ArrayList<>();
|
||||||
private final EndpointConfig config;
|
private final EndpointConfig config;
|
||||||
|
@ -208,6 +209,7 @@ public class AvailableDecoders implements Iterable<RegisteredDecoder>
|
||||||
return registeredDecoders.stream();
|
return registeredDecoders.stream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
registeredDecoders.forEach(RegisteredDecoder::destroyInstance);
|
registeredDecoders.forEach(RegisteredDecoder::destroyInstance);
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
package org.eclipse.jetty.websocket.javax.common.encoders;
|
package org.eclipse.jetty.websocket.javax.common.encoders;
|
||||||
|
|
||||||
|
import java.io.Closeable;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
@ -32,7 +33,7 @@ import org.eclipse.jetty.websocket.javax.common.decoders.RegisteredDecoder;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class AvailableEncoders implements Predicate<Class<?>>
|
public class AvailableEncoders implements Predicate<Class<?>>, Closeable
|
||||||
{
|
{
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(RegisteredDecoder.class);
|
private static final Logger LOG = LoggerFactory.getLogger(RegisteredDecoder.class);
|
||||||
|
|
||||||
|
@ -309,6 +310,7 @@ public class AvailableEncoders implements Predicate<Class<?>>
|
||||||
return registeredEncoders.stream().anyMatch(registered -> registered.isType(type));
|
return registeredEncoders.stream().anyMatch(registered -> registered.isType(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void close()
|
public void close()
|
||||||
{
|
{
|
||||||
registeredEncoders.forEach(RegisteredEncoder::destroyInstance);
|
registeredEncoders.forEach(RegisteredEncoder::destroyInstance);
|
||||||
|
|
Loading…
Reference in New Issue