public ReadWriteLock getRuntimeInstanceWideLock() { if (runtimeEnvironment == null) { throw new EPRuntimeDestroyedException(runtimeURI); } return runtimeEnvironment.getServices().getEventProcessingRWLock().getLock(); }
private void processThreadWorkQueueUnlatched(Object item) { EventBean eventBean; if (item instanceof EventBean) { eventBean = (EventBean) item; } else { throw new IllegalStateException("Unexpected item type " + item + " in queue"); } if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), false); } services.getEventProcessingRWLock().acquireReadLock(); try { processMatches(eventBean); } catch (RuntimeException ex) { matchesArrayThreadLocal.get().clear(); throw ex; } finally { services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aEvent(); } } dispatch(); }
private void processSchedule(long time) { if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qTime(time, services.getRuntimeURI()); } ArrayBackedCollection<ScheduleHandle> handles = scheduleArrayThreadLocal.get(); // Evaluation of schedules is protected by an optional scheduling service lock and then the runtimelock // We want to stay in this order for allowing the runtimelock as a second-order lock to the // services own lock, if it has one. services.getEventProcessingRWLock().acquireReadLock(); try { services.getSchedulingService().evaluate(handles); } finally { services.getEventProcessingRWLock().releaseReadLock(); } services.getEventProcessingRWLock().acquireReadLock(); try { processScheduleHandles(handles); } catch (RuntimeException ex) { handles.clear(); throw ex; } finally { services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aTime(); } } }
private void processThreadWorkQueueLatchedWait(InsertIntoLatchWait insertIntoLatch) { // wait for the latch to complete EventBean eventBean = insertIntoLatch.await(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), false); } services.getEventProcessingRWLock().acquireReadLock(); try { processMatches(eventBean); } catch (RuntimeException ex) { matchesArrayThreadLocal.get().clear(); throw ex; } finally { insertIntoLatch.done(); services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aEvent(); } } dispatch(); }
private void processThreadWorkQueueLatchedSpin(InsertIntoLatchSpin insertIntoLatch) { // wait for the latch to complete EventBean eventBean = insertIntoLatch.await(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), false); } services.getEventProcessingRWLock().acquireReadLock(); try { processMatches(eventBean); } catch (RuntimeException ex) { matchesArrayThreadLocal.get().clear(); throw ex; } finally { insertIntoLatch.done(); services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aEvent(); } } dispatch(); }
InstrumentationHelper.get().qEvent(eventBean, services.getRuntimeURI(), true); services.getEventProcessingRWLock().acquireReadLock(); try { processMatches(eventBean); throw new EPException(ex); } finally { services.getEventProcessingRWLock().releaseReadLock(); if (InstrumentationHelper.ENABLED) { InstrumentationHelper.get().aEvent();
services.getEventProcessingRWLock().releaseReadLock(); // Allow listener to create new statements try { unmatchedListener.update(theEvent); } finally { services.getEventProcessingRWLock().acquireReadLock();
options.getDeploymentLockStrategy().acquire(services.getEventProcessingRWLock()); } catch (Exception e) { throw new EPDeployLockException(e.getMessage(), e); options.getDeploymentLockStrategy().release(services.getEventProcessingRWLock());
options.getUndeploymentLockStrategy().acquire(services.getEventProcessingRWLock()); } catch (Exception e) { throw new EPUndeployLockException(e.getMessage(), e); options.getUndeploymentLockStrategy().release(services.getEventProcessingRWLock());