Added locking for endpoint.

Note that this only works with celix, starting from revision r1643222