This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 206791

Summary: Bundle hudson-remoting library
Product: ide Reporter: Jesse Glick <jglick>
Component: libsAssignee: issues@ide <issues>
Status: NEW ---    
Severity: normal CC: anebuzelsky, jlahoda, mkleint
Priority: P2 Keywords: API
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: TASK Exception Reporter:
Bug Depends on:    
Bug Blocks: 41689, 194090    

Description Jesse Glick 2011-12-29 18:06:27 UTC
The IDE platform lacks any straightforward way to communicate nontrivially with external JVM processes it has forked as agents. Use cases include:

1. Running Ant in forked mode, while still supporting AntLogger's (including those making use of verbose- or debug-level events not normally printed to stdio).

2. Running Maven in forked mode. While we already do this, IDE output listeners are based upon parsing stdio messages from the default event logger, which is fragile (subject to misinterpretation of certain strings) and omits certain critical bits of information (such as the relative file paths of named submodules).

3. Working with Jigsaw modules requires parsing module-info.java and examining binary repositories, yet the APIs to do these things do not seem to work on JDK 7; may need to fork an 8+ JVM in case the IDE is running on 6/7.

org.jvnet.hudson.main:hudson-remoting is ideal for these use cases. It can handle connections to other computers, though for our purposes local interprocess connections suffice (which is also a ). The API is very simple, e.g.

VirtualChannel c = new Channel("ant", RequestProcessor.getDefault(), process.getInputStream(), process.getOutputStream());
c.call(new Callable<Void,Error>() {public Void call() {...}});
c.close();

Like RMI, it does automatic class loading in the remote system; but compared to RMI the API is much easier to understand and connections are much simpler to set up. Compared to JBoss Remoting, the interface is also far simpler.

This is a small library - 230Kb as of 2.2.0 - which is part of the Hudson IP and available under the MIT license (soon to be EPL I presume). It has three dependencies, but these are only used from some pieces unnecessary for IDE usage (hudson.remoting.Engine, hudson.remoting.Launcher, hudson.remoting.forward.*, hudson.remoting.jnlp.*) which if omitted would make it even smaller. Can this be approved for inclusion in the IDE please?
Comment 1 Antonin Nebuzelsky 2012-01-05 13:41:55 UTC
I like the idea of using hudson-remoting.

I assume we would download the JAR from the Maven repository:
http://search.maven.org/#search|ga|1|hudson-remoting

where the separate hudson-remoting-2.2.0.jar is available?

I did not find any license file with the MIT license (including the copyright notices) for the two parts of the library. We will need this specific MIT license to be able to use the library. Can you provide that?
Comment 2 Jesse Glick 2012-01-05 13:50:08 UTC
(In reply to comment #1)
> I assume we would download the JAR from the Maven repository
> where the separate hudson-remoting-2.2.0.jar is available?

We could, though I would rather strip out the aforementioned parts which are only of interest to Hudson or other systems managing slaves.

> I did not find any license file with the MIT license (including the copyright
> notices)

The POM specifies (via its parent):

    <license>
      <name>The MIT license</name>
      <url>http://www.opensource.org/licenses/mit-license.php</url>
      <distribution>repo</distribution>
    </license>

and source files have text such as:

The MIT License

Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Comment 3 Jesse Glick 2012-03-06 14:17:02 UTC
Apparently not for 7.2.
Comment 4 Jesse Glick 2013-04-09 14:50:09 UTC
#194090 implemented using JSON output, which is fine so long as the agent can run noninteractively, i.e. you can decide in advance what events you need logged. The in-VM Ant runner, by contrast, reports every event (even DEBUG level) with a lightweight protocol, and allows listeners to ask for more details when they need it; this would not carry over well for forked builds without the use of some kind of RPC channel.