private void tryPut(Event event, long timeoutMS) throws EventQueueFullException { long sequence; long stopTime = System.currentTimeMillis() + timeoutMS; while (true) { try { sequence = this.ringBuffer.tryNext(1); WrappedEventFactory.WrappedEvent bufferedEvent = this.ringBuffer.get(sequence); bufferedEvent.setEvent(event); this.ringBuffer.publish(sequence); break; } catch (InsufficientCapacityException ex) { if (stopTime <= System.currentTimeMillis()) { throw new EventQueueFullException("Cannot send events because the event queue is full", ex); } try { Thread.sleep(1); } catch (InterruptedException ignored) { } } } }
private void tryPut(Event event, long timeoutMS) throws EventQueueFullException { long sequence; long stopTime = System.currentTimeMillis() + timeoutMS; while (true) { try { sequence = this.ringBuffer.tryNext(1); WrappedEventFactory.WrappedEvent bufferedEvent = this.ringBuffer.get(sequence); bufferedEvent.setEvent(event); this.ringBuffer.publish(sequence); break; } catch (InsufficientCapacityException ex) { if (stopTime <= System.currentTimeMillis()) { throw new EventQueueFullException("Cannot send events because the event queue is full", ex); } try { Thread.sleep(1); } catch (InterruptedException ignored) { } } } }
private void tryPut(Event event) throws EventQueueFullException { long sequence; try { sequence = this.ringBuffer.tryNext(1); WrappedEventFactory.WrappedEvent bufferedEvent = this.ringBuffer.get(sequence); bufferedEvent.setEvent(event); this.ringBuffer.publish(sequence); } catch (InsufficientCapacityException e) { throw new EventQueueFullException("Cannot send events because the event queue is full", e); } }
private void tryPut(Event event) throws EventQueueFullException { long sequence; try { sequence = this.ringBuffer.tryNext(1); WrappedEventFactory.WrappedEvent bufferedEvent = this.ringBuffer.get(sequence); bufferedEvent.setEvent(event); this.ringBuffer.publish(sequence); } catch (InsufficientCapacityException e) { throw new EventQueueFullException("Cannot send events because the event queue is full", e); } }