I have a code to get the cursor once for this example, and the log shows that it has been said many times Goes, although I have been marked as final. What am I missing?
, And second time the final object should be reused for return In Functions in Java Fixed local variables are not (like C); Last
means that you are completely different for what you are doing.
The only way is that you Like that Using static examples or members of a class, eg:
class Foo {cursor to private cursor; private synchronized cursor receiving all contacts () (if (this.theCursor == tap) } {This.theCursor = this.getList ();} this.}}
(This is an example-specific way, you can do this in a square wide way, but I It seems that this cursor
.)
Note that the whole method is synchronized It is important that it If you have only an adaptation of the cursor if you have only one example of the cursor, and not important, then you can live with the status of the race and you can not synchronize, in this case you can do the function by two Can return different cursors. (You may be tempted to use, but as long as you do not use the fluctuating
variable, and do not work with Java to further and synchronize it.)
Comments
Post a Comment