But in order to run multiple java modules/apps it need MultiJarLoader which
would not work on compact profile JRE. On other hand it is just an example.

My motivation for this patch was to get rid of 3 extra
java_compact*_example apps. But maybe instead of changing java_example I
can simply reduce  java_compact*_example to something like
java_singleapp_example that would use java.so. Thoughts?

On Wed, Sep 21, 2016 at 11:28 AM, Tomasz Grabiec <tgrab...@scylladb.com>
wrote:

>
>
> On Wed, Sep 21, 2016 at 5:05 PM, Waldek Kozaczuk <jwkozac...@gmail.com>
> wrote:
>
>> Please see my answers below.
>>
>> Sent from my iPhone
>>
>> On Sep 21, 2016, at 03:17, Tomasz Grabiec <tgrab...@scylladb.com> wrote:
>>
>>
>>
>> On Wed, Sep 21, 2016 at 6:32 AM, Waldemar Kozaczuk <jwkozac...@gmail.com>
>> wrote:
>>
>>> This change makes the java-example app universal so that it can be used
>>> with any
>>> Java runtime module like so:
>>>
>>> ./scripts/build image=java,java-example
>>> ./scripts/build image=openjdk8-fedora,java-example
>>> ./scripts/build image=openjdk8-zulu-compact1,java-example
>>> ./scripts/build image=openjdk8-zulu-compact2,java-example
>>> ./scripts/build image=openjdk8-zulu-compact3,java-example
>>>
>>> Signed-off-by: Waldemar Kozaczuk <jwkozac...@gmail.com>
>>> ---
>>>  java-compact1-example/Hello.java   | 5 -----
>>>  java-compact1-example/Makefile     | 7 -------
>>>  java-compact1-example/module.py    | 5 -----
>>>  java-compact1-example/usr.manifest | 1 -
>>>  java-compact2-example/Hello.java   | 5 -----
>>>  java-compact2-example/Makefile     | 7 -------
>>>  java-compact2-example/module.py    | 5 -----
>>>  java-compact2-example/usr.manifest | 1 -
>>>  java-compact3-example/Hello.java   | 5 -----
>>>  java-compact3-example/Makefile     | 7 -------
>>>  java-compact3-example/module.py    | 5 -----
>>>  java-compact3-example/usr.manifest | 1 -
>>>  java-example/module.py             | 2 +-
>>>  13 files changed, 1 insertion(+), 55 deletions(-)
>>>  delete mode 100644 java-compact1-example/Hello.java
>>>  delete mode 100644 java-compact1-example/Makefile
>>>  delete mode 100644 java-compact1-example/module.py
>>>  delete mode 100644 java-compact1-example/usr.manifest
>>>  delete mode 100644 java-compact2-example/Hello.java
>>>  delete mode 100644 java-compact2-example/Makefile
>>>  delete mode 100644 java-compact2-example/module.py
>>>  delete mode 100644 java-compact2-example/usr.manifest
>>>  delete mode 100644 java-compact3-example/Hello.java
>>>  delete mode 100644 java-compact3-example/Makefile
>>>  delete mode 100644 java-compact3-example/module.py
>>>  delete mode 100644 java-compact3-example/usr.manifest
>>>
>>> diff --git a/java-compact1-example/Hello.java
>>> b/java-compact1-example/Hello.java
>>> deleted file mode 100644
>>> index a605554..0000000
>>> --- a/java-compact1-example/Hello.java
>>> +++ /dev/null
>>> @@ -1,5 +0,0 @@
>>> -public class Hello {
>>> -    public static void main(String[] args) {
>>> -        System.out.println("Hello, World!");
>>> -    }
>>> -}
>>> diff --git a/java-compact1-example/Makefile
>>> b/java-compact1-example/Makefile
>>> deleted file mode 100644
>>> index 8a385c9..0000000
>>> --- a/java-compact1-example/Makefile
>>> +++ /dev/null
>>> @@ -1,7 +0,0 @@
>>> -module: Hello.class
>>> -
>>> -%.class: %.java
>>> -       javac -target 7 -source 7 $^
>>> -
>>> -clean:
>>> -       rm -rf *.class
>>> diff --git a/java-compact1-example/module.py
>>> b/java-compact1-example/module.py
>>> deleted file mode 100644
>>> index 216cf35..0000000
>>> --- a/java-compact1-example/module.py
>>> +++ /dev/null
>>> @@ -1,5 +0,0 @@
>>> -from osv.modules import api
>>> -
>>> -api.require('openjdk8-zulu-compact1')
>>> -
>>> -default = api.run('/java.so -cp /java-example Hello')
>>> diff --git a/java-compact1-example/usr.manifest b/java-compact1-example/
>>> usr.manifest
>>> deleted file mode 100644
>>> index f62abc7..0000000
>>> --- a/java-compact1-example/usr.manifest
>>> +++ /dev/null
>>> @@ -1 +0,0 @@
>>> -/java-example/Hello.class: ${MODULE_DIR}/Hello.class
>>> diff --git a/java-compact2-example/Hello.java
>>> b/java-compact2-example/Hello.java
>>> deleted file mode 100644
>>> index a605554..0000000
>>> --- a/java-compact2-example/Hello.java
>>> +++ /dev/null
>>> @@ -1,5 +0,0 @@
>>> -public class Hello {
>>> -    public static void main(String[] args) {
>>> -        System.out.println("Hello, World!");
>>> -    }
>>> -}
>>> diff --git a/java-compact2-example/Makefile
>>> b/java-compact2-example/Makefile
>>> deleted file mode 100644
>>> index 8a385c9..0000000
>>> --- a/java-compact2-example/Makefile
>>> +++ /dev/null
>>> @@ -1,7 +0,0 @@
>>> -module: Hello.class
>>> -
>>> -%.class: %.java
>>> -       javac -target 7 -source 7 $^
>>> -
>>> -clean:
>>> -       rm -rf *.class
>>> diff --git a/java-compact2-example/module.py
>>> b/java-compact2-example/module.py
>>> deleted file mode 100644
>>> index f17ac37..0000000
>>> --- a/java-compact2-example/module.py
>>> +++ /dev/null
>>> @@ -1,5 +0,0 @@
>>> -from osv.modules import api
>>> -
>>> -api.require('openjdk8-zulu-compact2')
>>> -
>>> -default = api.run('/java.so -cp /java-example Hello')
>>> diff --git a/java-compact2-example/usr.manifest b/java-compact2-example/
>>> usr.manifest
>>> deleted file mode 100644
>>> index f62abc7..0000000
>>> --- a/java-compact2-example/usr.manifest
>>> +++ /dev/null
>>> @@ -1 +0,0 @@
>>> -/java-example/Hello.class: ${MODULE_DIR}/Hello.class
>>> diff --git a/java-compact3-example/Hello.java
>>> b/java-compact3-example/Hello.java
>>> deleted file mode 100644
>>> index a605554..0000000
>>> --- a/java-compact3-example/Hello.java
>>> +++ /dev/null
>>> @@ -1,5 +0,0 @@
>>> -public class Hello {
>>> -    public static void main(String[] args) {
>>> -        System.out.println("Hello, World!");
>>> -    }
>>> -}
>>> diff --git a/java-compact3-example/Makefile
>>> b/java-compact3-example/Makefile
>>> deleted file mode 100644
>>> index 8a385c9..0000000
>>> --- a/java-compact3-example/Makefile
>>> +++ /dev/null
>>> @@ -1,7 +0,0 @@
>>> -module: Hello.class
>>> -
>>> -%.class: %.java
>>> -       javac -target 7 -source 7 $^
>>> -
>>> -clean:
>>> -       rm -rf *.class
>>> diff --git a/java-compact3-example/module.py
>>> b/java-compact3-example/module.py
>>> deleted file mode 100644
>>> index 05cb1f4..0000000
>>> --- a/java-compact3-example/module.py
>>> +++ /dev/null
>>> @@ -1,5 +0,0 @@
>>> -from osv.modules import api
>>> -
>>> -api.require('openjdk8-zulu-compact3')
>>> -
>>> -default = api.run('/java.so -cp /java-example Hello')
>>> diff --git a/java-compact3-example/usr.manifest b/java-compact3-example/
>>> usr.manifest
>>> deleted file mode 100644
>>> index f62abc7..0000000
>>> --- a/java-compact3-example/usr.manifest
>>> +++ /dev/null
>>> @@ -1 +0,0 @@
>>> -/java-example/Hello.class: ${MODULE_DIR}/Hello.class
>>> diff --git a/java-example/module.py b/java-example/module.py
>>> index 747612f..848bbba 100644
>>> --- a/java-example/module.py
>>> +++ b/java-example/module.py
>>> @@ -2,4 +2,4 @@ from osv.modules import api
>>>
>>>  api.require('java')
>>>
>>> -default = api.run_java(classpath=['/java-example'], args=['Hello'])
>>> +default = api.run('/java.so -cp /java-example Hello')
>>>
>>
>> Would it also work with run_java()?
>>
>>
>> api.run_java() relies on MultiJarLoader which relies on isolated JVM
>> feature which does not work in any compact profile because it relies on
>> java.beans package that is not part of any compact profile. So I changed
>> the command line to use api.run to call java.so.
>>
>
> I see.
>
>>
>> If you use run(), you won't be able to mix this module with other JVM
>> apps.
>>
>>
>> What do you mean by that?
>>
>
> Each module may have its own command line which runs something. When using
> run_java() you can mix multiple modules to run them all under one JVM. For
> example:
>
>   ./scripts/build image=java-example,java-newrelic
>
> There will be one JVM started for both modules.
>
> If java-example module will use run() instead, such mixing will no longer
> work.
>

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to