How to find my class is running in the same machine or not

Hi,
Can any one help me, I have a class called TestClass it has a main method. I want to restrict this class, to run only one occurrence in my system. i.e. If I open 2 command prompts and If I run this class in 2 command prompts, in one command prompt it should run, in another command prompt it should display msg like "This class is already running in the system".
Thanks in advance.

You could simply create a text file, if that file
does not already exist. If it
does exist, you know you are already running. Just
remember to delete the
file on exit of the original running instance.This is not as reliable as the previously mentioned server socket approach. With this approach, if your program crashes, it may not delete the file. With the socket approach, even if the program crashes, the socket will be released.

Similar Messages

  • Can there be more than one JVM Running on the same machine

    Can there be more than one JVM Running on the same machine.

    Even JVM's of different versions (or vendors) can run on the same box at the same time.

  • Multiple instances of weblogic server 6.1 running on the same machine

    Hi,
    I need to run two instances of weblogic server 6.1 running on the same
    machine. I need one for development and the other one running the live
    applications. I need two instances to be independent of each other. I am
    running weblogic server as an NT service. So I need two servers to start
    from the service so they are independent of each other.
    Thanks
    Madhu

    Hi.
    You can create new servers in your domain via the console. Be sure they are
    listening to different ports, however. If your NT machine supports more than
    1 IP address then you could alternatively bind each server to a different
    address.
    I'm not sure if this answers your question?
    Regards,
    Michael
    m holur wrote:
    Hi,
    I need to run two instances of weblogic server 6.1 running on the same
    machine. I need one for development and the other one running the live
    applications. I need two instances to be independent of each other. I am
    running weblogic server as an NT service. So I need two servers to start
    from the service so they are independent of each other.
    Thanks
    Madhu--
    Developer Relations Engineer
    BEA Support

  • How do I share files between users on the same machine?

    I tried using /Users/shared to share files between myself (Admin user) and another user on the machine (Standard user). Whenever I put a file or a folder into said directory permissions are 755 for directories and 644 for files, my umask is 0022. The files and directories belong to my user and the group staff. This means I can read and write and others can read. If I do the same using the other users account. Permissions are 700 and 600 respectively. (Owner is the other user and group is staff.) Strangely the other users umask is 0022, too.
    The result is, that all directories and files I create with my account (Admin user) are readable to every other user on the machine, whereas all directories and files the other user (Standard user) creates are not readable for anyone else. I can easily rectify this using the Terminal and chmod and/or chown, but it is a pain having to do this, since I also need to forcefully restart the Finder App for it to notice the changed permissions.
    Ideally I'd like all directories in /Users/Shared to have permissions 777 and all files 666 no matter which user created, copied or moved them to said location. I think this could possibly be done using applescript and shellscripting and the folder action hook. So far my attempts to find such a script on the net or/and write it myself have failed. I'd be grateful for any hints how I:
    a) write and setup such a script
    b) accomplish what I try to do (share files and folders on the same machine) in another possibly more Mac way
    Kind regards
    David

    The following AppleScript will recursively descend the directory tree and change the items to your modes:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    on adding folder items to this_folder after receiving these_items
    repeat with some_item in these_items
    ProcessStuff from some_item
    end repeat
    end adding folder items to
    to ProcessStuff from SomeItem
    processes items contained in SomeItem, recursively descending the directory tree
    parameters - SomeItem [mixed]: an item containing the items to process
    returns nothing
    set SomeItem to SomeItem as text
    set FileInfo to (info for SomeItem as alias)
    if (folder of FileInfo) and not (package folder of FileInfo) then -- a folder (not a package)
    do shell script "chmod 666 " & quoted form of POSIX path of SomeItem
    -- do shell script "chown root:staff " & quoted form of POSIX path of SomeItem user name "me" password "mypassword" with administrator privileges
    try -- to get items in the folder
    tell application "Finder" to set SubFolder to (items of folder SomeItem)
    on error
    return {}
    end try
    repeat with SubItem in SubFolder -- process the sub items
    ProcessStuff from SubItem
    end repeat
    else -- a file
    do shell script "chmod 777 " & quoted form of POSIX path of SomeItem
    -- do shell script "chown root:staff " & quoted form of POSIX path of SomeItem user name "me" password "mypassword" with administrator privileges
    end if
    return
    end ProcessStuff
    </pre>
    You shouldn't need to change the ownership, so I commented out the chown shell script since this would need to be run as a super user. You can run a shell script with administrator privileges, but in order to be used by a standard user you will need to provide the appropriate user name and password in the script, which might not be a good idea - note that the folder action script will need to be attached in all accounts that you want to change the permissions, which means that it would need to be accessible to those accounts.

  • Terminating ssl on a bigip, disco and oid running on the same machine

    hi,
    please could someone point me in the right direction.
    I have a working discoverer server 10.1.2 running on a host on 7777
    I have a working 10.1.2 SSO and OIM 10.1.2 server running on the same host on port 7779
    Everything works fine with OID authentication being forwarded to AD servers.
    I'd like to put a bigip in front of the SSO server and terminate the SSL on the bigip, because this seemed to be simplest.......
    The bigip docs say delete the SSO Server from the partner apps (this isn't possible from the SSO web interface, I can only view it).
    I need to get discoverer to connect to the https://[bigip] for SSO authentication.
    I know I need to use ssoreg.sh to do this, the combination of commands eg which homes to use I am having difficulty getting right.
    Thanks in advance,
    Robbo

    And also, how I can interchange message between independent applications (or services) on the same computer?The same way you would interchange messages between them if they were running on different computers.
    You already seem to understand the concept of clients and servers passing messages between each other. There is nothing to prevent a "server" from being a client of another server. And there is nothing to prevent a client from running on the same computer as a server.

  • How can I convince iTunes that this is the same machine to avoid installing all my iPod Touch Apps?

    I've had to rebuild my hard drive and reinstall all the software. What a pain.Now iTunes wants to tell me that I am re-syncing from a new machine and wants to reinstall all of my Apps. It is the same machine, and all the Apps show up in iTunes that are on my iPod Touch. I do not want to have to reinstall all of the iPod Apps and try to restore all of their data. How can I convince iTunes that this is NOT a different machine?

    If you are using iTunes version 7 or later, then you can transfer purchased iTunes store music from the iPod to an authorized computer by using the "file/transfer purchases from iPod" menu. Note that the maximum of 5 authorized computers applies here.
    For all other non purchased music (your own CDs etc) try this method which works on some Windows PCs.
    Enable your iPod for disk use.
    See: iPod Disk Use.
    Open iTunes and select edit/preferences/advanced/general. Put a check mark in the box marked "copy files to iTunes music folder when adding to library" and also "keep iTunes music folder organized", then click 'ok'.
    Connect the iPod whilst holding down the shift/ctrl keys to prevent any auto sync, and if you see the dialogue window asking if you want to sync to this itunes library, click 'no'.
    Then go to file/add folder, open 'my computer', select your iPod and click 'ok'.
    The music files should transfer to your iTunes.
    If this doesn't work (and it may not because officially it's not supposed to), check out the instructions/suggestions here.
    Music from iPod to computer (using option 2). This a manual method using "hidden folders" and although it works, it can be messy.
    Much easier ways are to use one of the many 3rd party programs that copy music from the iPod to the computer.
    One of the most recommended is Yamipod. This is a free program that transfers music from iPod back to the computer. However, it does not transfer playcounts/ratings etc.
    Another free program is Pod Player.

  • How to find out PR and PO with the same requestor and approver

    object class = 'banf'
    object value = PR or PO Number.
    CDPOS - Fname ='FRGZU'
    CDHDR - Object class = CDPOS - Object class and
    CDHDR- Object id = CDPOS - Object id and
    CDHDR - Changenr = CDPOS - Changenr and
    CDPOS - Fname = Frgzu.
    This is the logic can any one help me in getting the code

    HI Param
      I am somewhat confused with your requirement, is it to find the same reqested/ approver or to check the release status of PR/PO as you are using field FRGZU which indicates the release status of PR/PO.
      Anyhow as per below conditions:
      OBJECTCLAS is 'EBAN' for PR and 'EINKBELEG' for PO. Note that itz case-sensitive, hence use upper case.
      OBJECTID is the document number
      Please try to use FM: CHANGEDOCUMENT_READ for the same. This might be more convinient for you. Also try to restrict with date criteria.
    Kind Regards
    Eswar

  • How many iPhones & iPads can I run from the same Apple ID

    My family now have 2 iPhones 2 iPads & an iTouch - I only have 1 apple ID and up until now have linked all the devices to this ID but now the iMessage & Facetime are all linked together so when I text my wife it also comes up in my sons iPad mini & all the other devices. Can I run more than 1 device from the same Apple ID?

    Obviously you can. I don't think that's what you meant to ask... Would you care to clarify?
    The maximum number of iDevices that can use a single Apple ID is 10, by the way.

  • Can 2 separate Planning Servers be running on the same machine?

    Dear All,
    We are trying to setup Hyperion DEV and SIT environments into the same AIX server. We have
    Shared Services
    Essbase
    EAS
    APS
    Financial Reporting
    Planning
    Oracle Application Server 10g
    Oracle 10g DB
    We use 2 separate user accounts and different HYPERION_HOME and ORACLE_HOME.
    Everything seems fine except the Business Rule. When trying to pick the Planning locations, it's always pointing to the first instance of the Planning server.
    I think it is related to the RMI registry service which is used to establish a communication between Planning, Essbase and HBR/EAS.
    I am also running 2 RMI registry services on two different port. However, how can we tell the Planning, HBR/EAS to use which one for communication.
    Any idea?

    I found that the table HEAS.HBRPLUGINDATA contains the correct Planning RMI Port. It seems that EAS is talking with the correct RMI and Essbase Server.
    I can submit business rule in Planning. However, I still can't submit business rule in EAS. Any idea?

  • Sending mail with php via postfix to EIMS running on the same machine.

    Hello it was suggested I clarify and repost this question as previously I had posted it in a already answered thread,
    I am running EIMS as my mail program on my Mac OS 10.4.6 Server for email.
    http://www.eudora.co.nz/
    I need to send email through the standard php mail command from my php scripts because many scripts written by others use this command. (Rewriting all the php apps written by third parties to uses another mail library is not an option.)
    This forces me to use postfix to send the emails. I have already tried the EiMS command line tool and this program is not up to the task.
    I had postfix configured properly as a "Null Client" so that postfix delivers mail to another server and doesn't try to deliver mail to itself or listen for new mail coming in. I got the instructions for the null client from here:
    http://www.postfix.org/STANDARDCONFIGURATION_README.html#nullclient
    This was working fine but I have changed my server to use open directory and in the process, I had to change the hostname of my server from shenzhenparty to shenzhenparty.com. My original server name was not a fully qualified domain name and so postfix didn't know it was sending mail to the same server. Now postfix is able to detect a mail loop again.
    You can take a look at the log below:
    May 29 14:30:21 shenzhenparty postfix/cleanup[23298]: 506E15F725C: message-id=<[email protected]>
    May 29 14:30:21 shenzhenparty postfix/qmgr[23034]: 506E15F725C: from=<[email protected]>, size=868, nrcpt=2 (queue active)
    May 29 14:30:21 shenzhenparty postfix/error[23301]: 506E15F725C: to=<[email protected]>, relay=none, delay=0, status=bounced (local delivery is disabled)
    May 29 14:30:21 shenzhenparty postfix/smtp[23302]: warning: host mail.shenzhenparty.com[210.17.235.228] greeted me with my own hostname shenzhenparty.com
    May 29 14:30:21 shenzhenparty postfix/smtp[23302]: warning: host mail.shenzhenparty.com[210.17.235.228] replied to HELO/EHLO with my own hostname shenzhenparty.com
    May 29 14:30:21 shenzhenparty postfix/smtp[23302]: 506E15F725C: to=<[email protected]>, relay=mail.shenzhenparty.com[210.17.235.228], delay=0, status=bounced (mail for mail.shenzhenparty.com loops back to myself)
    May 29 14:30:21 shenzhenparty postfix/cleanup[23298]: 5B1C55F725E: message-id=<[email protected]>
    May 29 14:30:21 shenzhenparty postfix/qmgr[23034]: 5B1C55F725E: from=, size=2809, nrcpt=1 (queue active)
    May 29 14:30:21 shenzhenparty postfix/qmgr[23034]: 506E15F725C: removed
    May 29 14:30:21 shenzhenparty postfix/error[23305]: 5B1C55F725E: to=<[email protected]>, relay=none, delay=0, status=bounced (local delivery is disabled)
    May 29 14:30:21 shenzhenparty postfix/qmgr[23034]: 5B1C55F725E: removed
    Postfix seems to have an option for everything, doesn't it have an option to disable this loop back check? i have looked through all the options and have not found a way. Below is my postfix configuration in case that helps:
    shenzhenparty:~ deverman$ postconf -n
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    debugpeerlevel = 2
    html_directory = no
    inet_interfaces = localhost
    local_transport = error:local delivery is disabled
    mail_owner = postfix
    mailboxsizelimit = 0
    mailq_path = /usr/bin/mailq
    manpage_directory = /usr/share/man
    mydomain = shenzhenparty.com
    mydomain_fallback = localhost
    mynetworks_style = host
    myorigin = $mydomain
    newaliases_path = /usr/bin/newaliases
    queue_directory = /private/var/spool/postfix
    readme_directory = /usr/share/doc/postfix
    relayhost = mail.shenzhenparty.com
    sample_directory = /usr/share/doc/postfix/examples
    sendmail_path = /usr/sbin/sendmail
    setgid_group = postdrop
    smtpdtls_keyfile =
    unknownlocal_recipient_rejectcode = 550
    As postfix has given me a lot of trouble on this issue I don't see switching from EIMS to postfix as a viable option just to get php emails working on a Mac OS X Server. I also do not want to use an additional IP just to get emails working either because if I have to do that I might as well move to a managed solution on a linux box.
    I hope someone has a suggestion. Thanks

    You can add a private IP address so that one mta listens on the public and the other listens on the private. The ISP would not be routing the private IP, so there would be cost or even knowledge of the private IP.
    I'm not saying that's an solution to your issue- but clarifying that it's easy to add alternate private IPs to an interface.
    Jeff

  • How to configure a second apache instance on the same machine?

    Hello,
    We are in the process of migrating our client server application to web. We are using 9iAS (release 1), forms and reports 6i.
    We installed 9iAS (Rel. 1) on Solaris platform. This instillation is our development platform. We need to create a second instance on the same Solaris box. What steps are to be taken to create this new instance on the same box?
    Any pointers or documentation are appreciated.
    Thanks in advance.
    Arun.

    You can create a 2nd service and copy all config files involved and change the contents of the files. E.g. create httpd_2.conf etc. etc. You will find that this is an endless process.
    What I usually do is create another Oracle 9iAS home (iSuites only). The installer automatically assigns a new port number and creates new config files.
    You do not have to install a 2nd Developer home. Instead, create a second environment file, e.g. (paths are clearly for Windows in my example):
    <ORACLE_Dev6i_HOME>\Forms60\Server\Apptest2.env
    Edit <ORACLE_9iAS_HOME>\Apache\Jserv\Servlets\zone.properties and add the following lines:
    servlet.oracle.forms.servlet.ListenerServlet.initArgs=EnvFile=D:\Oracle\Dev6i\forms60\server\default.env
    servlet.servletApptest2.code=oracle.forms.servlet.ListenerServlet
    servlet.servletApptest2.initArgs=EnvFile=D:\Oracle\Dev6i\forms60\server\Apptest2.env
    The alias �servletApptest2� is used in the serverURL parameter in the startup html file.
    Do something similar for Reports server. Create a 2nd Reports service and add this services to tnsnames.ora with a different port, e.g.
    RepserverTST2,RepserverTST2.world=(ADDRESS=(PROTOCOL=tcp)(HOST=myhost)(PORT=1951))

  • How to find duplicated files across users on the same mac

    I have an iMac under 10,8,3 with different users. How can I find out the duplicated files ie same file under different users account ?
    Thanks

    You can't. Other user's files shouldn't be discoverable by an user. If they were, then the security model would be broken.

  • How to recover from a lost trust relationship (or zone configuration) between the linux ZCM agent to the Primary Zone server running on the same machine?

    I have tried:
    zac retr, which fails as it says there is no zone to which this agent
    is connected
    zac reg, which fails because of error 34 Invalid device authentication
    information
    zac rereg GUID, which fails because of missing zone (as zac retr)
    zac unr, which fails because of the same error.
    zac ci shows the correct certificates
    almost everything is working except registration refresh and location
    refresh.
    What to do in this situation?
    ZCM 11.2 with latest update (Monthly update 1)
    W. Prindl

    This was yesterday resolved by NTS - you see the "quick" resolution
    time of NTS if you subtract the date of the initial post from the date
    of this post - with an absolutely simple trick, which obviously nobody
    did know of. The support engineer got it from the developer team.
    There is a switch in the
    /opt/novell/zenworks/share/tomcat/webapps/zenworks-registration/WEB-INF/
    config.xml configuration file, with which you can switch authentication
    off for device registration.
    You just need to add <Authenticate>false<\Authenticate> into the only
    configuration this file contains.
    This suppresses the error 34 on device registration and the device gets
    registered correctly upon restart of the zenworks suite. After this is
    done one can change back the above mentioned file to the original state
    and restart the zenworks suite again.
    The solution was really easy to deploy - the time till this resolution
    was found was IMO too long.
    W. Prindl
    W_ Prindl wrote:
    >I have tried:
    >
    >zac retr, which fails as it says there is no zone to which this agent
    >is connected
    >
    >zac reg, which fails because of error 34 Invalid device authentication
    >information
    >
    >zac rereg GUID, which fails because of missing zone (as zac retr)
    >
    >zac unr, which fails because of the same error.
    >
    >zac ci shows the correct certificates
    >
    >almost everything is working except registration refresh and location
    >refresh.
    >
    >What to do in this situation?
    >
    >ZCM 11.2 with latest update (Monthly update 1)

  • Can we have both 9i and 10g db running on the same machine

    Hi,
    I want to to exp/imp upgrade of my 9i db to 10g db.
    Can I have both 10g and 9i installed on the same server?
    Thanks,
    Kavitha

    Yes, provided that the HW, OS version and Patch level are certified for both 9i and 10g.
    Install 10g into a seperate ORACLE_HOME -- whether under the same "oracle" account or a different (e.g. "oracle10g" account).
    However, you should consider 11g as 10g is being desupported this month (i.e. no new patches / fixes will be available for 10g)
    Hemant K Chitale
    Edited by: Hemant K Chitale on Jun 9, 2010 10:58 AM

  • How to resolve the issue of DS 3.2 and BOE XI 3.1 running on the same PC.

    How can I run  both Business Objects Enterprise and Data Services Java app on a single PC?
    I have installed BOXI 3.1 SP3 and Data Services 3.2 on  my demo laptop window 7 64-bit enterprise.
    I am having a  issue of DS 3.2 and BOE XI 3.1 running on the same machine using Apache Tomcat." can't login DS"
    Step 1. Installed BOE 3.1 first then DS 3.2 no problem logging to the CMS and Infoview Apache Tomcat/5.5
    current URL: web app: http://sapdemo:8080/CmcApp/logon.faces
    I can't login the but can't login DS data management console java app java tomcat apache web app Current URL: http://sapdemo:28080/DataServices/
    Step 2: re-install DS keeping  the same Apache Tomcat/5.5 directory under Business Objects Dir.
    Recommended Solve:
    How can I make both BOE and DS work using Java Web app works on a single machine?
    What is the need to assign different ports 1 for BOE CMS and another DS admin console?
    Should I install java tomcat apache web app in the different for BOE?
    Thanks
    Rod

    Hi Rodney,
    I would suggest you post this question into the Data Services / EIM Forum.
    regards
    Ingo Hilgefort

Maybe you are looking for