Can multiple processes access 1 class exclusively

hi,
i have three listener programs running in 3 consoles which listen to different queues.now i have a conection program which i call from my 3 listeners.the problem is that only 1 connection must be made at one time.i tried implementing the connection class as a singleton,but it doesnt work as the 3 listeners operate as 3 diff processes(my understanding).however if i implement all 3 listeners in 1 single program and start 1 program in console then the singleton works fine. so my question is is there a way i can synchronize the connection class from 3 listener programs running seperately in different consoles???
maybe my understanding is wrong.excuse me if it is.
any help will be highly appreciated... !!!!

You could either run your three listeners as three threads in the same VM as the connection, or you can construct a means to enforce single access. Here are several possibilities for the latter. Some are better than others:
* When a listener wants to connect, he opens a server socket on a particular port. The OS will only allow one listener on a port at a time, so while one listener holds the port, the others will wait their turns. The port is only used as a token to say whose turn it is.
* Have the listeners open a separate connection to the connection program, to tell it when they want their turn. The connection program then tells each listener when it's his turn to open the "real" connection.
* Have a separte process that accepts multiple connetions and recieves requests from the listeners, then forwards them on one-by-one to the connection program.
* Give each listener a fixed block of time when it can connect. For example: L1 connects when minute % 9 == 0, L2 when m%0 ==3, L3 when m%0==6
Or, you could remove the one-connection-at-a-time restriction. Is there a good reason to keep it?

Similar Messages

  • Can multiple PCs access one remote panel at the same time?

    I've written a program in labview 7.1 to monitor/control a labview application running in the test cell through Remote Panel. I and my coworker can remotely monitor and/or control this labview application individually. But if my coworker has the remote panel displayed on his PC and I try to get the remote panel on my PC, I get a labview error (63) as below:
    "LabVIEW:  Serial port receive buffer overflow.
    LabVIEW:  The network connection was refused by the server."
    My question is: Can multiple PCs access one remote panel at the same time?
    Thanks in advance!
    Y

    Sorry I wasn't clear. The remote panel license is separate from the number of LabVIEW development licenses. Pricing information on remote panel licenses can be found here.

  • Multiple processes accessing a replicated database

    Hi
    I am after some help with multiple processes and replicated databases.
    I have a primary and secondary database replicated across a pair of servers and this seems to be working well. I'm trying to run another process on one of the machines that opens the environment and databases to view and/or modify the data.
    The problem is that when I run this process it causes some sort of corruption such that the server process on the same box gets a DB_EVENT_PANIC the next time it accesses the database. I would like to understand what I am doing wrong.
    The servers and standalone process all use the same code to open and close the environment and databases (see below). Just calling
         open_env();
         open_databases();
         close_databases();
         close_env();
    in the utility process causes DB_EVENT_PANIC in the server process.
    Can anybody spot what I am doing wrong? I am using DB Version 4.7
    Thanks
    Ashley
    open_env() {
    db_env_create(&dbenv, 0);
    dbenv->app_private = &my_app_data;
    dbenv->set_event_notify(dbenv, event_callback);
    dbenv->rep_set_limit(dbenv, 0, REPLIMIT);
    dbenv->set_flags(dbenv, DB_AUTO_COMMIT | DB_TXN_NOSYNC, 1);
    dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT)
    int flags = DB_CREATE | DB_INIT_LOCK |
              DB_INIT_LOG | DB_INIT_MPOOL |
              DB_INIT_TXN | DB_RECOVER | DB_THREAD;
    flags |= DB_INIT_REP;
    dbenv->repmgr_set_local_site(dbenv, listen_host, port, 0);
    dbenv->rep_set_priority(dbenv, 100);
    dbenv->repmgr_set_ack_policy(dbenv, DB_REPMGR_ACKS_ONE);
    for (x = 0; x < num_peers; x++) {
    dbenv->repmgr_add_remote_site(dbenv, peers[x].name, peers[x].port, &peers[x].eid, 0);
    dbenv->rep_set_nsites(dbenv, num_peers + 1);
    dbenv->open(dbenv, ".", flags, S_IRUSR | S_IWUSR);
    dbenv->repmgr_start(dbenv, 3, DB_REP_ELECTION);
    sleep(SLEEPTIME);
    close_env() {
    dbenv_p->txn_checkpoint(dbenv_p, 0, 0, 0);
    dbenv_p->close(dbenv_p, 0);
    open_databases() {
    db_create(&dbp, dbenv_p, 0)
    flags = 0;
    if (app_data->is_master)
    flags |= DB_CREATE;
    dbp->open(dbp, NULL, "primary", NULL, DB_HASH, flags, 0);
    ... Wait for db if slave and ENOENT ...
    primary = dbp;
    dbp->open(dbp, NULL, "secondary", NULL, DB_BTREE, flags, 0);
    ... Wait for db if slave and ENOENT
    secondary = dbp;
    while (app_data->client_sync) {
    sleep(SLEEPTIME);
    close_databases() {
         secondary->close(secondary, 0);
         primary->close(primary, 0);
         dbenv_p->txn_checkpoint(dbenv_p, 0, 0, 0);
    }

    Running recovery (DB_RECOVER flag to env->open()) must be done only in the first process to open the environment.
    This is a general rule of Berkeley DB, not specific to replication. You can read more about it in the Reference Guide, on the page entitled "Architecting Transactional Data Store applications".

  • Can multiple users access apps

    Just migrated to 'The Mac', need a word processor, if I have different user accounts on the iMac can they all access iWorks if I buy it?

    yes, all the accounts on the computer should be able to access iwork or ms office.  if you need to use it on multiple computers there are multi-user license versions available. 
    -mvimp

  • Can multiple users access apps purchased from another Apple ID account?

    I have several iMacs under my control. I need to find a way to download iLife using one Apple ID, so I can have all users on each machine to also have access to the updated iLife suite.
    Is it possible for other users to access an app that was purchased from another Apple ID. If one purchases an app, does the machine allow access to all the users?
    (I know those two last sentences are redundant, but I want to make sure everyone understands problem).
    I've read countless articles on this, and can't seem to catch a break from the problem.

    If this is in a school of some type or a corporate learning center with multipple Mac computers you should contact Apple directly and ask them for help in getting a version that can be installed on multiple Mac with out have to down the updates to each computer individually.

  • Can Multiple Applications Access same DAQ ni usB-6289 device?

    I have to Run Multiple Instances of a LabVIEW Executable Simultaneously. Is it possible to access the same DAQ ni usB-6289 device for all of the LabVIEW instance?
    Thanks.

    dianageorge a écrit :
    I have to Run Multiple Instances of a LabVIEW Executable Simultaneously. Is it possible to access the same DAQ ni usB-6289 device for all of the LabVIEW instance?
    Thanks.
    Never tried it but I doubt you will be able to acces the DAQ simultaneously, To verify it try accesing the DAQ in LabVIEW and in MAX at the same time.
    Ben64

  • Can multiple devices access drives connected to Airport extreme at the same time?

    i have a few days to decide before someone gets me either an airport extreme or a decent NAS adapater to using with my existing airport express, from the US. my airport express serves me good for all my networking needs but i have decided to take my portable media wireless.
    i wanna know which will be the best option? to plug in the portable hdds to an a.extreme via a usb hub and share it across devices or to do the same with a nas adapter using my existing current generation a.express?
    i got ios, android, mac and windows devices on my network. and an apple tv.
    please share ur thoughts.
    Neerav

    Express is slow ethernet.. 10/100 only. The max speed of any connection to a USB hard disk is limited severely by the 100mbit..
    USB is always slow btw.. This is actually a poor way to share a drive. A cheap NAS.. ie ethernet to Sata directly is far far superior and a single disk NAS can be had cheaply.. you will never get close with USB in network situations.
    If you use a hub though, you can plug multiple disks into an Extreme.. I guess the network speed is at least no worse than the USB hub -- ethernet devices which are lousy as a whole.
    Never forget you have the fastest ethernet adapters and fastest possible connectors already on computers on the network.. people are so utterly mesmerized by NAS they forget.. a FW800 or better USB3 if you have a newer computer shared to the network from a computer has much higher throughput and is much cheaper than even the very low end network stand alone boxes.

  • Can multiple Macs access the same firewire volume simultaneously?

    I have a firewire drive and hub, and two Mac Minis. I would like to use this hardware to build an Oracle 10g Real Application Cluster (RAC). To do this, both Macs would have to be able to read/write blocks on the same volume on the firewire drive (Oracle prevents collisions). Newer Linux kernels have support for doing this. It seems that the Mac OS X Server 10.3.4 that I am using blocks at the volume level by node. It would seem to preclude my using this hardware unless I devote another machine to being an NFS server for the shared storage. I'm looking for possible kernel tricks to get this to work.
    Jeremiah
    Mac Mini   Mac OS X (10.3.4)  

    According to Oracle's white paper on RAC:
    The type of disk storage used can be network attached storage (NAS), storage area network (SAN), or SCSI disk.
    It does go on to say:
    Alternatively Oracle supports the use of raw devices and some cluster file systems such as Oracle Cluster File System (OCFS) which is available on Windows, Linux and Solaris
    I suppose if Oracle is taking over the raw device, support might be possible, but OCFS is not available for Mac OS X.

  • Can multiple users access 1 iCloud account for file sharing?

    I work in a team where everyone has an ios or mac device. Is it possible, if i were to create a new @me.com account, for all team members to use this as their iCloud ID and therefore be able to share documents?
    Would there be a limit as to how many users could do this?

    Ok have just spoken with Apple Support and the guy didn't fill me with confidence in terms of his knowledge.
    He stated that the max users sharing a iCloud account would be 11 (random number IMO). Also that we could only share/edit docs if we were on the same network which kind of defeats the point.
    Can anyone verify or correct me on the above?

  • Can multiple users access the account and use services on different computers?

    ?

    Hi vighter,
    A subscription is tied to an invididual Adobe ID and password. The licensing agreement allows that user to access the subscription on up to two devices, but not at the same time.
    Best,
    Sara

  • Multiple RO processes accessing replicated client?

    Hi. I have a question about using replication. (Under Linux if it makes any difference).
    Is it possible to have multiple processes sharing a set of replicated db files? I would only have one process updating the environment, and only to the extent of running the replication manager
    to get updates from the master; we would never have the clients write anything out. The other processes would only open the files read only. The docs are a bit unclear on the subject and as to whether this is a supported configuration.

    Hey Matthew,
    That configuration is supported. The only constraint on multi-process access relates to processing incoming messages (which the replication manager takes care of). As long as only one process calls DB_ENV->repmgr_start, other processes can open the environment for read-only access.
    Michael.
    P.S. For future reference, we've got a separate forum for Berkeley DB HA:
    Berkeley DB High Availability (Replication)

  • Managing Multiple threads accessing  a single instance of a class

    Hi,
    i have to redesign a class, say X, in such a way that i manage multiple threads accessing a single instance of the class, we cannot create multiple instances of X. The class looks like this:
    Class X{
    boolean isACalled=false;
    boolean isInitCalled=false;
    boolean isBCalled=false;
    A(){
    isACalled=true;
    Init(){
    if(!isACalled)
    A();
    B();
    C();
    isInitCalled=true;
    B(){
    if(!isACalled)
    A();
    isBCalled=true;
    C(){
    if(!isACalled)
    A();
    if(!isBCalled)
    B();
    }//end of class
    Init is the method that would be invoked on the single instance of this class.
    Now i cannot keep the flags as instance variables coz different threads would have differrent status of these flags at the same time, hence i can make them local, but if i make them local to one method, the others won't be able to check their status, so the only solution i can think of is to place all the flags in a hashtable local to method INIT AND INITIALIZE ALL OF them to false, as init would call other methods, it would pass the hashtable reference as an additional parameter, the methods would set the flags in the hashtable and it would be reflectecd in the original hashtable, and so all the methods can have access to the hashtable of flags and can perform their respective checks and setting of flags.
    This all would be local to one thread, so there's no question of flags of one thread mixin with the flags of some other thread.
    My question is :
    Is this the best way, would this work?
    In java, everything is pass by value, but if i pass the hashtable reference, would the changes made inside the called method to the hashtable key-value would be visible in the original hashtable declared inside the calling method of which the hashtable is local variable?

    In Java object variables are passed "by copy of reference", and primitive variables "by value".
    The solution with HashMap/Hashtable you suggest is ok, but I think you should read about ThreadLocal class:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html

  • Can I have multiple computers accessing one iTunes library simultaneously?

    I've purchased a Lacie Network HD that I'm keeping all of my iTunes on. I've put an alias to the iTunes library from that drive in the music folders of the computers I want to access and update it. That all works well. The only problem is that both computers cannot have iTunes running at the same time. I get an error stating that the library is locked. It would appear that I can't have multiple computers accessing the library at the same time. Is there a work around for this aside from doing network sharing via iTunes? The reason I don't want to do that is that I want both computers to have access to the actual files if I'm using the various iLife apps that use iTunes.

    Scott
    The only problem is that both computers cannot have iTunes running at the same time. I get an error stating that the library is locked. It would appear that I can't have multiple computers accessing the library at the same time
    This is true. It's not a server app.
    The nearest thing would be a library file on each machine pointing to the same set of music files. However, you might have problems if both machines try to access a particulat track at the same time. Also, changes made on one machine would not be reflected in the other. So if you rip a CD on one, the files will also have to be 'imported' to the other.
    Regards
    TD

  • Can Multiple Webgate/OAM/IdentityStores access one multitenant WLS domain?

    Can multiple access points ( web tier + OAM + Identity store) access one application?
    The objective here is to have one multi-tenant ADF application accessed by users who are authenthicated by their own enterprise sso and identity store. Authenthicated session should pass the context with list of all enterprise roles that user belongs to which would be used for authorization by the multitenant application. It is assumed here that naming convention for relevant roles is followed by all participating identity stores.
    Can Webgate/OAM and accessed WebLogic domain be configured to accomplish this?

    OAM can pass as header variables all of the things you mention. For example, you get these by default:
    OAM_REMOTE_USER containing the userid of the logged in user (eg "jsmith")
    HTTP_OAM_IDENTITY_DOMAIN containing the name of the Identity Store that the logged in user belongs to, as known to the OAM admin console (eg "SunLDAP")
    additionally you can define a headervar that contains the user's ldap group membership, and one that contains the user's full DN (or any other attribute and other information).
    Of course, any receiving app would need to be configured to consume this information.
    Regards,
    Colin

  • Can multiple LabVIEW programs simultaneously access the same NI-DAQmx hardware?

    I am developing a test station system that, in essence, runs several
    seperate LabVIEW programs simultaneously on the same computer, each
    controlling a different set of I/O channels on one shared set of NI
    DAQ hardware (analog and digital I/O PCI boards with external signal
    conditioning).
    I have already gotten a system like this running almost flawlessly
    using LabVIEW 6.1, NI-DAQmx 7.1 with traditional channels, and older
    E-series DAQ hardware. So long as two programs do not try to write to
    the same output channel simultaneously, everything works exactly as
    expected--I can even read from the same (named) channel simultaneously
    from more than one program. The only issue I have had is that if
    one
    of the compiled applications is closed (not just stopped, but closed)
    while others are still running, Windows XP (SP1) will bluescreen on a
    driver error. This is undesireable, but acceptable (though if there's
    a fix/workaround, I'd love to hear it).
    I am now building a similar system using mostly the same software
    (with an upgrade to LabVIEW 7.1), and I've noticed that the new
    M-series DAQ hardware seems to offer much more bang for the buck than
    old E-series hardware and its kin.
    My question is this: It appears that I/O on M-series hardware must be
    performed with new mx channels, with traditional channels not being an
    option. I am therefore wondering if I will be able to do this kind of
    multiple simultaneous access with mx channels, or if I must purchase
    the classic hardware and use traditional channels for this somewhat
    unorthodox application.
    (Incidentally, the multiple simultaneous program thing is a
    requirement for this system, as it is the only clean way to run
    multiple
    identical copies of the same complete program that only
    operate on different I/O channels, and re-doing the program from
    scratch is not an option.)

    Dear Anonymous,
    Thank you for contacting National Instruments.
    To address your question, I don't know if multiple simultaneous access with mx channels is possible, but I do not see why it wouldn't be. The best way to find out would be to test it. I don't have your program or hardware, so I'm pointing you to some Compatibility VIs. These are VIs that look exactly like Traditional DAQ VIs except that underneath they call the DAQmx driver instead of the Traditional DAQ driver. If your device works when you substitute these Compatibility VIs in for the Traditional DAQ VIs, then you'll know the M Series boards will work for you.
    Here is the link for information about the Compatibility VIs:
    http://digital.ni.com/softlib.nsf/954feaeea92d90918625674b00658b
    83/9d67f671bcc6850586256e630059308b?OpenDocument
    Let me know if you have any further questions or if this does not resolve your issue.
    Thanks again and have a great day!
    Chad AE
    Applications Engineer - National Instruments

Maybe you are looking for