forked from I2P_Developers/i2p.i2p
atomics
This commit is contained in:
@@ -57,8 +57,8 @@ public class Peer implements Comparable<Peer>
|
|||||||
private DataOutputStream dout;
|
private DataOutputStream dout;
|
||||||
|
|
||||||
/** running counters */
|
/** running counters */
|
||||||
private long downloaded;
|
private final AtomicLong downloaded = new AtomicLong();
|
||||||
private long uploaded;
|
private final AtomicLong uploaded = new AtomicLong();
|
||||||
|
|
||||||
// Keeps state for in/out connections. Non-null when the handshake
|
// Keeps state for in/out connections. Non-null when the handshake
|
||||||
// was successful, the connection setup and runs
|
// was successful, the connection setup and runs
|
||||||
@@ -618,7 +618,7 @@ public class Peer implements Comparable<Peer>
|
|||||||
* @since 0.8.4
|
* @since 0.8.4
|
||||||
*/
|
*/
|
||||||
public void downloaded(int size) {
|
public void downloaded(int size) {
|
||||||
downloaded += size;
|
downloaded.addAndGet(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -626,7 +626,7 @@ public class Peer implements Comparable<Peer>
|
|||||||
* @since 0.8.4
|
* @since 0.8.4
|
||||||
*/
|
*/
|
||||||
public void uploaded(int size) {
|
public void uploaded(int size) {
|
||||||
uploaded += size;
|
uploaded.addAndGet(size);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -635,7 +635,7 @@ public class Peer implements Comparable<Peer>
|
|||||||
*/
|
*/
|
||||||
public long getDownloaded()
|
public long getDownloaded()
|
||||||
{
|
{
|
||||||
return downloaded;
|
return downloaded.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -644,7 +644,7 @@ public class Peer implements Comparable<Peer>
|
|||||||
*/
|
*/
|
||||||
public long getUploaded()
|
public long getUploaded()
|
||||||
{
|
{
|
||||||
return uploaded;
|
return uploaded.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -652,8 +652,8 @@ public class Peer implements Comparable<Peer>
|
|||||||
*/
|
*/
|
||||||
public void resetCounters()
|
public void resetCounters()
|
||||||
{
|
{
|
||||||
downloaded = 0;
|
downloaded.set(0);
|
||||||
uploaded = 0;
|
uploaded.set(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getInactiveTime() {
|
public long getInactiveTime() {
|
||||||
|
Reference in New Issue
Block a user