Cleanup.
This commit is contained in:
parent
259f90c86c
commit
7e8f49edbb
|
@ -12,9 +12,8 @@ repositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile 'info.picocli:picocli:4.5.2'
|
|
||||||
annotationProcessor 'info.picocli:picocli-codegen:4.5.2'
|
annotationProcessor 'info.picocli:picocli-codegen:4.5.2'
|
||||||
|
implementation 'info.picocli:picocli:4.5.2'
|
||||||
implementation 'org.slf4j:slf4j-api:1.7.+'
|
implementation 'org.slf4j:slf4j-api:1.7.+'
|
||||||
runtimeOnly 'ch.qos.logback:logback-classic:1.+'
|
runtimeOnly 'ch.qos.logback:logback-classic:1.+'
|
||||||
|
|
||||||
|
@ -23,7 +22,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClassName = 'biz.nellemann.syslogd.SyslogServer'
|
mainClassName = 'biz.nellemann.syslogd.Application'
|
||||||
}
|
}
|
||||||
|
|
||||||
test {
|
test {
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
id = syslogd
|
id = syslogd
|
||||||
group = biz.nellemann.syslogd
|
group = biz.nellemann.syslogd
|
||||||
version = 1.0.5
|
version = 1.0.6
|
||||||
|
|
|
@ -27,9 +27,9 @@ import java.util.concurrent.Callable;
|
||||||
mixinStandardHelpOptions = true,
|
mixinStandardHelpOptions = true,
|
||||||
description = "Basic syslog server.",
|
description = "Basic syslog server.",
|
||||||
versionProvider = biz.nellemann.syslogd.VersionProvider.class)
|
versionProvider = biz.nellemann.syslogd.VersionProvider.class)
|
||||||
public class SyslogServer implements Callable<Integer>, LogListener {
|
public class Application implements Callable<Integer>, LogListener {
|
||||||
|
|
||||||
private final static Logger log = LoggerFactory.getLogger(SyslogServer.class);
|
private final static Logger log = LoggerFactory.getLogger(Application.class);
|
||||||
|
|
||||||
@CommandLine.Option(names = {"-p", "--port"}, description = "Listening port [default: 514].")
|
@CommandLine.Option(names = {"-p", "--port"}, description = "Listening port [default: 514].")
|
||||||
private int port = 514;
|
private int port = 514;
|
||||||
|
@ -48,7 +48,7 @@ public class SyslogServer implements Callable<Integer>, LogListener {
|
||||||
|
|
||||||
|
|
||||||
public static void main(String... args) {
|
public static void main(String... args) {
|
||||||
int exitCode = new CommandLine(new SyslogServer()).execute(args);
|
int exitCode = new CommandLine(new Application()).execute(args);
|
||||||
System.exit(exitCode);
|
System.exit(exitCode);
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,9 +100,8 @@ public class TcpServer {
|
||||||
|
|
||||||
private synchronized void sendEvent(String message) {
|
private synchronized void sendEvent(String message) {
|
||||||
LogEvent event = new LogEvent( this, message );
|
LogEvent event = new LogEvent( this, message );
|
||||||
Iterator<LogListener> listeners = eventListeners.iterator();
|
for (LogListener eventListener : eventListeners) {
|
||||||
while( listeners.hasNext() ) {
|
eventListener.onLogEvent(event);
|
||||||
listeners.next().onLogEvent( event );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@ import java.net.DatagramPacket;
|
||||||
import java.net.DatagramSocket;
|
import java.net.DatagramSocket;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class UdpServer extends Thread {
|
public class UdpServer extends Thread {
|
||||||
|
@ -57,9 +56,8 @@ public class UdpServer extends Thread {
|
||||||
|
|
||||||
private synchronized void sendEvent(String message) {
|
private synchronized void sendEvent(String message) {
|
||||||
LogEvent event = new LogEvent( this, message);
|
LogEvent event = new LogEvent( this, message);
|
||||||
Iterator<LogListener> listeners = eventListeners.iterator();
|
for (LogListener eventListener : eventListeners) {
|
||||||
while( listeners.hasNext() ) {
|
eventListener.onLogEvent(event);
|
||||||
listeners.next().onLogEvent( event );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue