Problems of access to data between threads

I have a singleton who has a painting I want to access it from multiple threads.  I set the table as volatile and initialize it to certain values when you create the singleton.  When my application starts, I create a thread that periodiclly checks that the user made and adds values to the table.    I have a screen displaying, it lists all values in this table.  The wire and the screen become two different instances of singleton.  Entries added in the thread do not appear on the screen.  Any time, the display shows it shows what the table is when the object is first.  When I debug this, all calls the screen makes the get the array of the result singleton in it being created.  Is not possbile to share data between threads?

Here's how to create the instance on the singleton:

private static volatile DataAccess instance = new DataAccess();

I created a simple java file that creates three threads and uses the same object that I use in the blackberry app and everything works fine.  Is there something particular aboue screens that makes them not nice game with wires?

Thanks for your suggestions.

runtimestore is used for exactly that. I don't know of another way to share. You can communicate using world events and have other options, but runtimestore is the easiest.

Tags: BlackBerry Developers

Similar Questions

  • Pass data between panels

    I have a digital slide on a Panel. When I move the cursor, I need the value update on another Panel.

    How can I do this?

    The two panels are loaded as a senior-level windows.

    It seems that I read something on the use of queues to pass data between the panels, but I can't seem to find where I read that.

    A basic concept that differentiate the CVI to other languages, it's that there is no relationship between a sign and a specific source file. I mean, you do not need to put a sign functions in a specific source file: they can be spread over multiple sources; Conversely, you might have a source only that collects reminders for all panels of files in your application. What readers recall execution are Panel handles and control ID. (One effect of this paradigm is, you might have a reminder installed on controls on different panels).

    For this reason, there is no problem by putting the cursor callback in panel1.c. In addition, you can call the file source in a different way.

    Arriving at the base of your problem, a DAQ multithreaded application is really different from a UI single-threaded application.

    Put the functions of data acquisition in a separate thread can be beneficial for your application, because they are not likely to suffer user interface events.

    CVI provides also the different methods of transmission of data between threads. the most powerful in data acquisition applications is probably a Thread Safe queue.

    I suggest you look at Programmer's Reference > chapter of the creating multithreaded Applications to aid, where the basic principles of programming are explained multithreaded and information are provided on all instruments CVI includes.

    If you want to discuss on this scenario, I suggest yu to start a new thread, as it has nothing to do with the original question with which you started this discussion.

  • to access the data of hyperteminal using labview

    Hello Sir,

    I'm a problem to access the data of hyperterminal directly through LabVIEW. Whenever I go to hyperterminal and the text capture option allows you to select data and save it in another file. My application requires automatic access of hyperterminal instead of manually do each and bread time. Is this possible? I enclose a VI that I tried. Please give me a suggestion about the present.

    Do not use hyperterminal. Use the series of VISA. Look at the examples that come with LabVIEW.

  • Zune and Windows 8 "error reading the Zune software cannot access important data on your Zune." Try to disconnect and reconnect it. If the problem persists, contact customer support. "

    I have a Zune and Windows drive * on my desk. Everything worked fine until today while I got the following messages. In Zune: "Error reading the Zune software cannot access important data on your Zune. Try to disconnect and reconnect it. If the problem persists, contact customer support. "" Then on the computer: "USB device not recognized." "

    I have a Zune and Windows drive * on my desk. Everything worked fine until today while I got the following messages. In Zune: "Error reading the Zune software cannot access important data on your Zune. Try to disconnect and reconnect it. If the problem persists, contact customer support. "" Then on the computer: "USB device not recognized." "

    Message error "the Zune software cannot access important data on your Zune.

  • shared object synchronized between threads/listeners

    I don't know if I go about it the correct way.  I'm hoping that someone could help with this situation. Here is basically what I want to do:

    Have a FIFO queue object that contains the data to send to a web application that can be accessed synchronously between threads/listeners.  Given that the coverage of the data can sometimes be slow or even non-existent, I need to wait for the cover, maybe using CoverageStatusListener that runs on a wire and will suspend/resume the thread on state change.  All this must happen without the need of Auditors threads to wait.

    For example:

    data coverage is non-existent

    ListenerA needs to send data, it places in the queue

    data coverage is restored.  Data queue

    ThreadB needs to send the data until the transmission is completed. We need the data in queue

    transmission of complete, passed down from queue data is removed from the queue

    During all this time, I need ThreadB data exist also in the queue object and not be lost when the data is complete and is removed from the queue.  I need ThreadB to continue treatment and do not wait until the transmission is completed.  I played a bit with display of threads that are cycled every five minutes or so if they could not pass successfully, but that logic is not feasible.  Say you are out of the coverage of the data for an hour or two, but you end up needing to pass 50 items.  You have 50 son sitting there waiting to pass.  Or a listener for each point that everyone is trying to send at the same time.  What happens if the device dies or is reset?  I looked at RuntimeStore, but that does not record the data and I don't know what happens when 2 wires need to add data to the queue at the same time.  PersistentStore will not be able to hold the data if/when it becomes too large.

    Here it is the pseudo-code.  I know that some things will probably not work.  Just trying to get down the basic logic.

    public class TestFoo extends Application {
      public static void main(String[] args) {
        TestFoo foo = new TestFoo();
        foo.enterEventDispatcher();
      }
    
      public TestFoo() {
        CoverageInfo.addListener(new CoverageListener());
        ThreadA threadA = new ThreadA();
        threadA.start();
        ThreadB threadB = new ThreadB();
        threadB.start();
      }
      public class ThreadA extends Thread {
        public ThreadA() {
        }
        public void run() {
          while (true) {
            //do stuff
    
            if (/*something */true ) {
    
            }
          }
        }
      }
    }
    
    public class HTTPThread extends Thread {
      private boolean suspended;
      private FIFOQueue queue;
      public HTTPThread() {
        setSuspended(false);
        /*
         * get queue from filesystem???
         * or create new queue if not there???
         * load into RuntimeStore???
        */
      }
      public void run() {
        while (true) {
          if (isSuspended()) {
            try {
              wait();
            } catch (InterruptedException e) {
            }
          }
          //fetch queue from RuntimeStore???
          if (queue.isEmpty()) {
            try {
              wait(); //can notify us when an object is added to the queue???
            } catch (InterruptedException e) {
            }
          }
    
          if (hasDataCoverage()) {
            Object obj = queue.getHead();
            boolean successful = false;
            if (obj instanceof MyObject1) {
              MyObject1 myObject1 = (MyObject1)obj;
              //send data based on MyObject1 structure;
              //set successful
            } else if (obj instanceof MyObject2) {
              MyObject2 myObject1 = (MyObject2)obj;
              //send data based on MyObject2 structure;
              //set successful
            } else {
              //not a valid object of mine for some reason
            }
            if (successful) {
              //get queue again from RuntimeStore???
              queue.removeHead();
              //return queue back to RuntimeStore???
            }
          }
        }
      }
      public synchronized void setSuspended(boolean suspended) {
        this.suspended = suspended;
      }
      public synchronized boolean isSuspended() {
        return this.suspended;
      }
    }
    
    public class CoverageListener implements CoverageStatusListener {
      //Only location this will be started so only one instance exists
      private HTTPThread httpThread;  
    
      public void coverageStatusChanged(int newCoverage) {
        if (!httpThread.isAlive()) {
          httpThread = new HTTPThread();
          httpThread.start();
        }
    
        if (newCoverage != CoverageInfo.COVERAGE_NONE) {
          if (httpThread.isSuspended())
            httpThread.setSuspended(false);
        } else {
          httpThread.setSuspended(true);
        }
        httpThread.notify();
      }
    
    }
    
    public class ThreadA extends Thread {
      public ThreadA() {
      }
      public void run() {
        while (true) {
          //do stuff
    
          if (/*something */true ) {
            //Somehow put data into the queue
          }
        }
      }
    }
    

    I think that there are a number of; habits that will help you design it - the producer/consumer and observer patterns come to mind.  I'm not a design guru so will not pretend even to help you work through this.  But all I can say is that models provide generally well thought out structures for the problems that.  I encourage you to read about them.  You might find these useful references:

    http://www.javacamp.org/designPattern/

    http://zone.NI.com/DevZone/CDA/tut/p/ID/3023

    In general I'm not comfortable with your overall solution.  I would look at something like that

    (a) offer a 'service' to your users that collects the data to send.  There is no need to be a wire, it is just a method that they call and pass in the data.  These data are persisted.  This method 'Add' is owned by the transmission process and is the only visible part of the outside of the treatment.  This treatment should also begin sending wire (see b) if it is not executed.

    (b) have a thread that attempts to send the data.  You can launch this thread on changes in coverage if you want, but make sure that you can have a single run.  This thread should check coverage before attempting to send anything, and just end if there is no point of trying.

    (c) your submission Thread will get in situations where she send and does not receive a response from there is another error.  In this case I recommend the blocking of the Thread for a time and then try to send again.

    (d), I said in (a) that the add-in has been the only visible part of the outside of this treatment.  However you're better instrument your process so that users can find out if your thread is running, how much he sent, if the last transmission worked or not of data and so on.

    Treatment based on a vector of data to send.  Synchronize on this vector before changing.  In the "add step (a), add an element to the vector."  In processing step (b) delete the first item when you have treated.

    There is a problem with this design in that there may be overlap if the sending thread terminate because it has nothing to do and add treatment add something and does not start the Thread because it is actually running.  You must code carefully around that.

    I hope this helps.

  • W510: How do I access my data from a failed hard drive after the failure of the motherboard

    I made a mistake and has paid for major .

    This error pouring a drink sweet on my laptop. I know, I know, my keyboard can and protect against damage caused by the spill, but it was a drink together. In any case, I panicked and shut down the system and it has upset and removed the keyboard. And be the impatient person that I am, I made what was probably the ultimate error. I do not give everything save a sufficient amount of time to dry and I tried to boot the system. There is my computer. Or at least I think.

    Symptoms: It began at the start, kept a beep, sometime just close and will start.

    In any case, I guess that my laptop went kaput. Now to the point of this thread. I had not been a recent backup and can't remember when the last backup was actually made. Assuming that my hard drive is ok, I want to get all my data, so I saw several options:

    -Send the system to a data recovery service where I will not pay less than $300, but probably 2 to 3 times what

    -buy an equivalent model laptop and put the HARD drive in there

    -by an external SATA hard drive enclosure and mount it via USB on another computer

    I bought a box external and assembled this evening. I had read about the data access of difficulty with a system non-Lenovo because of encryption of the data. I proved that by linking it to my work (a Dell) laptop and I couldn't access my data directories. If I have access to an another Lenovo Thinkpad, I'll be able to access the data if connected via USB? I had read that I can access the contents of disc hard if it is connected to an another Thinkpad, but I knew not that if it means that I have it connected via SATA connection or if there is work through the USB port.

    I'll appreciate any suggestions for accessing my data.

    Best regards!

    All,

    Thanks for the suggestions.

    I was able to recover my computer and all data on it.

    Just to describe what I have done, here are the details.

    Because of my concern about a failure of the motherboard, I bought a used/given new keyboard and an external SATA drive enclosure. I was not able to properly take possession of the car from my other laptop, but I was able to access the data in Mode without failure. With my data, I plugged the hard drive and the new keyboard in and started without problem.

    Thanks again,

    brent86

  • Access waveform data passed in a DLL

    Hello

    I'm working on a LabVIEW application that processes the continuous stream, 2 ms/s, 32 analog input channels, each channel. This application has a DLL built in order to improve the table great handling performance in LabVIEW. Initially, I fed the DLL with a double 2D array returned by DAQmx Read VI and worked on a controller embedded high performance. However, the new requirement is, I need to treat timestamps as well as each Read call to HAVE him, and that's why I need to feed the DLL with the waveform data returned by DAQmx Read. Output waveform contains the timestamps I need.

    The problem is, I don't see an easy way to access the data of waveform within the DLL (developed using Visual Studio C++). The type of waveform data seems to be a C++ class, and who looks like I need to add a considerable amount of code to retrieve the data within the class of waveform.

    My question is, LabVIEW naturally does support access to waveform data in a DLL and if there are examples of code? I understand, I can you can also process outside the DLL waveform data and feed the DLL with the array element in the waveform data. However, I have concerns about whether if performance will be significantly affected.

    Thank you!

    Donghui Yin

    Doy says:

    Sorry for the incomplete design details. If you are interested, I have used high cards, not PXI. This is why I don't have a problem of bandwidth PXI. Special assistance, I need right now is the note, 'External Code in LabVIEW using' manual on Page 2-7:

    "Note waveforms, digital signals and digital tables can be passed through shared
    "libraries, but access to the data inside shared libraries is not supported at this time."

    Thank you.

    I think that the text is clear enough! There is no documented API for access to international it data waveform within an external code module. The generated data type the node in library call for such a parameter is HWAVE or something, indicating that it is an opaque handle whose implementation details are deprived of LabVIEW. Since there is no documented API for access to her international of such data there is simply no way to access it.

    And I didn't know all the functions that are exported in the LabVIEW executable that I could easily connect with the waveform dataype. Even if I had, we still do not know the prototype (aka list of parameters and types) of these functions.

    Your only viable solution is to work with the data types supported. Your C code, or possibly the LabVIEW (table handles) native data type, either passing data in table C. else pointer would require reverse engineering of disassembly, a legally questionable approach, but also a lot of your time. And everything you would find this way I would be very hesitant to use in what feels, walks or crawls like a real-world application, since you can't be sure that your conclusions will work for any situation. It is also likely that your results will depend on some attributes may change between versions of LabVIEW.

  • (Question LVOOP) How one access the data of another class in another class?

    Hello-

    Ass title suggests, how do I access another class (or is it class?) data from another (different) class?  I will attach a picture showing where my problem is...

    I was told this:

    http://zone.NI.com/reference/en-XX/help/371361H-01/lvhowto/setting_scope_classes/

    May contain some helful info, but I can still understand how to unbundle Renault of classes inside the component class data (as seen in the attached photo).

    I think there could be something simple I'm missing here when it comes LVOOP or OBJECT-oriented programming in general... If any of you are willing to help me, it would be much appreciated!

    Thank you!

    -pat

    Personal data are always private, you can never set public. Unbundle cluster function can be used only on the thread of class when he is in the class. If you need to access private data, you must create accessors.

    It of simple, just the class right click and select new, VI for access data members. He invites you to a dialog box to fill you with what you want to create, elements of data and if you want them available through property nodes (recommended). Once completed, this will generate the Afterward screw., you can use in any other VI. The nice thing about making them nodes of property is that you can plop down a property node and it thread class, and all the created accessor functions will appear in the list.

  • Very slow access to data on HP MIcroserver Gen8 warehouses. Can not change the system of booking resources with vSphere client.

    I did a clean install of ESXi 6 with HP supplied image (ESXi-6.0.0-2494585-HP-600.9.1.39-Mar2015).
    Access to and from the warehouses of data over network via vSphere Client (6.0.0 - 2502222) is very slow - ~ 10 Mbps (there are several hundred under ESXi 5.5)
    I suspect that ESXi 6 limited CPU resources used by the host to 230 MHz system.
    I can't change the settings 'System Resource Reservation"(unlike ESXi 5.5, where I can change and switch to Simple or advanced mode).

    Hey ArnisR,

    I finally found the problem. In the last 5.5 ESXi and version 6.0, they replaced the driver hpvsa (HP ISO vSphere!). With these drivers, I have known major problems with banks of data and, therefore, the controller B120i (RAID) of the Gen8 MicroServer HP.

    The problem is caused by the last (HP) ISO (from March);

    -Mar2015.iso 5.5.0 - Update2-2403361-HP - 550.9.2.27 VMware ESXi

    -Mar2015.iso 6.0.0 - 2494585-HP - 600.9.1.39 VMware ESXi

    I found out (because I had an older ISO), the ISO VMware ESXi 5.5.0-Update2-2068190-HP-5.77.3-Nov2014.iso works well! With this ISO standard, all performance issues disappeared.

    The difference between the ISO is as follows. The former ISO contains the driver of storage scsi-hpvsa 5.5.0 - 88OEM. ISO (s) of March come with new storage driver scsi-hpvsa 5.5.0 - 92OEM or scsi hpvsa - 5.5.0 - 90. These drivers are the cause of the problems in the controller of B120i!

    Installing ESXi 5.5 or 6 since last ISOs, you must manually install the old driver of storage (SCSI hpvsa - 5.5.0 - 88). I tested with the HPSA file scsi vib - 5.5.0 - 88OEM.550.0.0.1331820.x86_64.vib. Then I adjusted the ISO HP and equipped with the old driver. Now I can install ESXi 5.5 or 6 ISO (custom) of HP, which includes the former driver.

    I hope this helps!

  • Passage of data between functions

    Hello

    Is it possible to pass data between functions? What I try to do is the following:

    I have a private function called onBtnBook which will do what (component .mxml) page of my application will be sent to the user when the user clicks a button. I need to capture the page that the user performed before they have clicked on the button and you can do this by capturing the selectedIndex value in a variable of the ViewStack I use for Navigation and is in my main Application file.

    What I have to do then is when the user clicks the back button, it sends back to the page they were on. I have a second private function called onBtnBack to handle this. However, as I need to use the variable created in the onBtnBook (which contains the value of the selectedIndex of the page that the user did) in my onBtnBack function, to return the user to the correct page, I am short of problems with access to the data in this variable.

    Is there a way to access the data of the variable in the 1st onBtnBook of function and handling in the 2nd onBtnBack of function?

    Thank you

    You must make a public variable and it may be related.

    [Bindable]
    public var myLastIndex:int;

    private function onBtnBook (): void {}
    myLastIndex = viewstack.selectedIndex;

    }

    private function onBtnBack (): void {}
    viewstack.selectedIndex = myLastIndex;
    }

    or something in that sense

  • I had problems with access to most of the Web sites and I noticed that HTTPS is no longer, how do I make permanent HTTPS so I can access any Web site?

    I had problems with access to most of the Web sites and noticed that HTTPS no longer appears whenever I try to access a Web site. I can easily connect to my gmail and facebook account, but the problem is that when I click on a link on FB and gmail, I get the annoying message "refused to connect.

    How to address this issue, rather how to make HTTPS permanent so I can easily access any Web site. The date and time on my laptop are both correct. I am currently using OS x 10.9.5.Please!

    How to address this issue, rather how to make HTTPS permanent so I can easily access any Web site.

    My guess is that you have a damaged or invalid certificate entry OS X KeyChain, but to directly answer this question, I would say that consider you something like HTTPS Everywhere. Note, it is not available for Safari. It is available directly through the Google Chrome browser extensions.

  • Problem with access point or wireless adapter

    Hello world

    tried to connect to my WiFi, but the convenience store detects that the problem with access point or wireless adapter.
    The drivers are up-to-date and functioning normally. There were discussions on BIOS but I don't know if I would be able to complete the task without bricking your laptop.

    Is there any online support?

    Hi smert

    Your message is not really useful.
    Why? Because no one knows all the details of the laptop, wireless network card system...
    So please would you be kind enough to provide more details.

    But despite the missing information, I recommend:
    (1) reset your router WLan
    (2) check the connection to the WiFi unsecured. (of course for testing purposes)
    (3) check the different (WPA/WPA2 AES, TKIP) encryption

  • Tecra A4: Matsu * a s uj - 831 - cannot access any data CD

    Hello

    I have a new toshiba tecra a4
    I have the combo dvd: Matsu * a UJ - 831S
    and I have the following in less than 4 months of use problem:
    Since yesterday I can not access any data cd, audio CD are ok, so on DVD.
    When I go to my computer and click on the drive I get the message "D:\ not accessible incorrect function".

    I tried to uninstall the software, etc. But nothing.
    I tried to boot from the dvd from Toshiba, is the beginning, I tried to boot from cd does not start.
    so the problem is hardware
    I downloaded the firmware (Loder_831_V102.exe), but he said: "the target disk is not connected" and I can't upgrade.

    So what is the problem, can it be fixed?

    Hello

    It's not easy to tell how to solve this problem.
    But first of all, you can try to remove this device in the Device Manager.
    After startup, the operating system should recognize the drive again.

    If this procedure doesn't help, well it could be a disk failure.
    If the warranty is valid, you should ask the ASP for a replacement.

    Good bye

  • How to transmit DATA between several state machines.

    Hi I'm doing a project that needs to acquire data from a simulated data file and display it on a graphical interface. Two of them are manufactured in a state machine. I wonder if it is a good way of communication of data between two state machines? It would be very appreciated if you can provide a few examples. Thank you very much.

    OK, there are plenty of ways to communicate, but who are these state machines in the same project? Same VI? All LabVIEW?

    I like functional global variables due to the functionality that can be included in the. If they are used wrongly, as most of the things with the coding, you will create the races and break your code.

    Work of local variable, but I try to clear them tsar when possible. If they are used wrongly, as most of the things with the coding, you will create the races and break your code.

    Queues are pretty popular to connect, but try to stay with fixed size data, if you think that the limits of memory could be a problem.

    If you speak through the eyes of network to published static Variables (do not use these unless you have a stable network) network, TCP/IP, UDP, or Web Services flow (you need experience in this field. It is not just together.

    LabVIEW is a good way to program, but this kind of key options.

  • How can I access the data associated with an event within the event handler function?

    Hello

    In my LabWindows code, I try to use a DLL that has been developed in .NET (c#).  I used the built-in labwindows Wizard that converts the DLL to a usable 'instrument'.  Almost everything seems to work, except that I have 1 problem.

    There is an event (defined in the DLL) that I am able to detect.  I know that the reminder of the event is called at the right time.  But the problem is that in this function, I can't access the data that is supposed to be attached to the event.  It worked fine in c#, but I don't know how to do in LabWindows.  Here's what looked like in c# event handler function:

    void AppLoaderEventCallback (CommonLib.CommandResult MyResults)

    {

    MyResults is used in the body of this function

    }

    But in LabWindows, I can't seem to access the MyResults data structure.  Here's what I do:

    public static int CVICALLBACK AppLoaderEventCallback (CommonLib_CommandResult MyResults)

    {

    I can't access MyResults here

    }

    Can you help me with this?  I'm doing something wrong?

    Thank you very much for your help.

    -Mike

    I think that your statement of callback function is perhaps not quite correct. Look using the parameter "callback function" function Panel of the generated __Create function associated with this event. This shows the declaration of the callback function - make sure that your callback function is declared in the same way.

Maybe you are looking for

  • In Firefox 9.01 and 10, I find no option to close a window.

    There used to be an option to close this window under file. I don't see this option any more or in another way to close an individual window.

  • C55 - A satellite - 1 K 6 and Win7 - cannot use utility of Toshiba sleep

    Hi everyone; My laptop model is; Satellite C55 - A - 1 K 6 My laptop part name: PSCGAE-04W01GTE I use Windows 7 Ultimate SP1 X 64 on it... TEMPRO told me "install Toshiba official sleep utility program" frequently, but when I download and install, wh

  • Skype all in game

    Hello I use Skype all in game and I wanted to have the option to turn on/off when the microphone is active or cut. I know there is press the button Mute and that works very well, but when I play the game in fact, since the game window is on top of th

  • accidentally turned off during the update of windows

    Guys, im using sony vaio with vista premium OS and it is automatically updated, I had used to remove my battery for use at home, during the update of windows, I accidentally kick off the power cord and it disconnected from the main power switch and t

  • [WRT1900AC] Problems with the subtitles (.) (SRT) with. MP4. AVI and others. MKV videos

    Hello I use the WRT1900ACS 2.0.0.173388 firmware and I noticed a few videos with. Just SRT subtitles does not work on my smarttv via DLNA server. I have some MKV videos with. The SRT subtitles I can perfectly look through DLNA, but. MP4. AVI and othe