/** * Publishes the event to the registered {@link ResultPartitionWriter} instances. * <p> * This method is either called directly from a {@link LocalInputChannel} or the network I/O * thread on behalf of a {@link RemoteInputChannel}. */ public boolean publish(ResultPartitionID partitionId, TaskEvent event) { EventListener<TaskEvent> listener = registeredWriters.get(partitionId); if (listener != null) { listener.onEvent(event); return true; } return false; }
final protected void addRequest(R request) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); final NotificationListener listener; synchronized (listenerLock) { listener = allRequestsProcessedListener; allRequestsProcessedListener = null; } if (listener != null) { listener.onNotification(); } throw new IOException("I/O channel already closed. Could not fulfill: " + request); } this.requestQueue.add(request); }
/** * Publishes the task event to all subscribed event listeners. * * @param event The event to publish. */ public void publish(TaskEvent event) { synchronized (listeners) { for (EventListener<TaskEvent> listener : listeners.get(event.getClass())) { listener.onEvent(event); } } } }
final protected void addRequest(R request) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); final NotificationListener listener; synchronized (listenerLock) { listener = allRequestsProcessedListener; allRequestsProcessedListener = null; } if (listener != null) { listener.onNotification(); } throw new IOException("I/O channel already closed. Could not fulfill: " + request); } this.requestQueue.add(request); }
/** * Publishes the task event to all subscribed event listeners. * * @param event The event to publish. */ public void publish(TaskEvent event) { synchronized (listeners) { for (EventListener<TaskEvent> listener : listeners.get(event.getClass())) { listener.onEvent(event); } } } }
final protected void addRequest(R request) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); final NotificationListener listener; synchronized (listenerLock) { listener = allRequestsProcessedListener; allRequestsProcessedListener = null; } if (listener != null) { listener.onNotification(); } throw new IOException("I/O channel already closed. Could not fulfill: " + request); } this.requestQueue.add(request); }
/** * Publishes the task event to all subscribed event listeners. * * @param event The event to publish. */ public void publish(TaskEvent event) { synchronized (listeners) { for (EventListener<TaskEvent> listener : listeners.get(event.getClass())) { listener.onEvent(event); } } } }
/** * Publishes the task event to all subscribed event listeners. * * @param event The event to publish. */ public void publish(TaskEvent event) { synchronized (listeners) { for (EventListener<TaskEvent> listener : listeners.get(event.getClass())) { listener.onEvent(event); } } } }
@Override public void recycle(MemorySegment segment) { synchronized (availableMemorySegments) { if (isDestroyed || numberOfRequestedMemorySegments > currentPoolSize) { returnMemorySegment(segment); } else { EventListener<Buffer> listener = registeredListeners.poll(); if (listener == null) { availableMemorySegments.add(segment); availableMemorySegments.notify(); } else { try { listener.onEvent(new Buffer(segment, this)); } catch (Throwable ignored) { availableMemorySegments.add(segment); availableMemorySegments.notify(); } } } } }
final protected void addRequest(R request) throws IOException { // check the error state of this channel checkErroneous(); // write the current buffer and get the next one this.requestsNotReturned.incrementAndGet(); if (this.closed || this.requestQueue.isClosed()) { // if we found ourselves closed after the counter increment, // decrement the counter again and do not forward the request this.requestsNotReturned.decrementAndGet(); final NotificationListener listener; synchronized (listenerLock) { listener = allRequestsProcessedListener; allRequestsProcessedListener = null; } if (listener != null) { listener.onNotification(); } throw new IOException("I/O channel already closed (" + this.closed + "," + this.requestQueue.isClosed() + "). Could not fulfill: " + request); } this.requestQueue.add(request); }
/** * Destroy is called after the produce or consume phase of a task finishes. */ @Override public void lazyDestroy() { synchronized (availableMemorySegments) { if (!isDestroyed) { MemorySegment segment; while ((segment = availableMemorySegments.poll()) != null) { returnMemorySegment(segment); } EventListener<Buffer> listener; while ((listener = registeredListeners.poll()) != null) { listener.onEvent(null); } isDestroyed = true; } } networkBufferPool.destroyBufferPool(this); }