git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a7a4dcc
)
Send DAS requests in batches of 20
author
amwaterhouse
<Andrew Waterhouse>
Tue, 3 Oct 2006 09:25:24 +0000
(09:25 +0000)
committer
amwaterhouse
<Andrew Waterhouse>
Tue, 3 Oct 2006 09:25:24 +0000
(09:25 +0000)
src/jalview/io/DasSequenceFeatureFetcher.java
patch
|
blob
|
history
diff --git
a/src/jalview/io/DasSequenceFeatureFetcher.java
b/src/jalview/io/DasSequenceFeatureFetcher.java
index
f78f943
..
b203270
100755
(executable)
--- a/
src/jalview/io/DasSequenceFeatureFetcher.java
+++ b/
src/jalview/io/DasSequenceFeatureFetcher.java
@@
-58,6
+58,7
@@
public class DasSequenceFeatureFetcher implements Runnable
\r
long startTime;
\r
int threadsRunning = 0;
\r
\r
long startTime;
\r
int threadsRunning = 0;
\r
+ boolean allBatchesComplete = false;
\r
\r
\r
/**
\r
\r
\r
/**
\r
@@
-208,7
+209,9
@@
public class DasSequenceFeatureFetcher implements Runnable
return f;
\r
}
\r
catch (Exception e) {
\r
return f;
\r
}
\r
catch (Exception e) {
\r
+ System.out.println("ERRR "+e);
\r
e.printStackTrace();
\r
e.printStackTrace();
\r
+ System.out.println("############");
\r
Cache.log.debug("Failed to parse "+dasfeature.toString(), e);
\r
return null;
\r
}
\r
Cache.log.debug("Failed to parse "+dasfeature.toString(), e);
\r
return null;
\r
}
\r
@@
-308,7
+311,7
@@
public class DasSequenceFeatureFetcher implements Runnable
synchronized void setThreadsRunning(int i)
\r
{
\r
threadsRunning += i;
\r
synchronized void setThreadsRunning(int i)
\r
{
\r
threadsRunning += i;
\r
- if(threadsRunning<1)
\r
+ if(threadsRunning<1 && allBatchesComplete)
\r
{
\r
af.setProgressBar("DAS Feature Fetching Complete", startTime);
\r
\r
{
\r
af.setProgressBar("DAS Feature Fetching Complete", startTime);
\r
\r
@@
-356,9
+359,20
@@
public class DasSequenceFeatureFetcher implements Runnable
\r
try
\r
{
\r
\r
try
\r
{
\r
+ //We must limit the feature fetching to 20 to prevent
\r
+ //Servers being overloaded with too many requests
\r
+ int batchCount = 0;
\r
+ int batchMaxSize = 20;
\r
int seqIndex = 0;
\r
while (seqIndex < sequences.length)
\r
{
\r
int seqIndex = 0;
\r
while (seqIndex < sequences.length)
\r
{
\r
+ batchCount ++;
\r
+ if(batchCount>=batchMaxSize)
\r
+ {
\r
+ waitTillBatchComplete();
\r
+ batchCount = 0;
\r
+ }
\r
+
\r
DBRefEntry [] uprefs = jalview.util.DBRefUtils.selectRefs(sequences[seqIndex].getDBRef(),
\r
new String[] {
\r
jalview.datamodel.DBRefSource.PDB,
\r
DBRefEntry [] uprefs = jalview.util.DBRefUtils.selectRefs(sequences[seqIndex].getDBRef(),
\r
new String[] {
\r
jalview.datamodel.DBRefSource.PDB,
\r
@@
-423,6
+437,22
@@
public class DasSequenceFeatureFetcher implements Runnable
{
\r
ex.printStackTrace();
\r
}
\r
{
\r
ex.printStackTrace();
\r
}
\r
+ allBatchesComplete = true;
\r
+ }
\r
+
\r
+ void waitTillBatchComplete()
\r
+ {
\r
+ while( threadsRunning > 0 )
\r
+ {
\r
+ try{
\r
+ Thread.sleep(1000);
\r
+
\r
+ }catch(Exception ex)
\r
+ {
\r
+ ex.printStackTrace();
\r
+ }
\r
+ }
\r
+
\r
}
\r
\r
\r
}
\r
\r
\r