NT/4 or OS/2 system variable value in NetRexx or Java?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

NT/4 or OS/2 system variable value in NetRexx or Java?

Simon Husin/ASG/US/AON
Hi all,

For our project we need to prevent another session of the same Java-based
application from running, ever.  Since the application needs be run on only
NT and OS/2, what I have in mind is to use a system variable that needs be
tested and set if it is not yet set by the application.

Related to the above I have three questions:
1) How can I get the value and/or set the value of such a variable in
NetRexx or Java?
2) Is the system variable system-wide or only for one session?
3) Is there a better way to accomplish the above?

Simon Husin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: NT/4 or OS/2 system variable value in NetRexx or Java?

Henry J. Cobb
Open a socket at a hardcoded IP socket number when you start up.

As long as your process is running (or waiting for its Dr Watson requestor
to be satisfied...) no other occurance can be launched.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: NT/4 or OS/2 system variable value in NetRexx or Java?

mcbrides
In reply to this post by Simon Husin/ASG/US/AON
>Hi all,
>
>For our project we need to prevent another session of the same Java-based
>application from running, ever.  Since the application needs be run on only
>NT and OS/2, what I have in mind is to use a system variable that needs be
>tested and set if it is not yet set by the application.
>
>Related to the above I have three questions:
>

>1) How can I get the value and/or set the value of such a variable in
>NetRexx or Java?
>

As far as I know, and I've looked pretty extensively, Java has no IPC layer to
speak of. The current JVM model assumes it own's the machine it's running on.

>2) Is the system variable system-wide or only for one session?
>

Per session.

>3) Is there a better way to accomplish the above?
>

Yes! You can create a file in a pre-determined drirectory and use that as a
marker that a process is already running. You can use the socket interface and
have your application look for other copies of itself... You can use a
wonderful Java implementation of PIPES that may be able to do what you wish.
You can find Pipes at Hobbes/java/dev or hang around a bit and Mr. Tomlinson
will tell you about it (he's the author)... <G>

--

/--------------------\
| Jerry McBride      |
| [hidden email] |
\--------------------/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: NT/4 or OS/2 system variable value in NetRexx or Java?

Andrew.Wright
In reply to this post by Simon Husin/ASG/US/AON
Another way might be viable, as long as your program can access the system
it is running on (not sure if that part was answered in the previous
notes).
Assuming it can, your program can first run PSTAT (same command on NT or
OS/2) and verify that it is the only instance of itself in the list, if
not, exit.
I pipe the data to a file and access the file (eg. PSTAT > PSTAT.LOG).
---------------------- Forwarded by Andrew Wright on 03/12/99 09:16 AM
---------------------------


[hidden email] (Jerry McBride) on 03/11/99 03:34:41 PM

To:   "Simon Husin/ASG/US/AON" <[hidden email]>
cc:   [hidden email] (bcc: Andrew Wright)
Subject:  Re: NT/4 or OS/2 system variable value in NetRexx or Java?




>Hi all,
>
>For our project we need to prevent another session of the same Java-based
>application from running, ever.  Since the application needs be run on
only
>NT and OS/2, what I have in mind is to use a system variable that needs be
>tested and set if it is not yet set by the application.
>
>Related to the above I have three questions:
>

>1) How can I get the value and/or set the value of such a variable in
>NetRexx or Java?
>

As far as I know, and I've looked pretty extensively, Java has no IPC layer
to
speak of. The current JVM model assumes it own's the machine it's running
on.

>2) Is the system variable system-wide or only for one session?
>

Per session.

>3) Is there a better way to accomplish the above?
>

Yes! You can create a file in a pre-determined drirectory and use that as a
marker that a process is already running. You can use the socket interface
and
have your application look for other copies of itself... You can use a
wonderful Java implementation of PIPES that may be able to do what you
wish.
You can find Pipes at Hobbes/java/dev or hang around a bit and Mr.
Tomlinson
will tell you about it (he's the author)... <G>

--

/--------------------\
| Jerry McBride      |
| [hidden email] |
\--------------------/

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note
to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: NT/4 or OS/2 system variable value in NetRexx or Java?

Simon Husin/ASG/US/AON
In reply to this post by Simon Husin/ASG/US/AON
Thanks all for the information.

Henry...
Re: opening IP socket, I like the idea, but may I ask whether when the
second program is launched it can stop waiting for the socket to be
available and quit instead?

Scott...
Also, it wasn't quite clear from your note, Simon, did you mean any one
user
"at any one time" or one user "once and only ONE user EVER"?  Or somewhere
in between?  And how wide-ranging is your exclusion zone ?  Do you mean per
machine [local file OS/2 and NT or a  registry entry for NT springs to
mind, via a 'trusted' application] or in a Domain for a user? or a machine?
.. in which
case CGI scripts may have a role.  Inside an Intranet, with NAT, dummy DNS
entries spring to mind.

The exclusion zone is for each client/user's PC.  Each client/user may not
run this application two or more times simultaneously in the same session
(time between operating system boot and shutdown).  However, they may
terminate the first one and start the second one.

Jerry...
You have been digging more than I have.  I cannot use your suggestion to
use a file since I don't want to have any traces (file left in there) which
I have to deal with (clean up) in case of abnormal ending of the program
(e.g. power outage), etc.  However, your suggestion re: Java pipe that's
very sound and I will check Hobbes/java/dev very soon!

Tony...
I don't quite follow what you're sharing with us.  It must be me with my
limited knowledge.

Andrew...
Using PSTAT piped to a file and analyze the file.  Clever!  I forgot to
mention that the application we are building must also run on Win95/98.
Does the latter support PSTAT as well?

To all of you thanks for the inputs and suggestions.  I would welcome more
if there are any...

Sincerely,
Simon Husin

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>

Reply | Threaded
Open this post in threaded view
|

Re: NT/4 or OS/2 system variable value in NetRexx or Java?

Henry J. Cobb
Attempting to open a TCP socket that another process already has open
causes an exception (under Java) with no waiting for this resource to
become free.


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To unsubscribe from this mailing list ( ibm-netrexx ), please send a note to
[hidden email]
with the following message in the body of the note
unsubscribe ibm-netrexx <e-mail address>