Understanding instances...

-->>
I'm trying to understand the instances, but i found something that make feel insecure: the next code works
and represents an ouput stream file; however, i don�t see the "new" reserved word in this code
in order to create the "out" object.
PrintWriter out = null;
try{
out = resp.getWriter();
} catch (IOException io){
//something
I know that the resp.getWriter() method returns a PrintWriter object.
-->>
Another question:
In the next code, "Writer" is an abstract class, and i know that i can't create an instance for it,
but why this example code can assing a FileWriter object to a Writer object. Is it possible?...
Writer out = new FileWriter( "LetterHome");
Could anyboy try to explain this?.....
Regards.

-->>
I'm trying to understand the instances, but i found
something that make feel insecure: the next code
works
and represents an ouput stream file; however, i don�t
see the "new" reserved word in this code
in order to create the "out" object.
PrintWriter out = null;
try{
out = resp.getWriter();
} catch (IOException io){
//something
I know that the resp.getWriter() method returns a
PrintWriter object.
the getWriter method (or method that it calls) uses the new keyword, and then returns the object created.
Another question:
In the next code, "Writer" is an abstract class, and i
know that i can't create an instance for it,
but why this example code can assing a FileWriter
object to a Writer object. Is it possible?...
Writer out = new FileWriter( "LetterHome");
Could anyboy try to explain this?.....FileWriter is a subclass of Writer (it extends Writer). Therefore, it is a Writer, so you can assign it to a Writer handle.
>
>
Regards.

Similar Messages

  • How to understand this java code?

    for example:
    * The HelloWorldApp class implements an application that
    * simply displays "Hello World!" to the standard output.
    class HelloWorldApp {
    public static void main(String[] args) {
    System.out.println("Hello World!"); //Display the string.
    the explaination of above example is below:
    above example
    The method signature for the main method contains three modifiers:
    public indicates that the main method can be invoked by any object. Controlling Access to Members of a Class covers the ins and outs of the access modifiers supported by the Java programming language.
    static indicates that the main method is a class method (as opposed to an instance method). Understanding Instance and Class Members talks about class methods and variables.
    void indicates that the main method doesn't return any value.
    in that statement :
    void indicates that the main method doesn't return any value.
    while (System.out.println("Hello World!"); //Display the string.) is in
    main method
    when we run that example and it runs below result:
    Hello World!
    so i think "Hello World" is that the main method return value.
    i know i have misunderstood.
    who can help me?

    What the hell are you on about?
    System.out is a PrintStream. When you call print() or println() the parameter is displayed in/on whatever that PrintStream is associated with. If you have java 1.5 you can run the below code and see that the output will be in the file out.txt. Not in the console and definately not returned.
    import java.io.*;
    class OutTest {
      public static void main(String[] args) {
        File file = new File("out.txt");
        PrintStream ps = null;
        try {
          ps = new PrintStream(file);
        } catch(FileNotFoundException fnfe) {
          fnfe.printStackTrace();
        System.setOut(ps);
        System.out.println("Hello World");
    }

  • Please tell me the way to access the object...........?

    when we are decleared a class variable,there should be an object in the memory.this object is the object of the java.obj.Class class.............
    my query is ..
    how to acess that object ?
    e.g.
    public class Basic
    public class Acsess{
    Basic b;//now please tell how access the object of class Basic.Class?......
    thanks and regurds

    I believe that the following example will help. You should also read this tutorial page:
    [Understanding Instance and Class Members|http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html]
    class A
        static String fie = "this is fie";
        String foo = "this is foo";
    public class B
        public static void main(String[] args)
            System.out.println(A.fie);
            A instance = new A();
            System.out.println(instance.fie); // Not recommended; does not
                                              // make it clear that fie is
                                              // a class (static) variable
            System.out.println(instance.foo);
    }

  • Oracle Net configuration:

    I have posted a question yesterday on Oracle tnsnames and listener config. Thanks to OrionNet for the prompt reply.
    I now have more on the same subject. Can anyone please clarify:
    I have installed oracle 10g rel 2 on my Windows XP machine.
    I have the following defined( I copied most of the details from OracleNet Administrators guide and interpreted as follwos):
    db_name:sales
    db_domain: us.acme.com
    then is db_global_name = sales.us.acme.com and service_names: sales.us.acme.com
    services on this database are: book.us.acme.com (for book sales) and soft.us.acme.com (for software sales). So are the instance names: book.us.acme.com and soft.us.acme.com ? What is the SID for this ?
    Are the following tns entries correct:
    tnsnames:
    book.us.acme.com=
    (description=
    (address_list=
    (address=(protocol=tcp)(host=user)(port=1521))
    (connect_data=
    (server=dedictaed)
    (service_name=sales.us.acme.com)
    soft.us.acme.com=
    (description=
    (address_list=
    (address=(protocol=tcp)(host=user)(port=1521))
    (connect_data=
    (server=dedictaed)
    (service_name=sales.us.acme.com)
    listener:
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = user)(PORT = 1521))
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (GLOBAL_DBNAME = orcl.com)
    (ORACLE_HOME =/u01/app/oracle/product/10.2.0)
    (SID_NAME = book.us.acme.com)
    (SID_DESC =
    (GLOBAL_DBNAME = orcl.com)
    (ORACLE_HOME =/u01/app/oracle/product/10.2.0)
    (SID_NAME = soft.us.acme.com)
    but even without all this, I can connect as : connect scott/tiger@user:1521/sales.us.acme.com, but how will i connect to the host user if I am on a different machine ?
    Thanks in advance

    Ramya Reddy wrote:
    Yes. That is part of my question. Can you look at this:
    db_name:sales
    db_domain: us.acme.com
    then is db_global_name = sales.us.acme.com and service_names: sales.us.acme.com
    services on this database are: book.us.acme.com (for book sales) and soft.us.acme.com (for software sales). So are the instance names: book.us.acme.com and soft.us.acme.com ? What is the SID for this ?
    From Aman and your responsses, I understand:
    instance and SID names are book.us.acme.com and soft.us.acme.com
    Is that correct ?The SID over here are the same as the service names which I mentioned to you before as well. Here , book.us.acme.com and soft.us.acme.com are the SIDs.
    The instance and the service names are also the same for both. Look below for the output from my machine where a single db, ORCL10 is installed.
    E:\Documents and Settings\aristadba>lsnrctl services
    LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 30-APR-2009 23:10:25
    Copyright (c) 1991, 2005, Oracle.  All rights reserved.
    Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
    Services Summary...
    Service "orcl10" has 1 instance(s).
      Instance "orcl10", status READY, has 1 handler(s) for this service...
        Handler(s):
          "DEDICATED" established:0 refused:0 state:ready
             LOCAL SERVER
    Service "orcl10XDB" has 1 instance(s).
      Instance "orcl10", status READY, has 1 handler(s) for this service...
        Handler(s):
          "D000" established:0 refused:0 current:0 max:1002 state:ready
             DISPATCHER <machine: ORACLE, pid: 3356>
             (ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1994))
    Service "orcl10_XPT" has 1 instance(s).
      Instance "orcl10", status READY, has 1 handler(s) for this service...
        Handler(s):
          "DEDICATED" established:0 refused:0 state:ready
             LOCAL SERVER
    The command completed successfully
    E:\Documents and Settings\aristadba>You can see the message that the Instance ORCL10 is linked to service with the same name. That's also what you have in your case of mentioned services.
    HTH
    Aman....

  • Need help with a Class.

    Ok hey guys i got A project for school and i need help. I asked my teacher and he num so yea. here it is
    this is my blog class
    /* Project Name: .java
                 Name:
                Class: Programing 2 #0047-02 Pds 5&6
      Variable List:
                   Info:
    import java.util.Scanner;
    import java.util.Date;
    import java.text.DateFormat;
    import java.text.SimpleDateFormat;
    public class blog
         String date2;
         String user;
         String Entry;
         public void GetInfo(String Iuser,String IEntry)
              DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
              Date date = new Date();
              date2 = dateFormat.format(date);
              user = Iuser;
              Entry = IEntry:
         public void ShowInfo()
              System.out.println(date2 + " " + user + " Said: " + Entry);
    }This is my test class
    /* Project Name: .java
                 Name: Josh
                Class: Programing 2 #0047-02 Pds 5&6
      Variable List:
                   Info:
    import java.util.Scanner;
    public class test
         String user;
         String Entry;
         public static void main (String[] args)
         {     System.out.println("Welcome Please Eneter UserName");
              Scanner kb = new Scanner(System.in);
              user = kb.next();
              System.out.println("Please Enter Your Entry");
              Entry = kb.next();
              blog info = new blog();
              blog.GetInfo(user,Entry);
              blog.ShowInfo();
    }So what is sopost to do in the test it ask user to import user name and entery. It send it to blog Class, then it send it out. Here is my errors
    G:\VOC T2\Java\Chap4\test.java:21: non-static variable user cannot be referenced from a static context
              user = kb.next();
              ^
    G:\VOC T2\Java\Chap4\test.java:25: non-static variable Entry cannot be referenced from a static context
              Entry = kb.next();
              ^
    G:\VOC T2\Java\Chap4\test.java:29: non-static variable user cannot be referenced from a static context
              blog.GetInfo(user,Entry);
                           ^
    G:\VOC T2\Java\Chap4\test.java:29: non-static variable Entry cannot be referenced from a static context
              blog.GetInfo(user,Entry);
                                ^
    G:\VOC T2\Java\Chap4\test.java:29: GetInfo(java.lang.String,java.lang.String,java.lang.String) in blog cannot be applied to (java.lang.String,java.lang.String)
              blog.GetInfo(user,Entry);
                  ^
    G:\VOC T2\Java\Chap4\test.java:31: non-static method ShowInfo() cannot be referenced from a static context
              blog.ShowInfo();
                  ^
    6 errors
    Tool completed with exit code 1 Plez help

    -- "non-static X cannot be referenced from a static context" --
    You get this error because static members don't require an instance of the object to be accessed; they belong to the class. But a non-static member belongs to an instance (an individual object). There's no way for the static method to know which instance's variable to use or method to call, and thus, the compiler happily tells you that you can't access an instance member (non-static) from a class context (static).
    [The Java? Tutorial - Understanding Instance and Class Members|http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html]
    ~

  • Minor problem

    I havn't got my previous work to look at so i am completely stuck on how to do this general formatting to get rid of that damn static context error.
    Here is the basic code layout
    public static void main(String [ ] args){
    System.out.println("Main menu");
       switch(choice){
       case 1:
             counter++;
             secondMenu();
    public void secondMenu(){
    System.out.println("Second menu");
    }I know its due to counter++ but how can i do some calculations still?

    You can only (directly) call static methods inside other static methods:
    class X {
      static void a() {
        b(); 
      static void b() {
    } However, if b() is NOT static, you will have to make an instance of X and then call b() on that instance:
    class X {
      static void a() {
        X instance = new X();
        instance.b(); 
      void b() {
    I recommend you to read this tutorial from Sun Understanding Instance and Class Members :
    http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html

  • Problem in datamining :Wanting package holding classes for Decision Trees

    Hello,Friends.Please,I have downloaded the package odmapi.jar several times (several releases ) but there was a problem that I did not find the class DecisionTreesSettings(or classes concerning to Decision Trees ) in the path :oracle.dmt.odm.settings.algorithm...
    Please help with giving me release of this package that holds this class....thanks

    I only have to put null in the instance variable declaration for it
    to pop up again in my application.This almost always points to you performing some initialization from a superclass constructor. I know you say this isn't happening. However, it's by far the most likely situation. You could also have threading issues, as you don't synchronize your singleton creation.
    FYI, Java initializes class instances using the following (simplified) sequence
    1) Allocate the memory and initialize it to default values (nulls for references, 0 for numbers, false for booleans). This happens before any constructors are called.
    2) For each class in the hierarchy, starting with Object, invoke the instance initializers and appropriate constructor. If a superclass constructor changes a variable defined by a subclass (typically by calling one of the subclass's methods), that value will be overwritten by any instance initializer (or constructor-time assignment) of the subclass.
    For testing, I suggest you put logging messages in the code that assigns the variable, and at the start of the subclass constructor. You should probably log the current thread ID, and it wouldn't hurt to dump a stack trace as well.
    Edit: wow, lots of posts between the time I started writing this and the time I finished ... oh well, perhaps the OP will understand instance initialization better if he/she reads this.

  • Time Model

    Hi,
    I have a question about "time model" statistics.
    Assume that the instance is open for 138 days and "db time" in v$sys_time_model view is 36 days. By only comparing these days can we understand instance doesn't need hardware changes?
    SQL> select round((sysdate-t.STARTUP_TIME)) as days_open from v$instance t;
    DAYS_OPEN
    138
    SQL> select t.STAT_NAME, round(t.VALUE/1000000/60/60/24) days_db_time from v$sys_time_model t where lower(t.STAT_NAME)= 'db time' ;
    STAT_NAME DAYS_DB_TIME
    DB time 36
    Thank You..

    It would be wrong to arrive at a conclusion regarding hardware changes with this information. It could be that these 138 days have been normal days for your database and the days to follow may need some higher levels of processing power.

  • Final v/s static

    hi i have a confusion :
    final variables should(must) be given a value..unless it wont run.... where as static var can be declared and left defined. why so? do final variables are loaded at class load time?
    can someone help me to clear the image between static and final i know we cannot over ride a final method...but i am talking aboutvariables.

    where as static var can be declared and left defined. why so? The static keyword isn't related to final.
    can someone help me to clear the image between static and final i know we cannot over ride a final method...but i am talking aboutvariables.Final variables cannot be modified once initialized. Static variables pertain to a class as a whole rather than a particular instance of that class.
    [The Java� Tutorial - Understanding Instance and Class Members|http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html]
    ~

  • Problem referencing a newly created class instance - I don't understand why

    Hi,
    I am completely new to actionscript although I do come from a OOP background. I have been asked to trial Flash and Actionscript 3 in particular - so I do come with a few preconceptions on how I expect actionscript to behave.
    I have a problem I donot understand. I have created a new class and to test it I use a simple test harness in the form of a .fla file.
    The issue I have is when I create a new instance of the class and assign it to a variable, subsequent background changes to that instance of the class are not 'picked-up' when referenced through the variable. I would expect that given instance of class could be assigned to many different variables and any updates using one variable would  accessible using any of the other variables.
    My test class, XMLDataLoader, is coded as follows:
    package  {   
        public class XMLDataLoader {
            import flash.events.*;
            import flash.net.*;
            import flash.utils.*
            private var _xmlData:XML;
            private var _xmlLoaded:Boolean;
            public function XMLDataLoader(pFileName:String){
                init(pFileName);
            public function getXMLData():XML {
                return this._xmlData;
            public function XMLLoaded():Boolean {
                return this._xmlLoaded;
            private function init(pFileName:String):void
                // Create the URLLoader instance to be able to load data
                  var loader:URLLoader = new URLLoader( );
                var urlRequest:URLRequest = new URLRequest(pFileName);
                this._xmlLoaded = false;
                // Define the event handlers to listen for success and failure
                   loader.addEventListener ( Event.COMPLETE, handleComplete );
                loader.load(urlRequest);
                function handleComplete ( e:Event ):void
                    trace ( "The data has successfully loaded" );
                    this.xmlData = new XML(e.currentTarget.data);
                    this._xmlLoaded = true;
    The class simply reads a text file and assigns its contents to the class variable _xmlData. The class variable _xmlLoaded identifies when the load is complete.
    The test harness is a simple flash app consisting if a single timeline with 1 frame, 1 symbol on the stage and the following actionscript code:
    import flash.events.TimerEvent;
    var t:XMLDataLoader = new XMLDataLoader("Test Article.xml");
    var xmlData:XML;
    var waits:uint = 0;
    wait(1);
    function wait(ct:uint):void
        var TimerInstance:Timer = new Timer(500, 1);
        TimerInstance.addEventListener(TimerEvent.TIMER, TimerHandler);
        TimerInstance.start();
        function TimerHandler(event:TimerEvent):void
           if(t.XMLLoaded()){
                xmlData = t.getXMLData();  
                trace(xmlData.toXMLString);
            } else {
                trace(ct + " - Waiting....");
                if (ct <= 10) {
                    wait(++ct);
    The script defines a variable and assigns it a new instance of the XMLDataLoader. Originally, I immediately followed this with a trace statement but  insuffient time had elapsed to allow the load to complete, so I had to introduce a wait function to force a delay. This wait function is recursive. It checks to see if the load is complete. If it is, a trace statement will outoput the xml. If not the function will call itself again (upto 10 times)
    The resultant output is as follows:
    The data has successfully loaded
    1 - Waiting....
    2 - Waiting....
    3 - Waiting....
    4 - Waiting....
    5 - Waiting....
    6 - Waiting....
    7 - Waiting....
    8 - Waiting....
    9 - Waiting....
    10 - Waiting....
    According to this output, the XML has been loaded before the end of the first timer cycle but this is not detected in the test harness. I have stepped through the code in debug mode and I have confirmed that the XML was loaded, and the class variables where correctly set, including _xmlLoaded = true. However, in the test harness the instance both class variables  are null. I don't believe this should be the case but obviously I must be wrong - can anyone explain where my logic is flawed. I did think scoping might be the problem but having tried a couple of modifications, I concluded that it wasn't.
    Thanks in advance.

    never nest named functions.  unnest TimerHandler and retest.
    (and, you should be using listener to determine when loading is complete.)

  • Understand the term instance

    HI all,
    I want to understand the term what instance means.this is the definition what i have got
    "An Instance is an administrative unit that combines SAP system components providing one or more services.
         The services provided by an instance are started and stopped together.
         You use a common instance profile to set parameters for all components of an instance.
    So by this definition does that mean that if we have dev , qual and prod all are ecc based systems then we have 3 instances ?I want to understand what this instance means specifically with respect to SAP.

    Hi,
    As per me instance will be a Server or application server, you have to understand as per the situation.
    for eg: if any doby called dialog instance then it will be appserver of your central instance.
    here u can see 2 instances one instance belongs to appserver and another instance itself central instance.
    please have a look on the below link.. i hope u will get good idea abt your query.
    http://help.sap.com/saphelp_nw70ehp1/helpdata/en/c4/3a5eb7505211d189550000e829fbbd/content.htm
    As per u r another query yes u have 3 instances in u r landscape.
    hope the above informaiton will helps.
    -Srini

  • Help required understanding the purpose of having instance Init blocks

    I want to know exactly what the purpose of having instance initialization blocks in Java. As in static init blocks, we can execute some commands before creating an instance of a class.
    And also in instance init blocks, we are executing some commands which we can do in a constructor. So I’m little bit confused of the purpose of having this concept instance init blocks without writing it in the constructor itself.
    Really appreciate if anyone can explain this ASAP as I am still a beginner who is studying for SCJP exam.
    Thanks in advance.

    The instance initialization blocks are always executed before the constructor code is executed. This may be used for some activity which is common to all constructors (in case constructors are overloaded).

  • Understanding why too much Parseinfo instances remain active at JVM heap

    Hi,
    MaxDB 7.6.06.10 64bit community version. (please dont post notes as I dont have the password to see that)
    today another system got stuck threads, the reason was all sessions got Vwait, and some command at Finalizer wants to lock a connection that is Running at java side, but waiting for Vwait at dbserver. I have many posts here, like this, but I decided create another one with maybe more or better information about the problem, as I increased my understanding of JDBC driver classes using Eclipse Memory Analyzer Tool (MAT), then here is the facts:
    1) Finalizer BLOCKED in thread dump.:
    "Finalizer" daemon prio=10 tid=0x000000005e887000 nid=0x67ce waiting for monitor entry [0x0000000041496000]
       java.lang.Thread.State: BLOCKED (on object monitor)
         at com.sap.dbtech.jdbc.StatementSapDB.finalize(StatementSapDB.java:450)
         - waiting to lock <0x00002aaac508ca68> (a com.sap.dbtech.jdbc.ConnectionSapDB)
         at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
    2) in MAT i issued an OQL to check what Connection the finalizer is waiting to lock the Finalizer thread have this Outgoing references:
    Class Name                                                                                | Shallow Heap | Retained Heap
                                                                                    |              |              
    java.lang.ref.Finalizer$FinalizerThread @ 0x2aaab98e1448  Finalizer Thread                |          168 |         1,384
    |- name char[9] @ 0x2aaab9bcf750  Finalizer                                               |           40 |            40
    |- <JNI Local> class com.sap.dbtech.jdbc.StatementSapDB @ 0x2aaab43a0428                  |           56 |            56
    |- <class> class java.lang.ref.Finalizer$FinalizerThread @ 0x2aaab19b9058 System Class    |            0 |             0
    |- <Java Local> com.sap.dbtech.jdbc.ConnectionSapDB @ 0x2aaac0933db8 Busy Monitor         |          200 |       138,400
    |- <Java Local> com.sap.dbtech.jdbc.StatementSapDB @ 0x2aaac0bca3f8                       |          112 |           512
    |- blockerLock java.lang.Object @ 0x2aaab9bcf710                                          |           16 |            16
    |- group java.lang.ThreadGroup @ 0x2aaab98e0d50  system                                   |           72 |           280
    |- inheritableThreadLocals java.lang.ThreadLocal$ThreadLocalMap @ 0x2aaaba6cffc0          |           32 |           240
    |- threadLocals java.lang.ThreadLocal$ThreadLocalMap @ 0x2aaabe96f3b0                     |           32 |           296
    |- <Java Local> java.lang.ref.Finalizer @ 0x2aaac0a8da10                                  |           64 |            64
    |- <Java Local> java.lang.ref.Finalizer$FinalizerThread @ 0x2aaab98e1448  Finalizer Thread|          168 |         1,384
    |- inheritedAccessControlContext java.security.AccessControlContext @ 0x2aaab9bcf720      |           48 |            48
    '- Total: 12 entries                                                                      |              |              
    3) then inspect the ConnectionSapDB to see the sessionID atribute that is 803661865, that is related to task 164 that is in Vwait like others:
    ID   UKT UNIX   TASK       APPL Current         Timeout Region     Wait
              tid   type        pid state          priority cnt try    item
    T97    7     -1 User     26568* Vwait                 0 0               10191536(s)
    T127   7     -1 User     26568* Vwait                 0 0               10191536(s)
    T132   7     -1 User     26568* Vwait                 0 0               10191536(s)
    T136   7     -1 User     26568* Vwait                 0 0               10191536(s)
    T143   7     -1 User     26568* Vwait                 0 0               10191536(s)
    T154   7     -1 User     26568* Vwait                 0 0               10191536(s)
    T163   7     -1 User     26568* Vwait                 0 0               10191536(s)
    T164   7     -1 User     26568* Vwait                 0 0               10191536(s)
    T178   7     -1 User     26568* Vwait                 0 0               10191536(s)
    T180   7     -1 User     26568* Vwait                 0 0               10191536(s)
    Then here appears we have a deadlock that Finalizer wants to close a Statement but the connection is busy in Vwait in another thread, and perhaps, maybe this Vwait only will go out, if another command will be finalized.
    As all times, I think, in some place we dont close all statements or result sets, then I inspected the objects that can reference back the StatementSapDB waiting to be finalize, and here is the incoming stack:
    Class Name                                                                                | Shallow Heap | Retained Heap
                                                                                    |              |              
    com.sap.dbtech.jdbc.StatementSapDB @ 0x2aaac0bca3f8                                                   |          112 |           512
    |- <Java Local> java.lang.ref.Finalizer$FinalizerThread @ 0x2aaab98e1448  Finalizer Thread            |          168 |         1,384
    |- referent java.lang.ref.Finalizer @ 0x2aaac0a8da10                                                  |           64 |            64
    |- statement com.sap.dbtech.jdbc.ResultSetSapDB @ 0x2aaac0bca468                                      |          120 |           224
    |  '- currentResultSet com.sap.dbtech.jdbc.StatementSapDB @ 0x2aaac0bca3f8                            |          112 |           512
    |     |- <Java Local> java.lang.ref.Finalizer$FinalizerThread @ 0x2aaab98e1448  Finalizer Thread      |          168 |         1,384
    |     |- referent java.lang.ref.Finalizer @ 0x2aaac0a8da10                                            |           64 |            64
    |     |- statement com.sap.dbtech.jdbc.ResultSetSapDB @ 0x2aaac0bca468                                |          120 |           224
    |     |  '- currentResultSet com.sap.dbtech.jdbc.StatementSapDB @ 0x2aaac0bca3f8                      |          112 |           512
    |     |     |- <Java Local> java.lang.ref.Finalizer$FinalizerThread @ 0x2aaab98e1448  Finalizer Thread|          168 |         1,384
    |     |     |- referent java.lang.ref.Finalizer @ 0x2aaac0a8da10                                      |           64 |            64
    |     |     |- statement com.sap.dbtech.jdbc.ResultSetSapDB @ 0x2aaac0bca468                          |          120 |           224
    |     |     '- Total: 3 entries                                                                       |              |              
    |     '- Total: 3 entries                                                                             |              |              
    '- Total: 3 entries                                                                                |              |              
    here we can see that the root reference is a ResultSetSapDB, inspecting this object, we can see that the attribute isClosed is true.
    inspecting more objects, I found the Parseinfo object that still opened, with this OQL:
    SELECT t.sqlCmd.toString(), dominatorof(t) FROM com.sap.dbtech.jdbc.Parseinfo t WHERE (isClosed=false)
    that returns about 24566 entries, then I got some that involves a table that maybe have a table lock that causes all Vwait situation, and get the incoming references:
    Class Name                                                                      | Shallow Heap | Retained Heap
    com.sap.dbtech.jdbc.Parseinfo @ 0x2aaac0b71a60                                  |          120 |           216
    |- referent java.lang.ref.Finalizer @ 0x2aaac0b0b450                            |           64 |            64
    |- parseinfo com.sap.dbtech.jdbc.CallableStatementSapDB @ 0x2aaac0b71980        |          224 |           352
    |  |- referent java.lang.ref.Finalizer @ 0x2aaac0b0b490                         |           64 |            64
    |  |- _inner com.sap.dbtech.jdbc.trace.PreparedStatement @ 0x2aaac0b71ad8       |           80 |           128
    |  |  |- referent java.lang.ref.Finalizer @ 0x2aaac0b0b410                      |           64 |           192
    |  |  |- referent java.lang.ref.WeakReference @ 0x2aaac1437a08                  |           48 |            48
    |  |  |  '- weakRef com.sap.dbtech.jdbc.trace.PreparedStatement @ 0x2aaac0b71ad8|           80 |           128
    |  |  '- Total: 2 entries                                                       |              |              
    |  '- Total: 2 entries                                                          |              |              
    '- Total: 2 entries                                                             |              |              
    Again, all appears to be closed, but still some internal classes must be finalized, that must lock connection for that.
    as I checked my code, all statements get closed, with try, finally, following best pratices of JDBC when you had connection pool.
    then why that Statement must be finalized? and why that must lock the Connection? and why too much ParseInfo waiting to be finalized?
    With this scenario, is right to say, that MaxDB JDBC driver, cant use pool as some objects must finalized after all Statement and ResultSets are closed? Something dependent on connection avoid that to be reused? or what is the right clean code to be done with MaxDB JDBC driver, before you can reuse that connection?
    regards
    Clóvis
    Edited by: Clovis Wichoski on Apr 7, 2011 7:47 PM

    Hi Natalia,
    My server crash again, with stucked threads, then I updated with newer JDBC driver got from DatabaseStudio, that is:
    package com.sap.dbtech.jdbc, MaxDB JDBC Driver, SAP AG, 7.6.06 Build 007-000-009-441 (Make-Version: 7.8.01 Build 018-121-240-252)
    with this version, the ParseInfo ammount reduced to 466 entries, but I still think that this are too much Parseinfo objects, as we can see many Parseinfo that isClosed equals false, but we cant find any ResultSet or Statement openned and using this Parseinfo, follow a sample of Parseinfo with incoming references:
    Class Name                                                                                | Shallow Heap | Retained Heap
                                                                                    |              |              
    com.sap.dbtech.jdbc.Parseinfo @ 0x2aaacd9d2ce0                                             |          120 |         4,280
    |- parseinfo com.sap.dbtech.jdbc.CallableStatementSapDBFinalize @ 0x2aaacd9d2b98           |          232 |           416
    |  |- _inner com.sap.dbtech.jdbc.trace.PreparedStatement @ 0x2aaacd9d2b48                  |           80 |            80
    |  |  |- referent java.lang.ref.WeakReference @ 0x2aaacd9d2b18                             |           48 |            48
    |  |  |- _stmt org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement @ 0x2aaacda2bc70    |           72 |           216
    |  |  |  |- _stmt org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement @ 0x2aaacda2bb98 |           72 |           216
    |  |  |  |- [7] java.lang.Object[16] @ 0x2aaacdb3bf58                                      |          152 |           152
    |  |  |  |  '- elementData java.util.ArrayList @ 0x2aaacd5d1ec0                            |           40 |           192
    |  |  |  |     '- traceList org.apache.tomcat.dbcp.dbcp.PoolableConnection @ 0x2aaacd5d1e78|           72 |           264
    |  |  |  '- Total: 2 entries                                                               |              |              
    |  |  |- referent java.lang.ref.Finalizer @ 0x2aaacdb48288                                 |           64 |       278,784
    |  |  '- Total: 3 entries                                                                  |              |              
    |  |- referent java.lang.ref.Finalizer @ 0x2aaacdb48208                                    |           64 |       278,656
    |  '- Total: 2 entries                                                                     |              |              
    |- referent java.lang.ref.Finalizer @ 0x2aaacdb48248                                       |           64 |       278,720
    '- Total: 2 entries                                                                        |              |              
    You know if exists a newer version of JDBC driver that this one I'm using?
    best regards
    Clóvis

  • Understanding Symbol/Instance hierarchy relationships

    Hello
    I am looking for some insight into the symbol/instance
    hierarchy.
    First off what I have done simple enough is create a dynamic
    text field and convert it to a symbol.
    This symbol has an instance name of "symHeader".
    I then dragged an instance of that symbol to the stage and
    gave it an instance name of "instHeader".
    I was having problems populating it with what seemed like a
    logical approach:
    symHeader.instHeader.text = "blabla";
    with no luck.
    In looking at the object list in debug, it occurred to me
    that it should be:
    instHeader.symHeader.text = "blabla".
    This seems sort of backwards in the hierarchy of things.
    I figured since instHeader was and instance of symHeader,
    symHeader would be the first item listed, then drill down to
    instHeader.
    Can someone familiar with the symbol/instance hierarchy
    explain why this is this way, maybe I need to look at this in a
    different way.
    Thanks
    Scotty

    >> I then dragged an instance of that symbol to the
    stage and gave it an
    >> instance
    name of "instHeader".
    Then you just want to do: instHeader.text = "blabla";
    The first name you gave it - symHeader is just the clips name
    in the
    library. When you actually take the clip from the library and
    place it on
    the stage - then you are creating an instance of that clip.
    HTH
    Dave -
    Head Developer
    www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Hello, Is there an easy way of understanding what menu language means before you press the button, for instance, DUPLICATE, does it mean delete duplicates or form them? Cyfrommayo

    Is there an easy way of understanding what to expect when I press something like DUPLICATE?
    Cyfrommayo

    Thanks Guys,
    Yes, SAVE AS makes sense now you have illustrated it. Would an opportunity to rename the copy file have been a good idea? Additionally, a place to save the copy, something like the old PC way?
    I got to this question, because of another incident which ended up with many duplicates, the help files did not know what the question DELETE DUPLICATE was? I have therefore ended up deleting individual duplicate files as a 'work around'. The learning curve hey.
    Regards,
    Cyfrommayo

Maybe you are looking for

  • External monitor not being detected

    I recently sent my macBook away for repairs, it was only software problems, the engineers it seemed simply uninstalled and reinstalled the software. Since I have had it back, I cannot get it to detect my Dell 2209WA. It was fine before. I am using a

  • How to import photos from iphone

    I can not import my photos from my iphone6 to my Macbook pro. I have plugged it in and clicked import and nothing happens. It's very frustrating. I've tried unplugging and re-plugging the phone. I've tried restarting the computer but it will not let

  • Switching R/3 source systems

    Hi SDN gurus, We have a scenario where we sould like to change a test R/3 source system in our BI7 box. Currently there are lots of flows from QA1 (old style datasources/transfer rules etc), if a new R/3 system QA2 is created and connected, is there

  • Need advice with internal DVD Drive

    Hello, my dvd drive reads CD's but not DVD's (Movie or Data). It makes a clicking sound then ejects the DVD which made me think it was a hardware failure, but when I put in a CD,it is fine. I've deleted the dvd.plist and ran permmission fixer. Any id

  • Error IN and Error OUT

    Is error in and error out important? If I leave out error in & out can I VI still run. What is the purpose of errir in & out?