Ask Experts Questions for FREE Help !
Ask
    Lavanya9's Avatar
    Lavanya9 Posts: 2, Reputation: 1
    New Member
     
    #1

    Dec 22, 2015, 05:47 AM
    Flow of the program
    could you please explain the flow of program, is resource leak is happening in this code

    package nttdata;


    import javax.naming.InitialContext;
    import javax.naming.NamingException;


    public class Sample{


    public void test000(){
    try {
    InitialContext ctx = new InitialContext();
    } catch (NamingException e) {
    e.printStackTrace();
    }
    }


    public void test001(){
    try {
    InitialContext ctx = new InitialContext();
    call001(ctx);
    } catch (NamingException e) {
    e.printStackTrace();
    }
    }

    public void call001(InitialContext ctx){
    // do nothing.
    }



    public void test002(){
    try{
    InitialContext ctx = new InitialContext();
    call002(ctx);
    }catch(NamingException e){
    e.printStackTrace();
    }
    }

    private boolean isTrue = false;

    public void call002(InitialContext ctx){
    if(this.isTrue){
    try{
    ctx.close();
    }catch(NamingException e){
    e.printStackTrace();
    }
    }
    }


    }
    CravenMorhead's Avatar
    CravenMorhead Posts: 4,532, Reputation: 1065
    Adult Sexuality Expert
     
    #2

    Dec 22, 2015, 08:58 AM
    Where is the main function that calls this class? Do you think there are resource leaks?
    Lavanya9's Avatar
    Lavanya9 Posts: 2, Reputation: 1
    New Member
     
    #3

    Dec 22, 2015, 08:34 PM
    Hai,
    Good Morning :)
    Yes, I have this code myself, I want to know how the flow is in this code
    I want to know main difference between the flow of two methods (test001 and test002)

    is test001 and test002 functionality same?

    public void test001(){
    try {
    InitialContext ctx = new InitialContext();
    call001(ctx);
    } catch (NamingException e) {
    e.printStackTrace();
    }
    }

    public void call001(InitialContext ctx){
    // do nothing.
    }


    public void test002(){
    try{
    InitialContext ctx = new InitialContext();
    call002(ctx);
    }catch(NamingException e){
    e.printStackTrace();
    }
    }

    private boolean isTrue = false;

    public void call002(InitialContext ctx){
    if(this.isTrue){
    try{
    ctx.close();
    }catch(NamingException e){
    e.printStackTrace();
    }
    }
    }


    }

    Hai,
    Good Morning :)


    Yes, I have this code myself, I want to know how the flow is in this code
    I want to know main difference between the flow of two methods (test001 and test002)


    is test001 and test002 functionality same??


    public void test001(){
    try {
    InitialContext ctx = new InitialContext();
    call001(ctx);
    } catch (NamingException e) {
    e.printStackTrace();
    }
    }


    public void call001(InitialContext ctx){
    // do nothing.
    }




    public void test002(){
    try{
    InitialContext ctx = new InitialContext();
    call002(ctx);
    }catch(NamingException e){
    e.printStackTrace();
    }
    }


    private boolean isTrue = false;


    public void call002(InitialContext ctx){
    if(this.isTrue){
    try{
    ctx.close();
    }catch(NamingException e){
    e.printStackTrace();
    }
    }
    }




    }

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Program that convert a NFA to an equivalent DFA,I found this program in C [ 0 Answers ]

Program that convert a NFA to an equivalent DFA,by C++

How to convert low flow kitchen faucet to regular flow? [ 4 Answers ]

I recently had a new kitchen faucet installed. It is a pullout model made by Kohler. I unscrewed the spray spout from the hose and turned on the water. The flow was great and full force, so I know the restricter is in the spray spout, but I didn't see anything in the handle that I could remove...

At start cold air comes out at a good flow ,as the day progresses the flow weakens [ 6 Answers ]

Central air. At start up the air appears to be functioning well. As the day progresses the air flow from the vents weaken ,unit continues to run unable to cool to set temp.

Qestion1:emplyee pay program, question2:average program [ 1 Answers ]

I would just like to know how to write these programs and the proper way in which to go about doing so. Question #1 In this exercise you create a program that displays an employee’s name and gross pay. a) The figure below shows the partially completed IPO chart for the payroll program....

LDR industries low flow convert to higher flow? [ 2 Answers ]

Can I convert a low flow valve to a higher flow to fill the large jet tub faster than 20 minutes?


View more questions Search