code: protected void checkIfAlreadyConnected(DeviceProxy device, String attribute, String event_name, CallBack callback, int max_size, boolean stateless)
              throws DevFailed {
          if (device == null || (callback == null && max_size < 0)) {
              Except.throw_wrong_syntax_exception("API_InvalidArgs",
                      "Device or callback pointer NULL and  event queue not used !!",
                      "EventConsumer.subscribe_event()");
          }
  
          if (device == null || device.name() == null)
              Except.throw_event_system_failed("API_NotificationServiceFailed",
                      "Failed to connect to device",
                      "EventConsumer.subscribe_event()");
          else {
              //	Check if already connected (exists in map)
              String callback_key = device.name().toLowerCase() + "/" + attribute + "." + event_name;
              if (event_callback_map.containsKey(callback_key))
                  Except.throw_event_system_failed("API_MethodArgument",
                          "Already connected to event " + callback_key,
                          "EventConsumer.subscribe_event()");
  
              //	Check if already trying to connects (exists in map)
              if (stateless && failed_event_callback_map.containsKey(callback_key))
                  Except.throw_event_system_failed("API_MethodArgument",
                          "Already trying to connect to event " + callback_key,
                          "EventConsumer.subscribe_event()");
          }
      }
docs: ===============================================================