Using variable or using direct method call



If I were to do this:

public void method() {
    Container parent = getParent();

    :::
    :::

    :::

    parent.callMethod(...);

    :::
    :::

    :::
    :::

    parent.callAnotherMethod(...);


::: ::: }


and if another thread were to change the parent, will the above fail since the method is not synchronized?


Or should I just leave it that way rather than change it to getParent().callMethod(...) everytime...but doing so is of no use since if the parent changes midway, the method's objective will not be met since it requires that the parent be the same throughout the method's scope?
.




Relevant Pages

  • Re: Using variable or using direct method call
    ... public void method() { ... and if another thread were to change the parent, ... two threads called callMethod() both of which change the members of parent. ...
    (comp.lang.java.programmer)
  • Re: ActionListener scoping
    ... an ActionListener, or return anything, or modify local method ... with its parent method. ... accessable by the method since the class scope is the method's parent ...
    (comp.lang.java.help)
  • Re: Object scope issue...
    ... So, the "update" method on the Parent class, inserts or updates parent ... What I was doing in my "Save" command button code was setting the parent ... I only do a database update. ... Is this typically how one would control an objects scope - by setting as ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Shutting down a service
    ... >When one of our services fails on our HPUNIX box we want to be able to ... by an external network-delivered command? ... Write a parent process that will ... is that the process that may fail should not daemonize itself, ...
    (comp.sys.hp.hpux)
  • Re: What objects must I clean up to avoid memory leaks?
    ... >Under DOS, it sufficed to let things fall out of scope at which point ... reference to the Parent ...
    (microsoft.public.vb.general.discussion)