All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.yamcs.archive.Utils Maven / Gradle / Ivy

There is a newer version: 5.10.9
Show newest version
package org.yamcs.archive;

import java.util.Collection;

import org.yamcs.yarch.Stream;
import org.yamcs.yarch.StreamSubscriber;
import org.yamcs.yarch.TableWriter;
import org.yamcs.yarch.YarchDatabaseInstance;

public class Utils {
    /**
     * close all table writers subscribed to any of the stream in the list
     * 
     * @param ydb
     * @param streamNames
     */
    static public void closeTableWriters(YarchDatabaseInstance ydb, Collection streamNames) {
        for(String streamName: streamNames) {
            Stream s = ydb.getStream(streamName);
            if(s!=null) {
                for(StreamSubscriber ss:s.getSubscribers()) {
                    if(ss instanceof TableWriter) {
                        s.removeSubscriber(ss);
                        ((TableWriter)ss).close();
                    }
                }
            }
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy