Skip to content

Commit

Permalink
[LOGMGR-234] Remove the NullHandler and FlushableClosable.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamezp committed Dec 14, 2018
1 parent 0d420d7 commit b9b23c9
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 69 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/jboss/logmanager/ExtHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.jboss.logmanager;

import java.io.Flushable;
import java.io.UnsupportedEncodingException;
import java.security.Permission;
import java.util.concurrent.atomic.AtomicReferenceFieldUpdater;
Expand All @@ -31,13 +32,12 @@
import java.util.logging.LoggingPermission;

import org.jboss.logmanager.errormanager.OnlyOnceErrorManager;
import org.jboss.logmanager.handlers.FlushableCloseable;

/**
* An extended logger handler. Use this class as a base class for log handlers which require {@code ExtLogRecord}
* instances.
*/
public abstract class ExtHandler extends Handler implements FlushableCloseable {
public abstract class ExtHandler extends Handler implements AutoCloseable, Flushable {

private static final Permission CONTROL_PERMISSION = new LoggingPermission("control", null);
private volatile boolean autoFlush = true;
Expand Down

This file was deleted.

28 changes: 0 additions & 28 deletions core/src/main/java/org/jboss/logmanager/handlers/NullHandler.java

This file was deleted.

3 changes: 1 addition & 2 deletions core/src/test/java/org/jboss/logmanager/HandlerTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import static org.junit.Assert.*;
import org.jboss.logmanager.handlers.WriterHandler;
import org.jboss.logmanager.handlers.OutputStreamHandler;
import org.jboss.logmanager.handlers.NullHandler;
import org.jboss.logmanager.handlers.FileHandler;
import org.jboss.logmanager.formatters.PatternFormatter;

Expand All @@ -43,7 +42,7 @@ public final class HandlerTests {

@Test
public void testNullHandler() throws Throwable {
final NullHandler handler = new NullHandler();
final ExtHandler handler = new ExtHandler(){};
handler.setLevel(Level.ALL);
handler.publish(new ExtLogRecord(Level.INFO, "Test message", null));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,20 @@

package org.jboss.logmanager.ext.handlers;

import java.io.Flushable;
import java.io.IOException;
import java.net.InetAddress;
import javax.net.SocketFactory;
import javax.net.ssl.SSLSocketFactory;

import org.jboss.logmanager.handlers.FlushableCloseable;

/**
* An output stream that writes data to a {@link java.net.Socket socket}. Uses {@link
* SSLSocketFactory#getDefault()} to create the socket.
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@SuppressWarnings({"unused", "WeakerAccess"})
public class SslTcpOutputStream extends TcpOutputStream implements FlushableCloseable {
public class SslTcpOutputStream extends TcpOutputStream implements AutoCloseable, Flushable {

/**
* Creates a SSL TCP output stream.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package org.jboss.logmanager.ext.handlers;

import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetAddress;
Expand All @@ -34,8 +35,6 @@
import java.util.concurrent.TimeUnit;
import javax.net.SocketFactory;

import org.jboss.logmanager.handlers.FlushableCloseable;

/**
* An output stream that writes data to a {@link Socket socket}.
* <p/>
Expand All @@ -49,7 +48,7 @@
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@SuppressWarnings({"unused", "WeakerAccess"})
public class TcpOutputStream extends OutputStream implements FlushableCloseable {
public class TcpOutputStream extends OutputStream implements AutoCloseable, Flushable {
private static final long retryTimeout = 5L;
private static final long maxRetryTimeout = 40L;
private static final int maxErrors = 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

package org.jboss.logmanager.ext.handlers;

import java.io.Flushable;
import java.io.IOException;
import java.io.OutputStream;
import java.net.DatagramPacket;
Expand All @@ -27,15 +28,13 @@
import java.net.SocketAddress;
import java.net.SocketException;

import org.jboss.logmanager.handlers.FlushableCloseable;

/**
* An output stream that writes data to a {@link DatagramSocket DatagramSocket}.
*
* @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
*/
@SuppressWarnings("WeakerAccess")
public class UdpOutputStream extends OutputStream implements FlushableCloseable {
public class UdpOutputStream extends OutputStream implements AutoCloseable, Flushable {
private final DatagramSocket socket;
private final SocketAddress socketAddress;

Expand Down

0 comments on commit b9b23c9

Please sign in to comment.