vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/Launcher.java
branchlauncher
changeset 372 3485327d3080
parent 371 bafc670aa10d
child 374 e5b4bd29f268
     1.1 --- a/vmtest/src/main/java/org/apidesign/bck2brwsr/vmtest/Launcher.java	Sun Dec 23 18:24:18 2012 +0100
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,71 +0,0 @@
     1.4 -/**
     1.5 - * Back 2 Browser Bytecode Translator
     1.6 - * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
     1.7 - *
     1.8 - * This program is free software: you can redistribute it and/or modify
     1.9 - * it under the terms of the GNU General Public License as published by
    1.10 - * the Free Software Foundation, version 2 of the License.
    1.11 - *
    1.12 - * This program is distributed in the hope that it will be useful,
    1.13 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.14 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.15 - * GNU General Public License for more details.
    1.16 - *
    1.17 - * You should have received a copy of the GNU General Public License
    1.18 - * along with this program. Look for COPYING file in the top folder.
    1.19 - * If not, see http://opensource.org/licenses/GPL-2.0.
    1.20 - */
    1.21 -package org.apidesign.bck2brwsr.vmtest;
    1.22 -
    1.23 -import java.io.IOException;
    1.24 -import org.apidesign.bck2brwsr.launcher.Bck2BrwsrLauncher;
    1.25 -import org.apidesign.bck2brwsr.launcher.JSLauncher;
    1.26 -import org.apidesign.bck2brwsr.launcher.MethodInvocation;
    1.27 -
    1.28 -/**
    1.29 - *
    1.30 - * @author Jaroslav Tulach <jtulach@netbeans.org>
    1.31 - */
    1.32 -final class Launcher {
    1.33 -    private final String sen;
    1.34 -    private Object launcher;
    1.35 -    
    1.36 -    Launcher() {
    1.37 -        this(null);
    1.38 -    }
    1.39 -    Launcher(String sen) {
    1.40 -        this.sen = sen;
    1.41 -    }
    1.42 -
    1.43 -    synchronized Object clear() {
    1.44 -        Object l = launcher;
    1.45 -        launcher = null;
    1.46 -        return l;
    1.47 -    }
    1.48 -
    1.49 -    synchronized MethodInvocation addMethod(Class<?> clazz, String name) throws IOException {
    1.50 -        if (launcher == null) {
    1.51 -            if (sen != null) {
    1.52 -                JSLauncher js = new JSLauncher();
    1.53 -                js.addClassLoader(clazz.getClassLoader());
    1.54 -                js.initialize();
    1.55 -                launcher = js;
    1.56 -            } else {
    1.57 -                Bck2BrwsrLauncher l = new Bck2BrwsrLauncher();
    1.58 -                l.initialize();
    1.59 -                l.setTimeout(180000);
    1.60 -                launcher = l;
    1.61 -            }
    1.62 -        }
    1.63 -        if (launcher instanceof JSLauncher) {
    1.64 -            return ((JSLauncher)launcher).addMethod(clazz, name);
    1.65 -        } else {
    1.66 -            return ((Bck2BrwsrLauncher)launcher).addMethod(clazz, name);
    1.67 -        }
    1.68 -    }
    1.69 -
    1.70 -    void exec() throws Exception {
    1.71 -        Object l = clear();
    1.72 -    }
    1.73 -    
    1.74 -}