langtools/src/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java
author alundblad
Wed, 13 Aug 2014 14:44:59 +0200
changeset 26098 32588700060b
parent 26088 langtools/src/share/classes/com/sun/tools/sjavac/comp/JavacServiceImpl.java@f479ca655ba1
permissions -rw-r--r--
8048457: Sjavac should not use portfiles, sockets, etc if background=false 8044131: Restructure client / server protocol code Summary: Changes protocol code to use Object input/output streams. Avoids spawning server if background=false. Refactors idleness checks, pooling and port file monitoring. Reviewed-by: jjg, jfranck
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
25605
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     1
/*
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     2
 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     4
 *
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    10
 *
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    15
 * accompanied this code).
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    16
 *
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    20
 *
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    23
 * questions.
c2d72342fe19 8050408: A few new Java src files for sjavac are missing copyright notices
jjg
parents: 25299
diff changeset
    24
 */
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    25
package com.sun.tools.sjavac.comp;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    26
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    27
import java.io.File;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    28
import java.io.PrintWriter;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    29
import java.io.StringWriter;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    30
import java.net.URI;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    31
import java.util.Arrays;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    32
import java.util.List;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    33
import java.util.Set;
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    34
import java.util.concurrent.atomic.AtomicBoolean;
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    35
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    36
import javax.tools.JavaCompiler.CompilationTask;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    37
import javax.tools.JavaFileObject;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    38
import javax.tools.StandardJavaFileManager;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    39
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    40
import com.sun.tools.javac.api.JavacTaskImpl;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    41
import com.sun.tools.javac.api.JavacTool;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    42
import com.sun.tools.javac.util.Context;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    43
import com.sun.tools.javac.util.ListBuffer;
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    44
import com.sun.tools.javac.util.Options;
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    45
import com.sun.tools.sjavac.server.CompilationResult;
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    46
import com.sun.tools.sjavac.server.Sjavac;
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    47
import com.sun.tools.sjavac.server.SysInfo;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    48
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    49
/**
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    50
 * The sjavac implementation that interacts with javac and performs the actual
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    51
 * compilation.
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    52
 *
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    53
 *  <p><b>This is NOT part of any supported API.
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    54
 *  If you write code that depends on this, you do so at your own risk.
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    55
 *  This code and its internal interfaces are subject to change or
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    56
 *  deletion without notice.</b>
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    57
 */
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    58
public class SjavacImpl implements Sjavac {
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    59
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    60
    @Override
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    61
    public SysInfo getSysInfo() {
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    62
        return new SysInfo(Runtime.getRuntime().availableProcessors(),
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    63
                           Runtime.getRuntime().maxMemory());
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    64
    }
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    65
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    66
    @Override
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    67
    public CompilationResult compile(String protocolId,
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    68
                                     String invocationId,
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    69
                                     String[] args,
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    70
                                     List<File> explicitSources,
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    71
                                     Set<URI> sourcesToCompile,
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    72
                                     Set<URI> visibleSources) {
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    73
        final AtomicBoolean forcedExit = new AtomicBoolean();
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    74
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    75
        JavacTool compiler = JavacTool.create();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    76
        StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    77
        SmartFileManager smartFileManager = new SmartFileManager(fileManager);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    78
        Context context = new Context();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    79
        ResolveWithDeps.preRegister(context);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    80
        AttrWithDeps.preRegister(context);
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    81
        JavaCompilerWithDeps.preRegister(context, new SjavacErrorHandler() {
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    82
            @Override
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    83
            public void logError(String msg) {
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    84
                forcedExit.set(true);
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    85
            }
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
    86
        });
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    87
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    88
        // Now setup the actual compilation....
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    89
        CompilationResult compilationResult = new CompilationResult(0);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    90
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    91
        // First deal with explicit source files on cmdline and in at file.
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    92
        ListBuffer<JavaFileObject> compilationUnits = new ListBuffer<>();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    93
        for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(explicitSources)) {
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    94
            compilationUnits.append(i);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    95
        }
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    96
        // Now deal with sources supplied as source_to_compile.
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    97
        ListBuffer<File> sourcesToCompileFiles = new ListBuffer<>();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    98
        for (URI u : sourcesToCompile) {
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
    99
            sourcesToCompileFiles.append(new File(u));
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   100
        }
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   101
        for (JavaFileObject i : fileManager.getJavaFileObjectsFromFiles(sourcesToCompileFiles)) {
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   102
            compilationUnits.append(i);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   103
        }
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   104
        forcedExit.set(false);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   105
        // Create a new logger.
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   106
        StringWriter stdoutLog = new StringWriter();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   107
        StringWriter stderrLog = new StringWriter();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   108
        PrintWriter stdout = new PrintWriter(stdoutLog);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   109
        PrintWriter stderr = new PrintWriter(stderrLog);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   110
        com.sun.tools.javac.main.Main.Result rc = com.sun.tools.javac.main.Main.Result.OK;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   111
        try {
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   112
            if (compilationUnits.size() > 0) {
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   113
                smartFileManager.setVisibleSources(visibleSources);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   114
                smartFileManager.cleanArtifacts();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   115
                smartFileManager.setLog(stdout);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   116
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   117
                // Do the compilation!
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   118
                CompilationTask task = compiler.getTask(stderr,
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   119
                                                        smartFileManager,
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   120
                                                        null,
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   121
                                                        Arrays.asList(args),
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   122
                                                        null,
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   123
                                                        compilationUnits,
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   124
                                                        context);
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   125
                smartFileManager.setSymbolFileEnabled(!Options.instance(context).isSet("ignore.symbol.file"));
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   126
                rc = ((JavacTaskImpl) task).doCall();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   127
                smartFileManager.flush();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   128
            }
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   129
        } catch (Exception e) {
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   130
            stderrLog.append(e.getMessage());
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   131
            forcedExit.set(true);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   132
        }
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   133
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   134
        compilationResult.packageArtifacts = smartFileManager.getPackageArtifacts();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   135
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   136
        Dependencies deps = Dependencies.instance(context);
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   137
        compilationResult.packageDependencies = deps.getDependencies();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   138
        compilationResult.packagePubapis = deps.getPubapis();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   139
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   140
        compilationResult.stdout = stdoutLog.toString();
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   141
        compilationResult.stderr = stderrLog.toString();
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   142
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   143
        compilationResult.returnCode = rc.exitCode == 0 && forcedExit.get() ? -1 : rc.exitCode;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   144
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   145
        return compilationResult;
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   146
    }
26088
f479ca655ba1 8054474: Add --state-dir=bar to sjavac
ohrstrom
parents: 25605
diff changeset
   147
f479ca655ba1 8054474: Add --state-dir=bar to sjavac
ohrstrom
parents: 25605
diff changeset
   148
    @Override
26098
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   149
    public void shutdown() {
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   150
        // Nothing to clean up
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   151
        // ... maybe we should wait for any current request to finish?
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   152
    }
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   153
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   154
32588700060b 8048457: Sjavac should not use portfiles, sockets, etc if background=false
alundblad
parents: 26088
diff changeset
   155
    @Override
26088
f479ca655ba1 8054474: Add --state-dir=bar to sjavac
ohrstrom
parents: 25605
diff changeset
   156
    public String serverSettings() {
f479ca655ba1 8054474: Add --state-dir=bar to sjavac
ohrstrom
parents: 25605
diff changeset
   157
        return "";
f479ca655ba1 8054474: Add --state-dir=bar to sjavac
ohrstrom
parents: 25605
diff changeset
   158
    }
f479ca655ba1 8054474: Add --state-dir=bar to sjavac
ohrstrom
parents: 25605
diff changeset
   159
25299
b4a7dcd657f5 8048594: The sjavac client/server protocol should be hidden behind an interface
alundblad
parents:
diff changeset
   160
}