what can happen if some thread makes object null and other thread is inside method of that object
Tag : java , By : fstender
Date : March 29 2020, 07:55 AM
like below fixes the issue Summarising SJuan76 and the op's discussion: Looks like there are two references to t, but only one to b (the one inside t). t will not get released, because the threads hold it independently. However, b may be deleted (depending on gc) because its ref count will drop to zero once the reference is nullified.
|
Python object method in a new thread
Date : March 29 2020, 07:55 AM
Hope this helps Use t1 = threading.Thread( target = obj.foo ) instead. In this case, the Thread constructor is expecting a reference to a function...when you pass it obj.foo(), you are passing it the result of the foo() function. That's not what you want! Pass a reference to the function.
|
Get target Object in Aspect and call another method on target object
Tag : java , By : ugufugu
Date : March 29 2020, 07:55 AM
this will help I figured out how to invoke the method. I need to get the method and invoke it, then I do not need to do casting for the class.
Object targetObject = joinPoint.getTarget();
Method m = targetObject.getMethod("getC");
m.invoke(targetObject);
|
What happens to a thread executing a method as target
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , A simple test shows that the thread is still in memory, "stopped" after it finishes its process: import threading
def speak():
pass
thread = threading.Thread(target=speak, args=())
thread.start()
thread.join() # wait for the process to finish;
print thread
# Result: <Thread(Thread-1, stopped 21864)>
|
How to trigger event on current thread's target object
Tag : java , By : Alex Sadzawka
Date : March 29 2020, 07:55 AM
|