FileDocCategorySizeDatePackage
QTSessionCheck.javaAPI DocExample2276Wed Nov 10 12:38:26 GMT 2004com.oreilly.qtjnotebook.ch01

QTSessionCheck

public class QTSessionCheck extends Object

Fields Summary
private Thread
shutdownHook
private static QTSessionCheck
instance
Constructors Summary
private QTSessionCheck()

        super();
        // init
        QTSession.open();
        // create shutdown handler
        shutdownHook = new Thread() {
                public void run() {
                    // QTSession.close();
                    QTSession.exitMovies();
                }
            };
        Runtime.getRuntime().addShutdownHook(shutdownHook);
    
Methods Summary
public static voidcheck()

        // gets instance.  if a new one needs to be created,
        // it calls QTSession.open() and creates a shutdown hook
        // to call QTSession.close()
        getInstance();
    
private static com.oreilly.qtjnotebook.ch01.QTSessionCheckgetInstance()

        if (instance == null)
            instance = new QTSessionCheck();
        return instance;
    
public static voidmain(java.lang.String[] args)

        try {
            QTSessionCheck.check();
            System.exit(0);
        } catch (QTException qte) {
            qte.printStackTrace();
        }