projects
/
xudocci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make class thread-safe.
[xudocci.git]
/
src
/
main
/
java
/
net
/
pterodactylus
/
xdcc
/
data
/
Download.java
diff --git
a/src/main/java/net/pterodactylus/xdcc/data/Download.java
b/src/main/java/net/pterodactylus/xdcc/data/Download.java
index
926adad
..
12b0129
100644
(file)
--- a/
src/main/java/net/pterodactylus/xdcc/data/Download.java
+++ b/
src/main/java/net/pterodactylus/xdcc/data/Download.java
@@
-21,6
+21,8
@@
import static com.google.common.base.Preconditions.checkNotNull;
import java.io.OutputStream;
import java.net.InetAddress;
import java.io.OutputStream;
import java.net.InetAddress;
+import java.util.concurrent.atomic.AtomicLong;
+import java.util.concurrent.atomic.AtomicReference;
import net.pterodactylus.irc.DccReceiver;
import net.pterodactylus.irc.DccReceiver;
@@
-49,19
+51,19
@@
public class Download {
private final Pack pack;
/** The name of the file being downloaded. */
private final Pack pack;
/** The name of the file being downloaded. */
- private
String filename
;
+ private
final AtomicReference<String> filename = new AtomicReference<String>()
;
/** The size of the file being downloaded. */
/** The size of the file being downloaded. */
- private
long filesize
;
+ private
final AtomicLong filesize = new AtomicLong()
;
/** The remote address. */
/** The remote address. */
- private
InetAddress remoteAddress
;
+ private
final AtomicReference<InetAddress> remoteAddress = new AtomicReference<InetAddress>()
;
/** The output stream. */
/** The output stream. */
- private
OutputStream outputStream
;
+ private
final AtomicReference<OutputStream> outputStream = new AtomicReference<OutputStream>()
;
/** The DCC receiver. */
/** The DCC receiver. */
- private
DccReceiver dccReceiver
;
+ private
final AtomicReference<DccReceiver> dccReceiver = new AtomicReference<DccReceiver>()
;
/**
* Creates a new download.
/**
* Creates a new download.
@@
-104,7
+106,7
@@
public class Download {
* @return The full name of the file
*/
public String filename() {
* @return The full name of the file
*/
public String filename() {
- return filename;
+ return filename
.get()
;
}
/**
}
/**
@@
-113,7
+115,7
@@
public class Download {
* @return The size of the file
*/
public long filesize() {
* @return The size of the file
*/
public long filesize() {
- return filesize;
+ return filesize
.get()
;
}
/**
}
/**
@@
-122,7
+124,7
@@
public class Download {
* @return The remote address to download from
*/
public InetAddress remoteAddress() {
* @return The remote address to download from
*/
public InetAddress remoteAddress() {
- return remoteAddress;
+ return remoteAddress
.get()
;
}
/**
}
/**
@@
-131,7
+133,7
@@
public class Download {
* @return The output stream
*/
public OutputStream outputStream() {
* @return The output stream
*/
public OutputStream outputStream() {
- return outputStream;
+ return outputStream
.get()
;
}
/**
}
/**
@@
-140,7
+142,7
@@
public class Download {
* @return The DCC receiver
*/
public DccReceiver dccReceiver() {
* @return The DCC receiver
*/
public DccReceiver dccReceiver() {
- return dccReceiver;
+ return dccReceiver
.get()
;
}
//
}
//
@@
-155,7
+157,7
@@
public class Download {
* @return This download
*/
public Download filename(String filename) {
* @return This download
*/
public Download filename(String filename) {
- this.filename
= filename
;
+ this.filename
.set(filename)
;
return this;
}
return this;
}
@@
-167,7
+169,7
@@
public class Download {
* @return This download
*/
public Download filesize(long filesize) {
* @return This download
*/
public Download filesize(long filesize) {
- this.filesize
= filesize
;
+ this.filesize
.set(filesize)
;
return this;
}
return this;
}
@@
-179,7
+181,7
@@
public class Download {
* @return This download
*/
public Download remoteAddress(InetAddress remoteAddress) {
* @return This download
*/
public Download remoteAddress(InetAddress remoteAddress) {
- this.remoteAddress
= remoteAddress
;
+ this.remoteAddress
.set(remoteAddress)
;
return this;
}
return this;
}
@@
-191,7
+193,7
@@
public class Download {
* @return This download
*/
public Download outputStream(OutputStream outputStream) {
* @return This download
*/
public Download outputStream(OutputStream outputStream) {
- this.outputStream
= outputStream
;
+ this.outputStream
.set(outputStream)
;
return this;
}
return this;
}
@@
-203,7
+205,7
@@
public class Download {
* @return This download
*/
public Download dccReceiver(DccReceiver dccReceiver) {
* @return This download
*/
public Download dccReceiver(DccReceiver dccReceiver) {
- this.dccReceiver
= dccReceiver
;
+ this.dccReceiver
.set(dccReceiver)
;
return this;
}
return this;
}