Package ch.grengine.source

Examples of ch.grengine.source.SourceSetState


     */
    public void init(final String name, final CompilerFactory compilerFactory, final long latencyMs) {
        this.name = name;
        this.compilerFactory = compilerFactory;
        this.latencyMs = latencyMs;
        state = new SourceSetState(getSourceSetNew());
    }
View Full Code Here


    protected abstract Set<Source> getSourceSetNew();
       
    @Override
    public Set<Source> getSourceSet() {
       
        SourceSetState stateNow = state;
       
        // check both boundaries of the interval to exclude problems with leap seconds etc.
        long diff = System.currentTimeMillis() - stateNow.getLastChecked();
        if (diff >= 0 && diff < latencyMs) {
            return stateNow.getSourceSet();
        }
       
        synchronized(this) {
            // prevent multiple updates
            stateNow = state;
            diff = System.currentTimeMillis() - stateNow.getLastChecked();
            if (diff >= 0 && diff < latencyMs) {
                return stateNow.getSourceSet();
            }
            state = stateNow.update(getSourceSetNew());
            return state.getSourceSet();
        }
    }
View Full Code Here

TOP

Related Classes of ch.grengine.source.SourceSetState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.