How to know whether a method is thread-safe through the java-doc?

In some book, it says that SAXParserFactory.newSAXParser() is thread-safe,but in the java-doc,it doesn't say that.
newSAXParser
public abstract SAXParser newSAXParser()
throws ParserConfigurationException,
SAXExceptionCreates a new instance of a SAXParser using the currently configured factory parameters.
Returns:
A new instance of a SAXParser.
Throws:
ParserConfigurationException - if a parser cannot be created which satisfies the requested configuration.
SAXException - for SAX errors.
I want to know, how to know whether a method is thread-safe?

System.out is a PrintStream object. None of the methods there use the synchronized modifier, but if you look in the source code, you will find out it is thread-safe, because it will use synchronized blocks whenever it writes some text.
The source code is in the src.jar file which you can extract.
I didn't find any comments about that PrintStream is thread-safe in the API.

Similar Messages

  • How can I get to know if a method is threads-safe?

    Hi, there.
    How can I get to know if a method is threads-safe?
    For example, in two different threads, is System.out.print() method safe or not?And where can I find the information with regard to this?
    thanks very much.

    System.out is a PrintStream object. None of the methods there use the synchronized modifier, but if you look in the source code, you will find out it is thread-safe, because it will use synchronized blocks whenever it writes some text.
    The source code is in the src.jar file which you can extract.
    I didn't find any comments about that PrintStream is thread-safe in the API.

  • Anyone knows whether this method will work?

    Hi,
    I am trying out this method to construct an applet but I couldn't get it to work.Does anyone here know whether this method will work and how to debug it.Thanks.
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Project extends Applet implements ActionListener {
    private Button circle, square;
    private Model aModelInstance;
    public void init() {
    circle = new Button("Circle");
    add(circle);
         circle.addActionListener(this);
         square = new Button("Square");
         add(square);
         square.addActionListener(this);
    aModelInstance = new Model();
    public void paint(Graphics g) {
         aModelInstance.display(g);
         public void actionPerformed(ActionEvent event) {
    if (event.getSource() == circle)
    aModelInstance.getCircle();
    if (event.getSource() == square)
    aModelInstance.getSquare();
    repaint();
    class Model {
         private aModelInstance.display(g)
         public void getCircle() {
         g.setColor(Color.red);
    g.fillOval(145,89,122,122);
    private aModelInstance.display(g)
         public void getSquare() {
    g.setColor(Color.green);
    g.fillRect(145,89,122,122);
    public void display(Graphics g) {
    }

    It will work for the most part put there is a few problems that you would have to work out. Most of the problems are in the inner class Model. I commented out a couple of lines in there that did not make sense. In the getSquare() & getCircle() methods you are referring to the variable 'g' where there was no declaration for that variable, in Model. So I modifed the method to have an input parameter of Graphics, that will need to be passed to the method. Then I modified the code in Project so that it passes Graphics when it calls those methods.
    The code now compiles cleanly but there is still some work for you to do. You should modify the getSquare() and getCircle() methods to return the Graphics. Then in the actionPerformed() method, call the paint method with the returned Graphics. Good luck.
    import java.awt.*;
    import java.applet.Applet;
    import java.awt.event.*;
    public class Project extends Applet implements ActionListener {
    private Button circle, square;
    private Model aModelInstance;
    public void init() {
    circle = new Button("Circle");
    add(circle);
    circle.addActionListener(this);
    square = new Button("Square");
    add(square);
    square.addActionListener(this);
    aModelInstance = new Model();
    public void paint(Graphics g) {
    aModelInstance.display(g);
    public void actionPerformed(ActionEvent event) {
    if (event.getSource() == circle)
    aModelInstance.getCircle(this.getGraphics());
    if (event.getSource() == square)
    aModelInstance.getSquare(this.getGraphics());
    repaint();
    class Model {
    //private aModelInstance.display(g)
    public void getCircle(Graphics g) {
    g.setColor(Color.red);
    g.fillOval(145,89,122,122);
    //private aModelInstance.display(g)
    public void getSquare(Graphics g) {
    g.setColor(Color.green);
    g.fillRect(145,89,122,122);
    public void display(Graphics g) {
    }

  • How to know whether balance carry forward has happened or not

    How to know , whether balance carry forward has happened or not for a perticular GL account or for the company code as a whole?

    If the account is a balance sheet account, you can merely look at the beginning balance for the same balance sheet account for the beginning of the next fiscal year FS10N. The beginning balance will equal the previous year's ending balance. Since this does not happen automatically, you will know that carry forward has not been done if a balance sheet account has no beginning balance in the following fiscal year.
    If you are talking about For P&L GL accounts, you can check the acvitity in the retained earnings accounts to make sure that they have been updated for the P&L activity. You can identify the retained earnings account by looking at the master data for the account in the section "P&L statmt acct type" and pulling up the menu to see the actual retained earnings account number.
    You can perform carry foward (GVTR) as many times as you want but normally once it has been ran, any postings to a  previous fiscal year are automatically carried forward to the current year after that initial run.

  • How can i add videos,movies and tv shows episodes to my ipod nano?I want to know whether i can directly add them through my pc or not without downloading them from i tunes store?

    how can i add videos,movies and tv shows episodes to my ipod nano?I want to know whether i can directly add them through my pc or not without downloading them from i tunes store?

    Yes, you can add your own videos to iTunes, then sync them to your nano, subject to supported max resolution limit and file type.  The specs for the 7th gen nano says (I don't know which nano model you have), Video Format Support
    "H.264 video: 720 by 576 pixels, 30 frames per second; Baseline, Main, and High-Profile level 3.0 with AAC-LC audio up to 256 Kbps; 48kHz; stereo audio in .m4v, .mp4, and .mov file formats
    MPEG-4 video: up to 2.5 Mbps, 720 by 576 pixels, 30 frames per second; Simple Profile with AAC-LC audio up to 256 Kbps; 48kHz; stereo audio in .m4v, .mp4, and .mov file formats"
    http://www.apple.com/ipod-nano/specs.html
    (earlier nanos have lower max resolution limits)
    So, "HD" video is too high resolution, so iTunes will not sync such videos to the iPod (although they play in iTunes).  If you are asking how to set up iTunes to sync videos in general (regardless of source), please post back.

  • How to know whether my Windows Phone 8.1 App is Associated with the store or not?

    How to know whether my Windows Phone 8.1 App is Associated with the store or not? 
    I have an Windows Phone 8 app already in the store , Now i upgraded it to 8.1 it got upgraded to Windows Phone Silverlight 8.1.
    Now iam trying to use Single Sign on feature on this app but it is showing the error message like
    the App is not Configured correctly i followed the process from  Signing users in to OneDrive
    please guide me how to do this?
    Mohan Rajesh Komatlapalli

    You should post to publish forum.

  • How to know whether the javascript is disabled or not while loading the jsp

    Hi,
    My query is like how to know whether the javascript is disabled or not while loading the Application main JSP in Mozilla browser.
    I want some Java code or JavaScript code.

    To the point, just let JS fire a specific HTTP request inside the same session.
    This can be done in several ways. 1) Create a hidden <img> element and set the `src` attribute so that it will request a (fake) image from the server. The server just have to intercept on this specific request. 2) Fire an ajaxical request and let the server intercept on it. You can use a Filter for this which sets a token in the session scope to inform that the client has JS enabled.

  • How to know whether the Content Type at Library level is Inheriting Parent Content type or not Using Powershell?

    Hi,
    How to know whether the Content Type at Library level is Inheriting Parent Content type or not using Powershell?
    Is there any property for that? Or Do I need to compare the Content type Id's at Site collection level and Library level?
    Any help would be greatly appreciated.
    Thank you,
    AA.

    Hi Ashok,
    For a content type, there is an attribute called Inherits, the value of this attribute determines whether the content type inherits fields from its parent content type when it is created.
    If Inherits is TRUE, the child content type inherits all fields that are in the parent, including fields that users have added.
    If Inherits is FALSE or absent and the parent content type is a built-in type, the child content type inherits only the fields that were in the parent content type when SharePoint Foundation was
    installed. The child content type does not have any fields that users have added to the parent content type.
    More information, please refer to the link:
    https://msdn.microsoft.com/en-us/library/office/aa544268.aspx?f=255&MSPPError=-2147217396
    Best Regards,
    Wendy
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • How to know whether the current database is using a password file or not?

    How to know whether the current database is using a password file or not?

    The remote_password_file is the parameter that determines if you can use or not a password file. The values this parameter can have are NONE, SHARED, EXCLUSIVE. It is pretty obvious, if it is set to either SHARED or EXCLUSIVE the oracle instance has enabled the access through a password file for the SYSDBA and SYSOPER roles.
    ~ Madrid

  • How to know whether database(oracle) is up and running at OS level

    how to know whether database(oracle) is up and running at OS level...!!!

    depends on the O/S you are using, Unix or Windows? I would use Korn shell script to monitor the Oracle background process and scripts to check of Oracle is accepting connections.
    This UNIX command will show the number of processes for your instance:
    ps -ef|grep $ORACLE_SID|grep -v grep|grep -v ora_|wc u2013l
    In Windows I would look into services.msc

  • Without hear again, how to know whether i heard a podcast in the past ?

    Hi guys
    I listen to a lot of podcasts from many different DJ. My question is: without hear it again, how to i know whether i heard this podcast already in the past?
    I hope there are some kind of app that can help me? I don’t want to use the book ^^
    Any ideas guys?

    Not solved.

  • How to know whether record is already there in lsmw to create or change

    Dear Freinds,
                How can we know whether a record is already exisitng in the database ,
    for us to decide to do the LSMW in INS or MOD.
    I mean to say if  for a record already exisits in the database (ex pa0002) and we are doing a LSMW , How can we check a record already exsits in the database and modify of  that record and if doesn't exits go for create option. Please let me know in which step we can do this validation?
    Regards
    syamla

    Hi Atish ,
            How can i do this , you said we can check whether we have to insert(INS) or Change(MOD) for a record in the database at Convert Data , At convert data i cannot
    do the change as it is Standard program.
    If you have any  piece of code please let me know how i can do the same.
    regards
    syamala

  • How to know whether a connection leak occured in weblogic8.1

    How to Know whether Conenction Leak has Occured or Not ??..Where does the WeblogicServer8.1 print the STACK TRACE if connection Leak has occured ? or does it maintain a LOG FILE , where any entries can be seen................

    To turn on Debug flags add these to the startup scripts.
    -Dweblogic.Debug=weblogic.JDBCConn="true",weblogic.JTAJDBC="true"
    Essentially, you will need to edit the config.xml file (when the server is down) and add the proprty to the ConnectionPool definition:
    http://e-docs.bea.com/wls/docs61/config_xml/mbeans.html
    ConnLeakProfilingEnabled="true"
    Thanks and regards,
    Pazhanikanthan. P

  • How to know whether a vacation rule is set for a user

    Hi,
    How to know whether a vacation rule is set for a user or not in the BPM process. Can anyone help me in this.
    Thanks,

    In Linux a user has to have read permission on a file to even see that it exists. As a result, if a user (or a group to which they belong) doesn't have read access to the file File.exists() will return false. Windows which doesn't have as tightly controlled access to files will admit that a file exists whether it can be read or not.
    PS.
    This is proof that I should never answer a question off the top of my head when I haven't had my red bull yet. This is wrong. You will be able to see it if you have read and execute on the directory.
    thumps self in head
    Message was edited by:
    puckstopper31

  • How to know whether my ipad is under warranty

    How to know whether my ipad 2 is under warranty

    It's an iPad 2 so I'm pretty sure it is still less than one year old but you can check for sure here.
    https://selfsolve.apple.com/agreementWarrantyDynamic.do

Maybe you are looking for

  • Adobe PhotoShop CS3 - Image Enhancements

    Hello. I have an extensive website with images... http://www.marsesa.9f.com/slide_show.html I use PS CS3 to enhance images. Enhancements revealing details not visible to the naked eye. My latest images. A Mars dust devil. http://www.marsesa.9f.com/sl

  • Unique Key Violation error while updating table

    Hi All, I am having problem with UNIQUE CONSTRAINT. I am trying to update a table and getting the violation error. Here is the over view. We have a table called ActivityAttendee. ActivityAttendee has the following columns. The problem to debug is thi

  • My wish list for 9.0.3

    I saw someone earlier this month listed their excellent wish list. The Jdev team responded and that was terrific. I just thought I'd list my growing list so they can see it, although I doubt any of these will make it to 9.0.3, unless they were alread

  • [JS] [CS3 onwards] Simplify some code

    Hi. I have been using a for loop to find a certain paragraoh by its style name for a while now, and I am wondering if I am using the best approach? I am using: for (x=0;x<=myStory.paragraphs.length-1;x++)      if(myStory.paragraphs[x].appliedParagrap

  • GPU panic on MacBook Air (2014) with Yosemite

    Hello, my new MacBook Air (system details below) has been having intermittent GPU panics when using Safari. These seem to be correlated with sites on the Gawker network (e.g. http://www.gawker.com, http://www.lifehacker.com) when they play a pop up v