How to make a only one spectified type object running at the same time ?

I want to run specified function with java program in unix,AIX environment.But i want only one specified type object can run at this time when i make command "java xxx &" several times at this time.I had used thread but it can not work. I think there are two processes for system so it can not work. Which class or way in java can i use for this problem ? or I use thread in the wrong way.
please help me . thank you everybody !!!
ps:the command "java xxx &" mentioned above,xxx is name of java program ,
& means command run in background.

RMI is a good option you can think of. There is one registry and only one object can be bound to it with a specified name. But if your application is large, RMI calls can really slow down your application.
Another option is to use Sockets. When you load the application check if you can start a server socket on a particular port. If you can, then start the program. If not, another application is already running. So exit your program. The socket you have created will be used only to bind to a particular port. In any system, there can be only one socket bound to a port and this guarantees the single instance running. When your application closes, close the socket too.

Similar Messages

  • How to control more than one instrument via different interfaces at the same time

    Hi, I am new to Labview.  I am working in a project where I have to make a Automated testing tool . So, here is the set up -  I have a Chip on a board to which there are several instruments connected namely Agilent power supply, Agilent pattern generator, oscilloscope,Dmm and Thermotron. All these instruments will be connected to the host computer via ethernet, GPIB or RS232. I have to write a program on Labview where the program  should be able to communicate with these  instruments  at  the same time  and show the ouput  on display unit . I have to run the program once, should be able to view the ouputs. So, Is it possible to write such program in Labview??.  I have  downloaded  few instuments  drivers. Is it possible to combine those intrument drivers and construct a new VI which would be able to control all this ??   Will it be easier to program this on Labview or  I should  go for Labwindows/CVI  ??.
    Please mention some useful sites or tips (if u know) for writing program.
    Thanks in advance
    shasanka

    Hi Shasanka,
    ofcourse it's possible to control more than one instrument at a time.
    You should use the VISA routines to access all your devices. Every device get it's 'address' as 'VISA resource name'. This resource name contains information on the used bussystem and the (internal) device address (i.e. GPIB devices have an address number).
    So I suggest to read the manual and to look at the examples that come with LabView!
    And (from your question) it seems you should take the 3 or 6 hour seminar as well! (Look at www.ni.com -> academics.)
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Why only 1 form can be running at the same time?

    Hello guys,
    I wonder if you can help me..
    At the company i work in, some application has a problem where the same applicatoin can not be opened if there are already somebody else opening the same application. what is the cause of this behaviour?
    another problem is some computer generate SSL integration error messages when trying to open an application. While at other computer the application run fine. Any idea why this happen?
    thanks in advance

    At the company i work in, some application has a
    problem where the same applicatoin can not be opened
    if there are already somebody else opening the same
    application. what is the cause of this behaviour?A record is probably locked. This can happen when one user is updating a record and another user tries to update the same record before the first user is done (committed the record).
    another problem is some computer generate SSL
    integration error messages when trying to open an
    application. While at other computer the application
    run fine. Any idea why this happen?Hard to say without knowing the error message.

  • Multiple Libraries for Video running at the same time on one PC

    Hi Everyone -
    I want to clarify this is for VIDEO files, not music for my 6 ATV's on the network.
    Problem: I have well over 1000 VIDEOS in my iTunes Library, and I am wanting to have multiple libraries availible at the same time; not just whichever the computer has open.
    We have several atv's on the network and I would like to take my video organization one step further; instead of scrolling forever in the atv menus for the video you want; I could make several libraries all availible at the same time. 
    Such as:
    Kids Library
    Workout Library
    Parents Library
    etc
    This in turn would shrink the primary library and have less videos to sort by.  I know how to create the Libraries, I just dont know how to have them all running at the same time.
    Infastructure:
    Windows 7 Ultimate with Drobo B800FS (16TB of storage) all connected to Cisco 3660 Gig switch with multiple atv's hardwired back.

    iTunes can only open one library at a time. If you have multiple computers, or virtual machines, each could be serving a different library.
    tt2

  • How many threads can be running at the same time

    Hi!!
    Dows anyone knows how many Threads can be running at the same time in the JVM.
    I'm making a multi thread client-server app and I would like to know how much simultneous connections the JVM support. I'm using one Thread per connection.

    Hi, thanks to all for your answers.
    I think that I made the wrong question, as you said: "that means the number of threads currently created".
    I'm worry about this because my application is already online (It's a mail server -SMTP and POP3 server using ORACLE for the users database- ) and some other user post in the "multi-tread forum" that almost any JVM can only have 700 threads created at the same time, and I've never heard or read anything about this.
    what you mean with the stack space (memory??)
    I'm using the JavaWebServer 2.0 and a servlet to start the main Thread.
    Again Thanks to all for the answers but I think that the schapel answer is the one that solve my doubt...

  • We are a creative design studio, we need to use apple mac pro server , so we can make more than a different user to use at the same time doing different activities, on different screens, is it possible?what is the max. no. of users that can work efficient

    we are a creative design studio, we need to use apple mac pro server , so we can make more than a different user to use at the same time doing different activities, on different screens, is it possible?what is the max. no. of users that can work efficient.
    Appreciate your support and if possible , how to do this?

    If you want to work with Mac OS X, you need one computer per simultaneous user.
    What you are describing, " Multiple simultaneous logins to a single computer" is not avialable on a regular Mac of any description, unless you decide to use Unix tools instead of Mac OS X.
    Server will happily store files for many, many users and provide them to multiple (up to hundreds) of computers at "near hard Drive" speeds over Gigabit Ethernet. It can make the File Sharing part easy.

  • How do you apply a master page to multiple documents at the same time?

    How do you apply a master page to multiple documents at the same time?

    Hi friends,
    Thank you for trying to help me out.
    Let me explain it a bit to remove the ambiguity.
    I have 10 documents nested under a book. Each of these documents have 'n' number of pages. I want to apply my custom made master page "First" to the first page of all these 10 documents in one go. The remaining pages of the documents have to be in default "Right" master page format. How will I do it?
    I tried selecting all the documents and importing the formats from another document with the custom made "First" master page. The master page format is getting imported but the first page of all the documents still remain with the default "Right" master page format.
    I think now my question is more clear...

  • How do I edit or enter values on multiple sheets at the same time in Numbers?  I can do this Excel but don't know procedure in Numbers.  Thanks.

    How do I edit or enter values on multiple sheets at the same time in Numbers?  I can do it in Excel but I don't the procedure in Numbers.  Thank you!

    The only I way I can think of to modify a single value and have that value change in multipl locations is to have all "the other places" reference a single cell.  There is not way without a referene to modify a set of cells simulateously.
    This may be something like what you want:
    Enter a value in the table "Original Data" cell A1 and the A1 cells of tables Ref1, Ref2 and Ref2-1 will change

  • How can I open two screens of Adobe digital editions at the same time?

    How can I open two screens of Adobe digital editions at the same time?

    I doubt that you can. Doesn't the Sound prefpane require you to select just one output device?

  • Can I pair and use more than one set of bluetooth speakers at the same time on my ipod touch 4.0

    can I pair and use more than one set of bluetooth speakers at the same time on my ipod touch 4.0 or Iphone 4s or Ipad 2?

    You can only connect to one device at a time using Bluetooth, See article below for more information.
    http://support.apple.com/kb/ht1664
    While your iOS device can maintain multiple pairing records, it can only connect to one headset or hands-free device at a time. This prevents your iOS device from sending your data to the wrong Bluetooth accessory.

  • In windows how do we install and activite multiple versions of tuxedo at the same time ?

    Hi All,
    In windows how do we install and activate multiple versions of tuxedo at the same time ?
    Advance wishes

    You can run different versions of Tuxedo on the same server, as long as they are installed in different directories.
    See PeopleTools 8.53 installation manual Task 3-1: Installing Oracle Tuxedo
    You can install Oracle Tuxedo once for each release on a machine, regardless of the number of PeopleSoft
    applications or databases the server supports. For example, if you are a PeopleSoft 9.1 customer and have
    Oracle Tuxedo 6.5 installed, you may install Oracle Tuxedo 6.5 and Oracle Tuxedo 11gR1 on the same
    machine in separate directories. For example:
    On Windows, you may install into C:\oracle\tuxedo11gR1_VS2010 and C:\tux65.
    On UNIX, you may install into /home/oracle/tuxedo11gR1 and /prod/tuxedo/6.5.
    E-TUX: Can Multiple Versions of Tuxedo Coexist on One Physical UNIX or Linux Server? (Doc ID 607828.1)

  • Can I have more than one version of adobe reader at the same time?

    can I have more than one version of adobe reader at the same time?

    If I may add a qualification: on a device running full Windows 8, you may have both Adobe Reader Touch and Adobe Reader (normal desktop edition). This does not apply to the primitive devices which cannot run desktop apps (running "Windows RT"), and while I may be wrong, I believe that the Surface 2 is such a device.

  • How can I listen to itunes and play a game at the same time on my ipad 4?

    How can I listen to itunes and play a game at the same time on my ipad 4? This means I need to run 2 apps at the same time itunes and my game.  The game has its own sound control so I can turn off its sound while i listen to itunes tracks.  But I don't know how to set it up so the ipad does both.

    Anytime you open an app that has a persistant sound stream - a movie, a podcast, some games - it will overide the music app's stream. nothiong you can do to change it.

  • How can you listen to music and play a game at the same time?

    How can you listen to music and play a game at the same time?
    I am playing music, by starting the Crash Baandicoot Nitro Kart 3D game it shuts off the music playing. Is there a way around this?
    It seems like this should be possible.
    Message was edited by: RuthlessVengeance
    Message was edited by: RuthlessVengeance

    Select the music play list you want to listen to and start it playing. Go back to the home screen and start the app you want to use, music will stop. Press the home button two time quickly and it will bring up a simple control for controling the music. This works for me with all of the apps I have purchased including games. Just a note you can pull up the same music control if the iPod is a sleep and locked by pressing the button three times quickly.
    Mike

  • How you create a group to send many txt msg at the same time?

    How you create a group to send many txt msg at the same time?

    The iPhone does not support groups for messaging. There are apps in the app store which purport to be able to do this.

Maybe you are looking for

  • Adobe Media Encoder Install Problem

    Hi- I am encountering some problems when trying to start Adobe Media Encoder. It jumps to two successive "Adobe Media Encoder" install screens (one for the exporter, one for the importer) After some loading time, it displays an error message "Install

  • Moving to Mac from PC: Question about using external HD

    I am trying to figure out how I will move my files from my PC to my new iMac when I get it. This would include favorites/bookmarks, music, document files, pictures, etc. I was looking for clarification regarding the use of an external HD as I have go

  • If you subordinate a keyword by accident, how do you return it to being a non subordinate keyword?

    From time to time I have accidently subordinated a keywork by what appears to a be a slip of the finger. After the key word has been subornated under another keyword I have found it impossible to unsubordinate it.

  • SPRY SLIDING PANELS & DW V.9 BUILD 3481

    Hi Folks, Does anyone know of a way to get rid of the DW error message that pops up when you use the sliding panels widget? If not, I'll submit an SR with the DW folks... Error message upon opening any document in the code window that contains the st

  • Why is my screen not working?

    The screen of my Macbook Pro is not working. It turns on, but my screen is not displaying anything, just a black screen. It worked the last time I used it. When I took it to class, it would work. I'm very careful with it. I put it in a padded area ma