Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
AnalyzerBeans Copyright (C) 2014 Neopost - Customer Information Management This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions of the GNU Lesser General Public License, as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this distribution; if not, write to: Free Software Foundation, Inc. 51 Franklin Street, Fifth Floor Boston, MA 02110-1301 USA
 
 package org.eobjects.analyzer.cluster;
 
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
 
 public class LazyRefAnalysisResultFuture implements AnalysisResultFuture {
 
     private final LazyRef<AnalysisResult_resultRef;
     private final List<Throwable_errors;
 
     public LazyRefAnalysisResultFuture(LazyRef<AnalysisResultresultRefList<Throwableerrors) {
          = resultRef;
          = errors;
     }
 
     @Override
     public boolean isErrornous() {
         return getStatus() == .;
     }
 
     @Override
     public boolean isCancelled() {
         return false;
     }
 
     @Override
     public Date getCreationDate() {
         AnalysisResult analysisResult = .get();
         if (analysisResult == null) {
             return null;
         }
         return analysisResult.getCreationDate();
     }
 
     @Override
     public boolean isDone() {
         return .isFetched();
     }
 
     @Override
     public void await() {
         .get();
     }
 
     @Override
     public void cancel() {
         throw new UnsupportedOperationException("Cancel not supported for slave jobs");
     }
 
     @Override
     public void await(long timeoutTimeUnit timeUnit) {
         final long offsetMillis = System.currentTimeMillis();
 
         final long millisToWait = timeUnit.convert(timeout.);
 
         final long sleepInterval = (millisToWait % 1000 == 0 ? 1000 : 500);
 
         while (!isDone()) {
             try {
                 Thread.sleep(sleepInterval);
             } catch (InterruptedException e) {
                 // do nothing
             }
 
             final long currentMillis = System.currentTimeMillis();
            final long duration = currentMillis - offsetMillis;
            if (duration >= millisToWait) {
                return;
            }
        }
    }
    @Override
    public boolean isSuccessful() {
        return getStatus() == .;
    }
    @Override
    public JobStatus getStatus() {
        if (!.isFetched()) {
            return .;
        }
        if (.isEmpty()) {
            return .;
        }
        return .;
    }
    @Override
        AnalysisResult analysisResult = .get();
        if (analysisResult == null) {
            return null;
        }
        return analysisResult.getResults();
    }
    @Override
    public AnalyzerResult getResult(ComponentJob componentJobthrows AnalysisJobFailedException {
        AnalysisResult analysisResult = .get();
        if (analysisResult == null) {
            return null;
        }
        return .get().getResult(componentJob);
    }
    @Override
        AnalysisResult analysisResult = .get();
        if (analysisResult == null) {
            return null;
        }
        return .get().getResultMap();
    }
    @Override
    public List<ThrowablegetErrors() {
        return Collections.unmodifiableList();
    }
    @Override
    public <R extends AnalyzerResultList<? extends R> getResults(Class<R> resultClass) {
        return .get().getResults(resultClass);
    }
New to GrepCode? Check out our FAQ X