application server, just without the "web" part...

Discussion in 'Java' started by Andreas Leitgeb, May 14, 2014.

  1. Essentially my application is a couple of separate command-line
    utilities, called from users with shell-access (or from unix
    shell scripts).

    Startup-time still isn't exactly Java's strong point, and often
    enough in my situation the startup time is by far the "longest
    pole in the tent".
    Adding option -Xshareclasses improved things, but not enough.

    I'd like to consider some kind of application server, that would
    run the actual java-code of any number of jobs (of one user) in one
    jvm, and with an "interface", that would only allow that one user to
    start new jobs.

    Does something like this already exist?

    PS: the actual jobs need to be in Java, because they need certain
    Java-libraries for their work. The server would know all relevant
    classes beforehand.
     
    Andreas Leitgeb, May 14, 2014
    #1
    1. Advertisements

  2. Andreas Leitgeb

    markspace Guest

    On 5/14/2014 12:16 PM, Andreas Leitgeb wrote:
    > Does something like this already exist?



    ClassName.main( "arguments" );

    ?

    After you add the Jar file to your app server's classpath, of course.

    Output could be a little weird, depending on how your sever handles
    stdout. Most of the output will likely end up in the log file.

    Not sure what else...
     
    markspace, May 14, 2014
    #2
    1. Advertisements

  3. Andreas Leitgeb

    Stefan Ram Guest

    Andreas Leitgeb <> writes:
    >I'd like to consider some kind of application server, that would
    >run the actual java-code of any number of jobs (of one user) in one
    >jvm, and with an "interface", that would only allow that one user to
    >start new jobs.


    I don't know the meaning of »user« in Java. Maybe you want:

    java.lang.System.getProperty( "user.name" ).equals( "user0" )

    ? Otherwise, you could use a normal Web/REST-server and a local
    socket (127.0.0.1) with appropriate IP checks/firewalls.
     
    Stefan Ram, May 14, 2014
    #3
  4. Andreas Leitgeb

    Stefan Ram Guest

    -berlin.de (Stefan Ram) writes:
    >Andreas Leitgeb <> writes:
    >>I'd like to consider some kind of application server, that would
    >>run the actual java-code of any number of jobs (of one user) in one
    >>jvm, and with an "interface", that would only allow that one user to
    >>start new jobs.

    >I don't know the meaning of »user« in Java. Maybe you want:
    >java.lang.System.getProperty( "user.name" ).equals( "user0" )


    Oh, I now see that this does not work across server boundaries!

    To grant server access only to user user0, create a file
    that is writeable only by the server process and readable
    only by that user user0. The server writes a text to that
    file and then the user must pass this text to the server
    API. As soon as such a call is received, a new text can be
    written to that file.
     
    Stefan Ram, May 14, 2014
    #4
  5. Andreas Leitgeb

    Arne Vajhøj Guest

    On 5/14/2014 3:16 PM, Andreas Leitgeb wrote:
    > Essentially my application is a couple of separate command-line
    > utilities, called from users with shell-access (or from unix
    > shell scripts).
    >
    > Startup-time still isn't exactly Java's strong point, and often
    > enough in my situation the startup time is by far the "longest
    > pole in the tent".
    > Adding option -Xshareclasses improved things, but not enough.
    >
    > I'd like to consider some kind of application server, that would
    > run the actual java-code of any number of jobs (of one user) in one
    > jvm, and with an "interface", that would only allow that one user to
    > start new jobs.
    >
    > Does something like this already exist?
    >
    > PS: the actual jobs need to be in Java, because they need certain
    > Java-libraries for their work. The server would know all relevant
    > classes beforehand.


    Why not run beanshell and run the classes from that.

    $ java -cp wherebshis:whereyourstuffis bsh.Interpreter
    bsh% somepackage.SomeClass.main(null);
    bsh% somepackage.SomeOtherClass.main(null);

    Arne
     
    Arne Vajhøj, May 15, 2014
    #5
  6. Andreas Leitgeb

    Joerg Meier Guest

    On Wed, 14 May 2014 19:46:42 -0400, Arne Vajhøj wrote:

    > bsh% somepackage.SomeClass.main(null);
    > bsh% somepackage.SomeOtherClass.main(null);


    It seems to me that would break the vast majority of Java applications,
    which tend to start with something like "if (args.length > 0) ...".

    Liebe Gruesse,
    Joerg

    --
    Ich lese meine Emails nicht, replies to Email bleiben also leider
    ungelesen.
     
    Joerg Meier, May 15, 2014
    #6
  7. Ok, I noticed from the replies that my posting was apparently
    unclear in ways I didn't anticipate...

    First of all, the "server" was meant as a process on the same
    host, not as a separate machine.

    Second, The server is supposed to handle multiple processes in
    parallel (as threads), separating them (and each's static fields)
    by use of separate classloaders. (I thought that would be implicit
    by referring to "application server", but obviously it wasn't)

    Thanks anyway for the answers so far.

    PS: I already caught the drift, though, that what I need is a
    bit further off mainstream than I feared it would be.


    Andreas Leitgeb <> wrote:
    > Essentially my application is a couple of separate command-line
    > utilities, called from users with shell-access (or from unix
    > shell scripts).
    >
    > Startup-time still isn't exactly Java's strong point, and often
    > enough in my situation the startup time is by far the "longest
    > pole in the tent".
    > Adding option -Xshareclasses improved things, but not enough.
    >
    > I'd like to consider some kind of application server, that would
    > run the actual java-code of any number of jobs (of one user) in one
    > jvm, and with an "interface", that would only allow that one user to
    > start new jobs.
    >
    > Does something like this already exist?
    >
    > PS: the actual jobs need to be in Java, because they need certain
    > Java-libraries for their work. The server would know all relevant
    > classes beforehand.
    >
     
    Andreas Leitgeb, May 15, 2014
    #7
  8. Leif Roar Moldskred <> wrote:
    > Andreas Leitgeb <> wrote:
    >> I'd like to consider some kind of application server, that would
    >> run the actual java-code of any number of jobs (of one user) in one
    >> jvm, and with an "interface", that would only allow that one user to
    >> start new jobs.

    >
    > One possible solution is to have a program that scans a given
    > directory (say, ~/.javaTriggers) which only that user has write access
    > to.


    I hoped for unix domain sockets or named pipes, if the server can
    handle those.

    > If the utilities need to write output to stdOut, it gets a little
    > trickier, but you can finagle your way around that too.


    I'll probably need to multiplex it into the communication channel...

    I hoped I wouldn't need to start from zero, though.

    Thanks, anyway.
     
    Andreas Leitgeb, May 15, 2014
    #8
  9. Arne Vajhøj <> wrote:
    > On 5/14/2014 3:16 PM, Andreas Leitgeb wrote:
    >> Startup-time still isn't exactly Java's strong point,...
    >> I'd like to consider some kind of application server, that would
    >> run the actual java-code of any number of jobs (of one user) in one
    >> jvm, and with an "interface", that would only allow that one user to
    >> start new jobs.


    > Why not run beanshell and run the classes from that.
    > $ java -cp wherebshis:whereyourstuffis bsh.Interpreter
    > bsh% somepackage.SomeClass.main(null);
    > bsh% somepackage.SomeOtherClass.main(null);


    I googled and found http://www.beanshell.org/javadoc/bsh/Interpreter.html
    I'm not yet sure if this will help me with separating multiple
    jobs running at the same time, but it might help me in my process
    of incrementally implementing what I need.

    Thanks!

    PS: for the other F'up: of course I would not pass null for args...
    I'd definititely have something sensible to pass instead.
     
    Andreas Leitgeb, May 15, 2014
    #9
  10. Andreas Leitgeb

    Arne Vajhøj Guest

    On 5/15/2014 6:25 AM, Joerg Meier wrote:
    > On Wed, 14 May 2014 19:46:42 -0400, Arne Vajhøj wrote:
    >
    >> bsh% somepackage.SomeClass.main(null);
    >> bsh% somepackage.SomeOtherClass.main(null);

    >
    > It seems to me that would break the vast majority of Java applications,
    > which tend to start with something like "if (args.length > 0) ...".


    Yeah. new String[0] would be a bit nicer than null.

    Arne
     
    Arne Vajhøj, May 17, 2014
    #10
  11. On 5/15/2014 10:32 AM, Andreas Leitgeb wrote:
    > Arne Vajhøj <> wrote:
    >> On 5/14/2014 3:16 PM, Andreas Leitgeb wrote:
    >>> Startup-time still isn't exactly Java's strong point,...
    >>> I'd like to consider some kind of application server, that would
    >>> run the actual java-code of any number of jobs (of one user) in one
    >>> jvm, and with an "interface", that would only allow that one user to
    >>> start new jobs.

    >
    >> Why not run beanshell and run the classes from that.
    >> $ java -cp wherebshis:whereyourstuffis bsh.Interpreter
    >> bsh% somepackage.SomeClass.main(null);
    >> bsh% somepackage.SomeOtherClass.main(null);

    >
    > I googled and found http://www.beanshell.org/javadoc/bsh/Interpreter.html
    > I'm not yet sure if this will help me with separating multiple
    > jobs running at the same time, but it might help me in my process
    > of incrementally implementing what I need.


    Now I am confused.

    You worry about the JVM startup time - implying that it is
    somewhat significant compared to job run time.

    But you want to run multiple jobs in parallel - implying that
    jobs run for a long time.

    Am I missing something?

    Arne
     
    Arne Vajhøj, May 17, 2014
    #11
  12. Arne Vajhøj <> wrote:
    > On 5/15/2014 10:32 AM, Andreas Leitgeb wrote:
    >> Arne Vajhøj <> wrote:
    >>> On 5/14/2014 3:16 PM, Andreas Leitgeb wrote:
    >>>> Startup-time still isn't exactly Java's strong point,...
    >>>> I'd like to consider some kind of application server, that would
    >>>> run the actual java-code of any number of jobs (of one user) in one
    >>>> jvm, and with an "interface", that would only allow that one user to
    >>>> start new jobs.
    >>> Why not run beanshell and run the classes from that.
    >>> $ java -cp wherebshis:whereyourstuffis bsh.Interpreter
    >>> bsh% somepackage.SomeClass.main(null);
    >>> bsh% somepackage.SomeOtherClass.main(null);

    >> I googled and found http://www.beanshell.org/javadoc/bsh/Interpreter.html
    >> I'm not yet sure if this will help me with separating multiple
    >> jobs running at the same time, but it might help me in my process
    >> of incrementally implementing what I need.

    >
    > Now I am confused.
    >
    > You worry about the JVM startup time - implying that it is
    > somewhat significant compared to job run time.
    > But you want to run multiple jobs in parallel - implying that
    > jobs run for a long time.


    There are short jobs, long jobs eventually spawning short
    jobs while running.

    In principle I could distinguish them beforehand and only
    use bean-shell for the short ones (running them serialized).

    However, I'm not sure if I can correctly predict it in
    all cases, so I'm looking for a general solution that
    won't require me to distinguish.
     
    Andreas Leitgeb, May 17, 2014
    #12
  13. Andreas Leitgeb

    Jeff Higgins Guest

    On 05/17/2014 05:46 AM, Andreas Leitgeb wrote:
    > Arne Vajhøj <> wrote:
    >> On 5/15/2014 10:32 AM, Andreas Leitgeb wrote:
    >>> Arne Vajhøj <> wrote:
    >>>> On 5/14/2014 3:16 PM, Andreas Leitgeb wrote:
    >>>>> Startup-time still isn't exactly Java's strong point,...
    >>>>> I'd like to consider some kind of application server, that would
    >>>>> run the actual java-code of any number of jobs (of one user) in one
    >>>>> jvm, and with an "interface", that would only allow that one user to
    >>>>> start new jobs.
    >>>> Why not run beanshell and run the classes from that.
    >>>> $ java -cp wherebshis:whereyourstuffis bsh.Interpreter
    >>>> bsh% somepackage.SomeClass.main(null);
    >>>> bsh% somepackage.SomeOtherClass.main(null);
    >>> I googled and found http://www.beanshell.org/javadoc/bsh/Interpreter.html
    >>> I'm not yet sure if this will help me with separating multiple
    >>> jobs running at the same time, but it might help me in my process
    >>> of incrementally implementing what I need.

    >>
    >> Now I am confused.
    >>
    >> You worry about the JVM startup time - implying that it is
    >> somewhat significant compared to job run time.
    >> But you want to run multiple jobs in parallel - implying that
    >> jobs run for a long time.

    >
    > There are short jobs, long jobs eventually spawning short
    > jobs while running.
    >
    > In principle I could distinguish them beforehand and only
    > use bean-shell for the short ones (running them serialized).
    >
    > However, I'm not sure if I can correctly predict it in
    > all cases, so I'm looking for a general solution that
    > won't require me to distinguish.
    >


    It's starting to sound like OSGI to me.
    OSGI Standard Services
    <http://en.wikipedia.org/wiki/OSGi#Services>

    Or even a Business Process Management platform | framework
     
    Jeff Higgins, May 17, 2014
    #13
  14. Andreas Leitgeb

    Jeff Higgins Guest

    On 05/17/2014 07:42 AM, Jeff Higgins wrote:
    >
    > It's starting to sound like OSGI to me.


    The Apache Karaf Service Wrapper
    <http://karaf.apache.org/manual/latest/users-guide/wrapper.html>
     
    Jeff Higgins, May 17, 2014
    #14
  15. Andreas Leitgeb

    Jeff Higgins Guest

    On 05/17/2014 08:52 AM, Jeff Higgins wrote:
    > On 05/17/2014 07:42 AM, Jeff Higgins wrote:
    >>
    >> It's starting to sound like OSGI to me.

    >
    > The Apache Karaf Service Wrapper
    > <http://karaf.apache.org/manual/latest/users-guide/wrapper.html>
    >

    Karaf Instances
    <http://karaf.apache.org/manual/latest/users-guide/instances.html>
     
    Jeff Higgins, May 17, 2014
    #15
  16. Andreas Leitgeb

    Jeff Higgins Guest

    On 05/17/2014 09:07 AM, Jeff Higgins wrote:
    > On 05/17/2014 08:52 AM, Jeff Higgins wrote:
    >> On 05/17/2014 07:42 AM, Jeff Higgins wrote:
    >>>
    >>> It's starting to sound like OSGI to me.

    >>
    >> The Apache Karaf Service Wrapper
    >> <http://karaf.apache.org/manual/latest/users-guide/wrapper.html>
    >>

    > Karaf Instances
    > <http://karaf.apache.org/manual/latest/users-guide/instances.html>
    >

    Karaf Realms
    <http://karaf.apache.org/manual/latest/users-guide/security.html>
     
    Jeff Higgins, May 17, 2014
    #16
  17. Andreas Leitgeb

    Luuk Guest

    On 17-5-2014 15:12, Jeff Higgins wrote:
    > On 05/17/2014 09:07 AM, Jeff Higgins wrote:
    >> On 05/17/2014 08:52 AM, Jeff Higgins wrote:
    >>> On 05/17/2014 07:42 AM, Jeff Higgins wrote:
    >>>>
    >>>> It's starting to sound like OSGI to me.
    >>>
    >>> The Apache Karaf Service Wrapper
    >>> <http://karaf.apache.org/manual/latest/users-guide/wrapper.html>
    >>>

    >> Karaf Instances
    >> <http://karaf.apache.org/manual/latest/users-guide/instances.html>
    >>

    > Karaf Realms
    > <http://karaf.apache.org/manual/latest/users-guide/security.html>
    >
    >


    just the complete docs:
    http://karaf.apache.org/manual/latest/users-guide/

    ;-)
     
    Luuk, May 17, 2014
    #17
  18. Luuk <> wrote:
    > On 17-5-2014 15:12, Jeff Higgins wrote:
    >> On 05/17/2014 09:07 AM, Jeff Higgins wrote:
    >>> On 05/17/2014 08:52 AM, Jeff Higgins wrote:
    >>>> On 05/17/2014 07:42 AM, Jeff Higgins wrote:
    >>>>> It's starting to sound like OSGI to me.
    >>>> The Apache Karaf Service Wrapper
    >>>> <http://karaf.apache.org/manual/latest/users-guide/wrapper.html>
    >>> Karaf Instances
    >>> <http://karaf.apache.org/manual/latest/users-guide/instances.html>

    >> Karaf Realms
    >> <http://karaf.apache.org/manual/latest/users-guide/security.html>

    > just the complete docs:
    > http://karaf.apache.org/manual/latest/users-guide/
    > ;-)


    Thanks for the cascade of Karaf links :)

    It's not quite what I was looking for, and I saw, that I have to
    refine my requirements until I really know what I need. As it seems,
    an "application server" is much more than what I need, as it also
    has the concept of deploying and undeploying code dynamically.

    I'll probably only need to deal with unix domain sockets (not
    internet sockets) for starting applications and interacting with
    them, and I'll need to learn how to deal with classloaders, taking
    care not to accidentally load certain classes too early (thus into
    the system classloader). I could probably learn that from karaf
    but I expect to learn it easier somewhere else.
     
    Andreas Leitgeb, Jun 16, 2014
    #18
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Anonieko
    Replies:
    0
    Views:
    5,680
    Anonieko
    Feb 8, 2006
  2. Nobody
    Replies:
    3
    Views:
    1,148
    Joseph Kesselman
    May 9, 2006
  3. walterbyrd
    Replies:
    1
    Views:
    627
    Damjan
    Apr 10, 2006
  4. John Salerno

    Using just the Mako part of Pylons?

    John Salerno, Jun 28, 2008, in forum: Python
    Replies:
    5
    Views:
    648
    Matt Nordhoff
    Jul 1, 2008
  5. Paul Carter

    Wse call just not being made when part of a domain

    Paul Carter, Feb 27, 2007, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    242
    Paul Carter
    Feb 27, 2007
  6. Conax

    Refresh just part of the screen?

    Conax, Dec 14, 2003, in forum: ASP General
    Replies:
    10
    Views:
    472
    Roland Hall
    Dec 19, 2003
  7. Jack
    Replies:
    8
    Views:
    602
  8. Replies:
    0
    Views:
    274
Loading...