# Using a singleton

**URL:** <https://forum.universal-robots.com/t/using-a-singleton/5591>\
**Category:** Java\
**Created:** [November 15, 2019, 7:24am UTC](https://forum.universal-robots.com/t/using-a-singleton/5591 "2019-11-15T07:24:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![anon16641997](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@anon16641997](https://forum.universal-robots.com/u/anon16641997)\
**Post date:** [November 15, 2019, 7:24am UTC](https://forum.universal-robots.com/t/using-a-singleton/5591/1 "2019-11-15T07:24:57Z")

</div>

Hi!

I want to connect my contributions.  
And I saw on a forum post to use the singleton.  
But how do I implement this into my urcap java code?  
Many thanks!  
I made the singleton class down here:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/4/411c21855e6c066b14eb29454e58068564ddb95a.png)

---

<div class="post-metadata">

**Author:** ![m.birkholz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/m.birkholz/32/7084_2.png) [@m.birkholz](https://forum.universal-robots.com/u/m.birkholz)\
**Post date:** [November 15, 2019, 7:31am UTC](https://forum.universal-robots.com/t/using-a-singleton/5591/2 "2019-11-15T07:31:18Z")

</div>

sth. like this (or your example above):

```
public class Singleton {

private Singleton() {

}

public static Singleton getInstance() {
    if (instance == null) {
        instance = new Singleton();
    }
    return instance;
}

```

and finally call Singleton singleton = Singleton.getInstance(); in your contributions

---

<div class="post-metadata">

**Author:** ![anon16641997](https://avatars.discourse-cdn.com/v4/letter/a/dc4da7/32.png) [@anon16641997](https://forum.universal-robots.com/u/anon16641997)\
**Post date:** [November 15, 2019, 7:57am UTC](https://forum.universal-robots.com/t/using-a-singleton/5591/3 "2019-11-15T07:57:29Z")

</div>

Thanks @m.birkholz !  
I want to make multiple urcap nodes in the robot program and when I change the move speed of one, I want to change them all.  
I use this config:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/d/d61b52e85d24af8d318bb90343777854c30440ee.png)  
Do I need to place this in the singleton to make sure that every move changes?  
This is the robot program: (If i change the move speed on one “Global weld”, I want to change both MoveL)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/3/3b19fc7eb481eb465378cd3bc5aa63a9f8c82192.png)
