# Callback servoy function from a plugin

**URL:** <https://forum.servoy.com/t/callback-servoy-function-from-a-plugin/14340>\
**Category:** Classic Servoy\
**Created:** [July 22, 2011, 3:19pm UTC](https://forum.servoy.com/t/callback-servoy-function-from-a-plugin/14340 "2011-07-22T15:19:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![udrescu\_bogdan](https://avatars.discourse-cdn.com/v4/letter/u/87869e/32.png) [@udrescu\_bogdan](https://forum.servoy.com/u/udrescu_bogdan)\
**Post date:** [July 22, 2011, 3:19pm UTC](https://forum.servoy.com/t/callback-servoy-function-from-a-plugin/14340/1 "2011-07-22T15:19:21Z")

</div>

Hi!

How can I do this?

What type of data is the functon: Function class? How can I call it back, so I can receive the call in servoy?

Thanks!  
Bogdan.

---

<div class="post-metadata">

**Author:** ![patrick](https://avatars.discourse-cdn.com/v4/letter/p/b2d939/32.png) [@patrick](https://forum.servoy.com/u/patrick)\
**Post date:** [July 26, 2011, 8:41am UTC](https://forum.servoy.com/t/callback-servoy-function-from-a-plugin/14340/2 "2011-07-26T08:41:43Z")

</div>

Function is a org.mozilla.javascript.Function. You need to add js.jar from lib to your build path.

You receive the Function and best store it as com.servoy.j2db.scripting.FunctionDefinition:

```auto
FunctionDefinition functionDef = new FunctionDefinition(method);

```

to execute a method then you use IClientPluginAccess.executeMethod() or functionDef.execute(IClientPluginAccess, …).

---

<div class="post-metadata">

**Author:** ![udrescu\_bogdan](https://avatars.discourse-cdn.com/v4/letter/u/87869e/32.png) [@udrescu\_bogdan](https://forum.servoy.com/u/udrescu_bogdan)\
**Post date:** [January 30, 2012, 1:51pm UTC](https://forum.servoy.com/t/callback-servoy-function-from-a-plugin/14340/3 "2012-01-30T13:51:52Z")

</div>

Is this method com.servoy.j2db.scripting.FunctionDefinition.execute(IClientPluginAccess access, Object arguments, boolean async) synchronized at a point? Because if I call it from 2 or more different threads it’s executed sequentially.

Yes I think it is… I think all functions written by me are synchronized within the same client only. Is this right?
