From 46e7e9be8257d7d911be0ebfe3ee43221c1f0dac Mon Sep 17 00:00:00 2001 From: zzz <zzz@mail.i2p> Date: Thu, 5 Dec 2013 16:21:36 +0000 Subject: [PATCH] finals --- .../i2p/i2ptunnel/streamr/MultiSource.java | 22 ++----------------- .../src/net/i2p/i2ptunnel/streamr/Pinger.java | 6 +++-- .../i2ptunnel/streamr/StreamrConsumer.java | 18 ++------------- .../i2ptunnel/streamr/StreamrProducer.java | 22 +++---------------- .../net/i2p/i2ptunnel/streamr/Subscriber.java | 19 ++-------------- 5 files changed, 13 insertions(+), 74 deletions(-) diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/MultiSource.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/MultiSource.java index 5c5a08027e..0bb6400ec8 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/MultiSource.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/MultiSource.java @@ -1,8 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - package net.i2p.i2ptunnel.streamr; import java.util.concurrent.CopyOnWriteArrayList; @@ -17,6 +12,7 @@ import net.i2p.i2ptunnel.udp.*; * @author zzz modded for I2PTunnel */ public class MultiSource implements Source, Sink { + public MultiSource() { this.sinks = new CopyOnWriteArrayList<Destination>(); } @@ -45,20 +41,6 @@ public class MultiSource implements Source, Sink { this.sinks.remove(sink); } - - - - - - - - - - - - - - private Sink sink; - private List<Destination> sinks; + private final List<Destination> sinks; } diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/Pinger.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/Pinger.java index 695e0e25af..dd7f5642d4 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/Pinger.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/Pinger.java @@ -7,9 +7,11 @@ import net.i2p.i2ptunnel.udp.*; * @author welterde/zzz */ public class Pinger implements Source, Runnable { + public Pinger() { this.thread = new Thread(this); } + public void setSink(Sink sink) { this.sink = sink; } @@ -53,7 +55,7 @@ public class Pinger implements Source, Runnable { } protected Sink sink; - protected Thread thread; + protected final Thread thread; private final Object waitlock = new Object(); - protected boolean running; + protected volatile boolean running; } diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/StreamrConsumer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/StreamrConsumer.java index 9c1d584ae0..49b314b330 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/StreamrConsumer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/StreamrConsumer.java @@ -1,8 +1,3 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - package net.i2p.i2ptunnel.streamr; import java.net.InetAddress; @@ -52,16 +47,7 @@ public class StreamrConsumer extends I2PTunnelUDPClientBase { this.sink.stop(); return super.close(forced); } - - - - - - - - - - private UDPSink sink; - private Pinger pinger; + private final UDPSink sink; + private final Pinger pinger; } diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/StreamrProducer.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/StreamrProducer.java index 7d6b14491d..cef5bf1d13 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/StreamrProducer.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/StreamrProducer.java @@ -1,14 +1,7 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - package net.i2p.i2ptunnel.streamr; -// system import java.io.File; -// i2p import net.i2p.i2ptunnel.I2PTunnel; import net.i2p.i2ptunnel.Logging; import net.i2p.i2ptunnel.udp.*; @@ -57,17 +50,8 @@ public class StreamrProducer extends I2PTunnelUDPServerBase { this.multi.stop(); return super.close(forced); } - - - - - - - - - - private MultiSource multi; - private UDPSource server; - private Sink subscriber; + private final MultiSource multi; + private final UDPSource server; + private final Sink subscriber; } diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/Subscriber.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/Subscriber.java index 8dfcbb3cb1..300832a2f5 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/Subscriber.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/streamr/Subscriber.java @@ -1,11 +1,5 @@ -/* - * To change this template, choose Tools | Templates - * and open the template in the editor. - */ - package net.i2p.i2ptunnel.streamr; -// system import java.util.Set; import net.i2p.data.Destination; @@ -51,15 +45,6 @@ public class Subscriber implements Sink { } } - - - - - - - - - - private Set<Destination> subscriptions; - private MultiSource multi; + private final Set<Destination> subscriptions; + private final MultiSource multi; } -- GitLab