public void cancelRead(final SendChannelEndpoint transport) { transports = ArrayUtil.remove(transports, transport); }
public void cancelRead(final ReceiveChannelEndpoint channelEndpoint, final UdpChannelTransport transport) { final ChannelAndTransport[] transports = this.channelAndTransports; int index = ArrayUtil.UNKNOWN_INDEX; for (int i = 0, length = transports.length; i < length; i++) { if (channelEndpoint == transports[i].channelEndpoint && transport == transports[i].transport) { index = i; break; } } if (index != ArrayUtil.UNKNOWN_INDEX) { this.channelAndTransports = ArrayUtil.remove(transports, index); } }
/** * Remove an element from an array resulting in a new array if the element was found otherwise the old array. * <p> * Returns its input parameter if the element to remove isn't a member. * * @param oldElements to have the element removed from. * @param elementToRemove being searched for by identity semantics. * @param <T> type of the array. * @return a new array without the element if found otherwise the original array. */ public static <T> T[] remove(final T[] oldElements, final T elementToRemove) { final int length = oldElements.length; int index = UNKNOWN_INDEX; for (int i = 0; i < length; i++) { if (oldElements[i] == elementToRemove) { index = i; } } return remove(oldElements, index); }
public void removeSubscriber(final ReadablePosition spyPosition) { spyPositions = ArrayUtil.remove(spyPositions, spyPosition); hasSpies = spyPositions.length > 0; spyPosition.close(); }
/** * Remove a {@link ReadablePosition} for a subscriber that has been removed so it is not tracked for flow control. * * @param subscriberPosition for the subscriber that has been removed. */ public void removeSubscriber(final ReadablePosition subscriberPosition) { subscriberPositions = ArrayUtil.remove(subscriberPositions, subscriberPosition); subscriberPosition.close(); }
/** * Remove a member from an array if found, otherwise return the array unmodified. * * @param oldMembers to remove a member from. * @param memberId of the member to remove. * @return a new array with the member removed or the existing array if not found. */ public static ClusterMember[] removeMember(final ClusterMember[] oldMembers, final int memberId) { return ArrayUtil.remove(oldMembers, findMemberIndex(oldMembers, memberId)); }
public void removeSubscriber(final ReadablePosition subscriberPosition) { consumerPosition = Math.max(consumerPosition, subscriberPosition.getVolatile()); subscriberPositions = ArrayUtil.remove(subscriberPositions, subscriberPosition); subscriberPosition.close(); if (subscriberPositions.length == 0) { LogBufferDescriptor.isConnected(metaDataBuffer, false); } }
public void onRemoveNetworkPublication(final NetworkPublication publication) { networkPublications = ArrayUtil.remove(networkPublications, publication); publication.channelEndpoint().unregisterForSend(publication); publication.senderRelease(); }
private void remove(final Agent agent) { removeAgent.lazySet(null); final Agent[] newAgents = ArrayUtil.remove(agents, agent); try { if (newAgents != agents) { agent.onClose(); } } finally { agents = newAgents; } } }
Image removeImage(final long correlationId) { final Image[] oldArray = images; Image removedImage = null; int i = 0; for (final Image image : oldArray) { if (image.correlationId() == correlationId) { image.close(); removedImage = image; break; } i++; } if (null != removedImage) { images = ArrayUtil.remove(oldArray, i); conductor.releaseLogBuffers(removedImage.logBuffers(), correlationId); } return removedImage; }
@Test public void shouldNotRemoveMissingElement() { final Integer[] result = ArrayUtil.remove(values, THREE); assertArrayEquals(values, result); }
@Test public void shouldRemovePresentElementAtStart() { final Integer[] result = ArrayUtil.remove(values, ONE); assertArrayEquals(new Integer[]{ TWO }, result); }
@Test public void shouldRemoveByIndex() { final Integer[] result = ArrayUtil.remove(values, 0); assertArrayEquals(new Integer[]{ TWO }, result); } }
@Test public void shouldRemovePresentElementAtEnd() { final Integer[] result = ArrayUtil.remove(values, TWO); assertArrayEquals(new Integer[]{ ONE }, result); }
/** * Remove a member from an array if found, otherwise return the array unmodified. * * @param oldMembers to remove a member from. * @param memberId of the member to remove. * @return a new array with the member removed or the existing array if not found. */ public static ClusterMember[] removeMember(final ClusterMember[] oldMembers, final int memberId) { return ArrayUtil.remove(oldMembers, findMemberIndex(oldMembers, memberId)); }
void disableSession(final InternalSession session) { sessions = ArrayUtil.remove(sessions, session); session.disable(); }
/** * Remove a {@link ReadablePosition} for a subscriber that has been removed so it is not tracked for flow control. * * @param subscriberPosition for the subscriber that has been removed. */ public void removeSubscriber(final ReadablePosition subscriberPosition) { subscriberPositions = ArrayUtil.remove(subscriberPositions, subscriberPosition); subscriberPosition.close(); }
public void removeSubscriber(final ReadablePosition spyPosition) { spyPositions = ArrayUtil.remove(spyPositions, spyPosition); hasSpies = spyPositions.length > 0; spyPosition.close(); }
public void removeSubscriber(final ReadablePosition subscriberPosition) { consumerPosition = Math.max(consumerPosition, subscriberPosition.getVolatile()); subscriberPositions = ArrayUtil.remove(subscriberPositions, subscriberPosition); subscriberPosition.close(); if (subscriberPositions.length == 0) { LogBufferDescriptor.isConnected(metaDataBuffer, false); } }
public void onRemoveNetworkPublication(final NetworkPublication publication) { networkPublications = ArrayUtil.remove(networkPublications, publication); publication.channelEndpoint().unregisterForSend(publication); publication.senderRelease(); }