Increases the reference counter for the given event so that it is not
accidentally removed.

@param eventId id of the entry
964948
private void lockEvent(EventId eventId) {
		Lockable<V> eventWrapper = sharedBuffer.getEvent(eventId);
		checkState(
			eventWrapper != null,
			"Referring to non existent event with id %s",
			eventId);
		eventWrapper.lock();
		sharedBuffer.upsertEvent(eventId, eventWrapper);
	}
478114
protected boolean isDuplicate(String eventID) {
        if (this.receivedEvents == null) {
            this.receivedEvents = new LRUCache<String>();
        }

        return !this.receivedEvents.add(eventID);
    }
1053427
def add_event(self, key, event):
        """"""
        if key in self.keys or key in self.events:
            raise EventStore.EventKeyAlreadyExistError(
                "The key already existed: {0}".format(key))
        self.keys.append(key)
        # Important no exceptions happen between these lines!
        self.events[key] = event
1265000
private void releaseID(int id) {
        ids.removeInt(id);
        nextID = 1;
        for (int i = 0; i < ids.size(); i++) {
            nextID = Math.max(ids.get(i) + 1, nextID);
        }
    }
351981
public void incrementRetryCount(String clientId)
	{
		Integer retryCount = this.retryCounts.get(clientId);
		this.retryCounts.put(clientId, retryCount == null ? 1 : retryCount + 1);
	}
166295
public void incrementSync(String distributedObjectName, int count) {
        getOrPutIfAbsent(eventCounterMap, distributedObjectName, EVENT_COUNTER_CONSTRUCTOR_FN)
                .incrementSyncCount(count);
    }
819406
final public void addIdAndRef(Integer id, Long ref, int additionalId,
      long additionalRef) {
    if (id != null) {
      MtasTreeNodeId tnId = new MtasTreeNodeId(ref, additionalId,
          additionalRef);
      ids.put(id, tnId);
    }
  }
951596
private int decrementReferenceCounter(final JobID jobID) {

		final AtomicInteger ai = this.libraryReferenceCounter.get(jobID);

		if (ai == null) {
			throw new IllegalStateException("Cannot find reference counter entry for job " + jobID);
		}

		int retVal = ai.decrementAndGet();

		if (retVal == 0) {
			this.libraryReferenceCounter.remove(jobID);
		}

		return retVal;
	}
440768
@Reference(service = EventEngine.class,
               cardinality = ReferenceCardinality.MANDATORY)
    protected void setEventService(EventEngine service) {
        this.eventService = service;
    }
813098
private void addEvent(JobID jobID, AbstractEvent event) {

		synchronized (this.collectedEvents) {

			List<AbstractEvent> eventList = this.collectedEvents.get(jobID);
			if (eventList == null) {
				eventList = new ArrayList<AbstractEvent>();
				this.collectedEvents.put(jobID, eventList);
			}

			eventList.add(event);
		}
	}
32859
public void updateEvent(String key, String value) {
        updateEvent(key, value, true, true);
    }
1138526
public void incrementRemoved() {
        if (removed == false && rctxt != null) {
            rctxt.removeWrapper(jspUri);
        }
        removed = true;
    }
294625
function (eventId) {
      var i;
      for (i = 0; i < this._events.length; i++) {
         var evt = this._events[i];
         if (evt.eventId === eventId) {
            return evt;
         }
      }
      return false;
   }
438958
public void resetRetryCount(String clientId)
	{
		Integer currentRetryCount = this.retryCounts.get(clientId);
		if (currentRetryCount != null && currentRetryCount.intValue() != 0)
		{
			this.retryCounts.put(clientId, 0);
		}
	}
815161
@Override
    public void add(Event event) {
        if (getNumStoredEvents() >= maxEvents) {
            logger.warn("Not adding Event because at least "
                + Integer.toString(maxEvents) + " events are already stored: " + event.getId());
            return;
        }

        File eventFile = new File(bufferDir.getAbsolutePath(), event.getId().toString() + FILE_SUFFIX);
        if (eventFile.exists()) {
            logger.trace("Not adding Event to offline storage because it already exists: "
                + eventFile.getAbsolutePath());
            return;
        } else {
            logger.debug("Adding Event to offline storage: " + eventFile.getAbsolutePath());
        }

        try (FileOutputStream fileOutputStream = new FileOutputStream(eventFile);
             ObjectOutputStream objectOutputStream = new ObjectOutputStream(fileOutputStream)) {
            objectOutputStream.writeObject(event);
        } catch (Exception e) {
            logger.error("Error writing Event to offline storage: " + event.getId(), e);
        }

        logger.debug(Integer.toString(getNumStoredEvents())
            + " stored events are now in dir: "
            + bufferDir.getAbsolutePath());
    }
1324561
@SuppressWarnings("unchecked")
   @CacheEntryModified
   public void cacheEntryModified(CacheEntryModifiedEvent<Serializable, Object> event)
   {
      if (!event.isPre() && event.getKey().equals(namesKey))
      {
         Set<String> set = (Set<String>)event.getValue();
         if (set != null)
         {
            refreshIndexes(set);
         }
      }
   }
184328
public void setId(final Integer id) {
        if (id == null && this.id == null) {
            return;
        } else if (id == null) {
            removeChild(this.id);
            this.id = null;
        } else if (this.id == null) {
            this.id = new KeyValueNode<Integer>(CommonConstants.CS_ID_TITLE, id);
            nodes.addFirst(this.id);
            if (this.id.getParent() != null) {
                this.id.removeParent();
            }
            this.id.setParent(this);
        } else {
            this.id.setValue(id);
        }
    }