Permalink
Browse files

patch prevents the cloud client progress bar from going above 100% on…

… retries
  • Loading branch information...
1 parent ce6299a commit ce44924275fd635ea0adc6b8d52db3ea676e0b7e BuzzTroll committed Jul 14, 2010
View
16 service/client/java/source/src/org/globus/workspace/cloud/client/util/CumulusTask.java
@@ -218,6 +218,8 @@ public Socket createSocket(String host,
private InputStream is;
private PrintStream pr;
private CloudProgressPrinter progress;
+ private long where = 0;
+ private long marked = 0;
public CumulusInputStream(
long len,
@@ -245,6 +247,7 @@ public void close()
public void mark(int readlimit)
{
+ marked = where;
this.is.mark(readlimit);
}
@@ -253,12 +256,18 @@ public boolean markSupported()
return this.is.markSupported();
}
+ private void updatePosition(int len)
+ {
+ where += len;
+ progress.updateBytesTransferred(len);
+ }
+
public int read()
throws java.io.IOException
{
int len;
len = this.is.read();
- progress.updateBytesTransferred((long)len);
+ updatePosition(len);
return len;
}
@@ -267,7 +276,7 @@ public int read(byte[] b)
{
int len;
len = this.is.read(b);
- progress.updateBytesTransferred((long)len);
+ updatePosition(len);
return len;
}
@@ -276,13 +285,16 @@ public int read(byte[] b, int off, int len)
{
int lenrc;
lenrc = this.is.read(b, off, len);
+ updatePosition(lenrc);
return lenrc;
}
public void reset()
throws java.io.IOException
{
+ long diff = marked - where;
this.is.reset();
+ updatePosition((int)diff);
}
public long skip(long n)

0 comments on commit ce44924

Please sign in to comment.