About Thread resource (data) sharing

I am new to java. In my project, there is scenario where one thread (Main Thread) creates a resource (data) and create new thread and then that resource (data) needs to be access by thread which is running on same application which is created by Main Thread.How can access a thread resource (data) which is created Main Thread from another thread which also created Main Thread in java?
Thanks,
Sidiq

You could pass it as a parameter to the constructor to your class that implements Runnable (do not extend Thread). Or you could make it available via some globally accessible variable--e.g. a public static member of some class. Or, I think there are tools in java.util.concurrent that you could use for inter-thread data sharing, depending on how things change as you two threads do their work.
You haven't provided enough detail for a more specific answer than that.

Similar Messages

  • Data Driven Subscriptions Error - the query processor could not start the necessary thread resources for parallel query execution

    Hi,
    We are getting the following error when certain data driven subscriptions are fired off: "the query processor could not start the necessary thread resources for parallel query execution".  I've read other posts that have the same error, and
    the solution usually involves adjusting MaxDOP to limit the number of queries that are fired off in parallel.  
    Unfortunately, we cannot change this setting on our server for performance reasons (outside of data driven subscriptions, it negatively impacts our ETL processing times).  We tried putting query hints like "OPTION (MAXDOP 2);" in the reports
    that are causing the error, but it did not resolve the problem.
    Are there any settings within Reporting Services that can be adjusted to limit the number of subscriptions that get fired off in parallel?
    Any help is appreciated - thanks!

    Yes, that is correct.  It's a painful problem, because you don't know which specific subscription failed. For example, we have a data driven subscription that sends out about 800 emails. Lately, we've been having a handful of them fail. You don't know
    which ones out of the 800 failed though, even from the RS log files - all it tells you is that "the
    query processor could not start the necessary thread resources for parallel query execution".
    Thanks, I'll try changing <MaxQueueThreads> and will let you know if it works.
    On a side note: I've noticed that it is only reports with cascading parameters (ex. where parameter 2 is dependent on the selection from parameter 1) that get this error message...

  • Says about formatters(currencies, dates...) well, is relate to user locale, ... what this "user" mea

    I use Flash Builder 4.0.1 standard, I can follow the FX IN A WK (FX B 4.5), without problems or...exist other in my version FX IN A WK (FX B 4.0)?
    in the book ADOBE FX 4 TFS VOL.1, CH.15: USING FORMATTERS AND VALIDATORS,
    Says about formatters(currencies, dates...) well, is relate to user locale, ... what this "user" mean? developer configuration, or server locale or visitors locale? developer configuration how done in the FlexGrocer App?
    ADOBE FX 4.5 TFS VOL.1, 2 again use FlexGrocer App? Where find this volume: ADOBE FX 4 TFS VOL.2?

    Hmm, I'm not able to reproduce your issue.
    I created a simple JSP page with the following:
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <f:view locale="en">
       <f:loadBundle basename="Resources" var="res"/>
       <h:outputText value="#{res.key}"/>
    </f:view>
    [\code]
    I have two properties files with the base name of Resources (Resources_en_US.properties and Resources.properties).
    When I issue a request to the JSP page, I get the localized value from the Resources.properties file.
    I suppose it could potentially be a JDK issue since the loadBundle tag uses java.util.ResourceBundle.  Which JDK are you using?

  • Resource Data Found Damaged: Adobe Elements 10 Organizer.app

    I ran DiskWarrior, which "scanned  the disk named “Macintosh HD” checking all files and folders for damage and potential compatibility problems.
    1 file had resource data that was found to be damaged.
    File:  “AdobeSWFL.rsrc”
    Detected that the resource header is damaged and cannot be repaired. 
    Location:  “Macintosh HD/Applications/Adobe Elements 10 Organizer.app/Contents/ElementsAutoAnalyzer.app/Contents/Frameworks/AdobeOwl.framework/Ve rsions/A/Resources/AdobeSWFL.bundle/Contents/Resources/”
    I deleted Adobe Elements 10, as well as Adobe Elements 10 Organizer, reinstalled Adobe Elements 10, and ran DiskWarrior again.  Again, the same file had resource data that was found to be damaged.
    Should I be worried about the problem?  Has anyone else found the same damage?  What can be done about it, short of Adobe fixing the problem and issuing an upgrade?

    First of all, I personally don't think it's wise to run pre-emptive strikes with repair utilities. Use them when you actually have a problem.
    If you uninstalled PSE by deleting it, you have a problem. You MUST use the uninstaller in Applications>Adobe Photoshop Elements 10. PSE is not a nice tidy package like most mac apps, and there are bits and bobs all over your hard drive. Try running the uninstaller now, but it may well not work. If it doesn't, post back.
    IMHO, running DW unecessarily is more likely to cause problems than to fix them. I'm always hearing from enthusiastic DW users about how it narrowly saved them from a major failure of this or that, while people who don't run these utiities don't have these crises at all. It's great when things really have gone wrong, don't get me wrong. It's the very best for fixing serious problems, but OS X just doesn't need all that maintenance and actually runs better without intervention, most of the time.

  • Dumb question about Thread Safety in Servlets

    Hi all
    I wrote this Client API for sending requests and receiving responses to / from a multivalue database. The API is called by my Servlet. Now it seems my API is not thread safe because when several people open up the servlet at the same time, the API gets totally confused. When the API calls are inside a synchronized(){} it works just fine, but obviously at a big performance hit. Is that the wrong way of doing it??
    However when I was doing the ACID test locally on my machine, by opening two command prompts and excuting the same java program (with the same code in it as the servlet, but standalone) my API worked just fine. How come?
    Any insights appreciated as I am just learning about thread safety now (the hard way :-( )
    cheers
    Dejan

    Does this help
    Are you using one connection to the database shared by all instances
    of your servlet
    And is this connection create in the init method of the servlet and stored
    in the servlet context.
    Problem 4 people try and use your servlet at the same time, each servlet trys to
    create a connection to the database and then store it in the servlet context and
    this causes a problem.
    Solution create a listener to create the connection and store it in the servlet context
    when the servlet is created.
    If this is your problem it is not advisable to use only one connection to the db
    try using db pooling

  • Bad resource data offset 0

    GraphicConverter (an image processing program) is dumping this message onto my console about 2 of my files:
    bad resource data offset 0 and size -928468624 in file
         I routinely check my file system with DiskUtility, Disk Warrior, etc. for any inconsistencies.  I can open the files fine from Finder; what is a "bad resource data offset" and does it mean anything about these files in my file system that I should be concerned about?

    Here's what I see when I do mdls on one of those files:
    kMDItemContentCreationDate
    = 2010-08-25 07:10:09 -0400
    kMDItemContentModificationDate = 2010-08-25 07:10:09 -0400
    kMDItemContentType        
    = "com.adobe.pdf"
    kMDItemContentTypeTree    
    = (
    "com.adobe.pdf",
    "public.data",
    "public.item",
    "public.composite-content",
    "public.content"
    kMDItemDisplayName        
    = "pnas00101-0399.pdf"
    kMDItemEncodingApplications
    = (
    "Apex PDFWriter"
    kMDItemFSContentChangeDate
    = 2010-08-25 07:10:09 -0400
    kMDItemFSCreationDate     
    = 2010-08-25 07:10:09 -0400
    kMDItemFSCreatorCode      
    = ""
    kMDItemFSFinderFlags      
    = 0
    kMDItemFSHasCustomIcon    
    = 0
    kMDItemFSInvisible        
    = 0
    kMDItemFSIsExtensionHidden
    = 0
    kMDItemFSIsStationery     
    = 0
    kMDItemFSLabel            
    = 0
    kMDItemFSName             
    = "pnas00101-0399.pdf"
    kMDItemFSNodeCount        
    = 0
    kMDItemFSOwnerGroupID     
    = 20
    kMDItemFSOwnerUserID      
    = 501
    kMDItemFSSize             
    = 1024494
    kMDItemFSTypeCode         
    = ""
    kMDItemKind               
    = "Adobe PDF document"
    kMDItemLastUsedDate       
    = 2012-05-24 07:57:45 -0400
    kMDItemNumberOfPages      
    = 8
    kMDItemPageHeight         
    = 747.6
    kMDItemPageWidth          
    = 493.44
    kMDItemSecurityMethod     
    = "None"
    kMDItemUsedDates          
    = (
    "2010-08-25 00:00:00 -0400",
    "2012-05-24 00:00:00 -0400"
    kMDItemVersion            
    = "1.3"

  • Import an excel file which contain resource data to P6

    Hii,
    I had a problem of importing an excel file into p6 which contain resource data to p6.
    I used the import option which is present in file-import i followed the instruction and at last while clicking the finish tab its showing the import was successful.
    But in the resource it is emplty unable to display a single resource.
    plz help me or is there any other procedure for it plz let me know.
    Best regards
    Himansu

    As the previous poster stated, you need to export using resource assignments not activities. The only changes that P6 will accept will be to information about activities (Description, duration, etc) if you choose activities. Choosing Resources will allow changes to information with resources and resources asignments will allow changes to information pertaining to the interaction of the activities and resources.

  • I am not able to get email to sort correctly.... not about threading.

    No matter what I do the emails do not sort by date received, some crazy no rhyme or reason disorder!

    Then are you sure this is not about threading?
    Go to '''View-Sort By''' and tell me what 3 items have markers beside them.

  • Class Data Sharing

    I am trying to benchmark memory footprint using the class data sharing feature on Solaris8 and Solaris9.
    I wrote a small sample java program MyApp.java as follows,
         import java.lang.*;
         public class MyApp {
              public static void main(String[] args) {
                   System.out.println("Java VM Version Number = " + System.getProperty("java.vm.version"));
                   long maxMem = Runtime.getRuntime().totalMemory();
                   System.out.println("Total Memory in bytes= " + maxMem);
                   long freeMem = Runtime.getRuntime().freeMemory();
                   System.out.println("Free Memory in bytes= " + freeMem);
                   long memUsed = maxMem - freeMem;
                   System.out.println("Memory Used in bytes= " + memUsed);
                   long t1 = System.currentTimeMillis();
                   for (int i = 0; i < 3; i++)
                        try
                             System.out.println("iteration count = " + i+1);
                             Thread.sleep(1000 * 60);
                             long t2 = System.currentTimeMillis();
                             long t3 = t2 - t1;
                             System.out.println("time elapsed in milliseconds = " + t3);
                        catch (InterruptedException e)
         $JAVA_HOME = /packages/sun/j2sdk1.5.0_02/jdk1.5.0_02/
         I ran it both the machines with the following options
         1)     $JAVA_HOME/bin/java �client �Xshare:on MyApp
         2)     $JAVA_HOME/bin/java �client �Xshare:off MyApp
         I ran the pmap command with �x option to get the readings
         A) Solari8:
              VM Option     RSS          Shared Mem          Private Mem
              Xshare:on     53584KB     50600KB          2984KB
              XShare:off     11456KB     7808KB          3648KB
              JDK1.4     29736KB     26392KB          3344KB
         B) Solaris9:
              VM Option      RSS          Anonymous mem
              Xshare:on     49384KB     3048KB
              Xshare:off     48576KB     3704KB
              JDK1.4     33656KB     2856KB
         These numbers repeat for multiple instances of the same application.
         I do not see the expected memory savings.
         I am trying to find out if I am missing any step in the process of using
         Class Data Sharing feature of JDK1.5
    Thanks!!

    Samantha10 wrote:
    Is this class data sharing possible for user defined classes also? i have a singleton class which i am invoking through a script. The script has been scheduled to run every 1 sec . Since it is being invoked every 1 sec hence the singleton pattern is failing . Hence if the this class data sharing is possible then the singleton pattern can be made applicable.If you have a single process and you have a single class loaded by two different ClassLoader instances
    in some respects they will be two different classes
    if (class1 instanceof class2.getClass())returns false.
    This is not the case for Java core classes because they are always loaded by the SystemClassLoader.
    You write you
    have a singleton class which i am invoking through a script. What approach to you use to invoke the singleton?
    I am trying to figure out if you launch a new JVM every second...
    Maybe you can use Nailgun.

  • Class Data Sharing : what the definition of JSA ?

    Hi everybody,
    I read the article on Class Data Sharing (http://java.sun.com/j2se/1.5.0/docs/guide/vm/class-data-sharing.html) and they speak about the file classes.jsa
    I'm curious and I would like to know the definition of JSA extension.
    Maybe JavaSharedArchive ?
    google say me that JavaSharedArchive is used by Mac but not by JRE1.5 !
    Thanks for your explications !
    Obelix

    Since the point of using a hotspot is to provide data to other devices, the answer to your question is YES.

  • Class Data Sharing in Java 5

    Hi All,
    I am looking at porting over our current Java application from Java 1.4.2 to Java 1.5.
    One of the main reasons is because of the CDS facility in Java 1.5.
    Running the same app, one on 1.4.2 and the other on 1.5, on 1.5 it uses about 20% more memory !!!!
    This application involves 3 JVM's running communicating via RMI.
    When I start each of the applications with -Xshare:on, the first starts fine, indicating it is using CDS,
    (-showversion parameter will indicate sharing), but then the next two wont start giving an error indicating
    the shared archive cannot be accessed.
    Before I started the apps I manually created the shared archive using the call java -Xshare:dump which
    places the classes.jsa file in the directory jre/lib/i386/client/classes.jsa
    I am running an Intel Solaris platform.
    Any ideas why this isnt working ?

    ok, I have some more information after doing more investigation...
    Here is the bug which I submitted to Sun...
    FULL OS VERSION :
    SunOS con1 5.8 Generic_108529-29 i86pc i386 i86pc
    A DESCRIPTION OF THE PROBLEM :
    I am running an application with 3 JVM's. I have manually enabled Class Data Sharing using the command java -Xshare:dump. This seems to work fine.
    When I start the first JVM with the command line option -Xshare:on it seems to start fine and indicates "sharing" when I print out -showversion.
    Then when I start any subsequent JVM's with -Xshare:on AND the -Xmx5m parameter I receive the following error:
    An error has occured while processing the shared archive file. Unable to reserve shared region. Error occurred during initialization of VM Unable to use shared archive.
    It seems to work fine if I dont set the maximum heap size.
    THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
    THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: No
    STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
    Try to execute a JVM with class data sharing on, then try it again with class data sharing on, AND trying to set the maximum heap size.
    EXPECTED VERSUS ACTUAL BEHAVIOR :
    It should still allow CDS.
    ERROR MESSAGES/STACK TRACES THAT OCCUR :
    An error has occured while processing the shared archive file. Unable to reserve shared region. Error occurred during initialization of VM Unable to use shared archive.
    REPRODUCIBILITY :
    This bug can be reproduced always.
    The error only occurs when using Xshare AND Xms<NUMBER>m as parameters !

  • Is there any way to export IT Resource data from OIM using the export tool?

    Hello,
    we are trying to migrate an OIM development environment to a preproduction environment and we need to migrate more than 400 IT Resources. We have exported some IT Resources and when we imported them in the preproduction environment their data was not migrated. Is there any way to export IT Resource data from OIM using the export tool? Or is there any other way to do this without doing it by hand?
    Thank you for your help
    Kind Regards

    Well , OIM doesnot provide any such facility to export ITResource data along with ITResource .
    Directly updating the DB could be an option ..
    Thanks

  • I have just purchased a new ipad2 to replace my old ipad. How do i sync all the data in my apps I am worried about losing my data?

    I have just purchased a new ipad2 to replace my old ipad. How do i sync all the data in my apps I am worried about losing my data?

    iPad settings and data created and stored by a 3rd party party app along with app settings are included with the iPad's backup along with other data.
    If you are syncing your iPad direct with iTunes on your computer via USB, the iPad's backup is updated as the first step during the iTunes sync process.
    The first time you connect a new iPad or iOS device to iTunes that is used to sync with another iOS device, you are prompted to transfer the backup for the other iOS device to the new device. This is followed by a sync to transfer the same content from your computer that is on the old iPad to the new iPad such as music, movies, tv shows, 3rd party apps, photos, audio and print books, etc.

  • Question about Rescheduling Start Date of a Task

    Question about Rescheduling Start Date of a Task
    I'm trying to determine whether the 'Reschedule' action is appropriate to my situation...
    I have a service that consists of 4 tasks.  The first 3 tasks will be completed immediately and then the request's 4th task will sit in a queue for about a month so that all of these requests can be grouped together and fulfilled during a few overnight work sessions.
    While the 4th task is waiting to be fulfilled, the technician will be contacting the requestor to schedule the work to be done sometime during a 3 day window.  The technician needs to specify which of the 3 days each request will be worked on.  I'm not sure if I should store the date in a service form field or have the technician reschedule the task so that the start date of the task is set to one of the 3 days.  If I use the reschedule feature, are there any downsides?
    The advantage of using the reschedule feature is that the scheduled start date can be displayed in ServiceManager's task list and can therefore be sorted on and queried.  This wouldn't be possible if I stored the date in a dictionary field on the service form.  In that case, I'd have to use custom reports to group the tasks by start date.
    Please let me know your thoughts...
    Thanks,
    Scott

    This strikes me as a very good use of this feature, since your need to to have the date for this task rescheduled/reflected in ServiceManager. This is the specific effect of using this feature.
    For the benefit of others reading this post, remember: this rescheduled date will not change the due date for the service.

  • Ipod stops syncing after about 11gb on data transferred

    ok, my ipod stops syncing after i transfer about 11gb of data.
    my music collection alone is 12gb, i also have alot of photos and videos and other contents.
    it doesnt matter which format the ipod is in, mac formatted or windows formatted its the same result.
    its an 80Gb ipod classic.
    any one have any clue as to why this is happening?

    Actually at 1200ish songs the iPod hard drive starts making some severe clicking/clanking noises. I'm guessing it means the hard drive is screwed since it's the same symptoms as my last iPod
    Why does this happen? Both my iPods were about 2 years old when the hdd's started clicking, surely hdd's last for more than two years?

Maybe you are looking for