How to invoke a method on termination of some method

Is it possible to invoke a method when some method terminates.For example suppose there are two methods X( ) and Y( ).When method X( ) is terminated i want to invoke method Y( ).

Here X( ) is an eventListener method so i can not invoke method Y( ) explictly by calling them in order.

[303 byte] By [akt_008] at [2007-9-26 23:43:55]
# 1
why don't you put a call to y in x?
Sagnam at 2007-7-4 13:44:42 > top of Java-index,Archived Forums,Java Programming...
# 2
On method X( ) some resources are locked that will be released only after method X( ) terminates. so calling method Y( ) from inside X( ) does not solve my problem.
akt_008 at 2007-7-4 13:44:42 > top of Java-index,Archived Forums,Java Programming...
# 3
do so in the finalize block
shodhansheth at 2007-7-4 13:44:42 > top of Java-index,Archived Forums,Java Programming...
# 4

If those resources are released after X() terminates, then it must be some other method that is releasing them. So perhaps that other method should call Y() after it does so. If the releasing is happening in a different thread, then you need some synchronization. But it's almost impossible to say much about such a vague question.

DrClap at 2007-7-4 13:44:42 > top of Java-index,Archived Forums,Java Programming...