0

How can I automatically thread a function when it is called in Java ? In Python I would do:

def threaded(func):
    def wrapper(*_args, **kwargs):
        t = threading.Thread(target=func, args=_args)
        t.start()
        return
    return wrapper

@threaded
def function_to_thread():
    #blah

How can I do this or something similar in Java ?

0poss
  • 153
  • 1
  • 8

0 Answers0