- public Set<Progress> getChildren() {
- return children.keySet();
+ public List<Progress> getChildren() {
+ synchronized (getLock()) {
+ return new ArrayList<Progress>(children.keySet());
+ }
* @return TRUE if it was found (and removed)
*/
public boolean removeProgressListener(ProgressListener l) {
* @return TRUE if it was found (and removed)
*/
public boolean removeProgressListener(ProgressListener l) {
if (weight < min || weight > max) {
throw new RuntimeException(String.format(
"Progress object %s cannot have a weight of %f, "
if (weight < min || weight > max) {
throw new RuntimeException(String.format(
"Progress object %s cannot have a weight of %f, "
progress.name, weight, name, max));
}
progress.name, weight, name, max));
}
progress.addProgressListener(new ProgressListener() {
@Override
public void progress(Progress pg, String name) {
synchronized (getLock()) {
double total = relativeLocalProgress;
progress.addProgressListener(new ProgressListener() {
@Override
public void progress(Progress pg, String name) {
synchronized (getLock()) {
double total = relativeLocalProgress;
- for (Entry<Progress, Double> entry : children.entrySet()) {
- total += (entry.getValue() / (max - min))
- * entry.getKey().getRelativeProgress();
+ synchronized (getLock()) {
+ for (Entry<Progress, Double> entry : children
+ .entrySet()) {
+ total += (entry.getValue() / (max - min))
+ * entry.getKey().getRelativeProgress();
+ }