public void cancelRead(final SendChannelEndpoint transport) { transports = ArrayUtil.remove(transports, transport); }
/** * Add a new subscriber to this image so their position can be tracked for flow control. * * @param subscriberPosition for the subscriber to be added. */ public void addSubscriber(final ReadablePosition subscriberPosition) { subscriberPositions = ArrayUtil.add(subscriberPositions, subscriberPosition); }
public int addDestination(final ReceiveDestinationUdpTransport transport) { int index = transports.length; for (int i = 0, length = transports.length; i < length; i++) { if (null == transports[i]) { index = i; break; } } transports = ArrayUtil.ensureCapacity(transports, index + 1); transports[index] = transport; numDestinations++; return index; }
private int pollPendingInitiatorSessions(final long timeInMs) { InternalSession[] pendingSessions = this.pendingInitiatorSessions; int total = 0; for (int i = 0, size = pendingSessions.length; i < size;) { final InternalSession session = pendingSessions[i]; total += session.poll(timeInMs); if (session.state() == ACTIVE) { this.pendingInitiatorSessions = pendingSessions = ArrayUtil.remove(pendingSessions, i); size--; sessions = ArrayUtil.add(sessions, session); } else { i++; } } return total; }
public static <T> T[] remove(final T[] oldElements, final int index) { if (index == UNKNOWN_INDEX) { return oldElements; } final int oldLength = oldElements.length; final int newLength = oldLength - 1; final T[] newElements = newArray(oldElements, newLength); for (int i = 0, j = 0; i < oldLength; i++) { if (index != i) { newElements[j++] = oldElements[i]; } } return newElements; }
public static <T> T[] remove(final T[] oldElements, final int index) { if (index == UNKNOWN_INDEX) { return oldElements; } final int oldLength = oldElements.length; final int newLength = oldLength - 1; final T[] newElements = newArray(oldElements, newLength); for (int i = 0, j = 0; i < oldLength; i++) { if (index != i) { newElements[j++] = oldElements[i]; } } return newElements; }
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); } }
/** * Add a new member to an array of {@link ClusterMember}s. * * @param oldMembers to add to. * @param newMember to add. * @return a new array containing the old members plus the new member. */ public static ClusterMember[] addMember(final ClusterMember[] oldMembers, final ClusterMember newMember) { return ArrayUtil.add(oldMembers, newMember); }
void addDestination(final int transportIndex, final ReceiveDestinationUdpTransport transport) { imageConnections = ArrayUtil.ensureCapacity(imageConnections, transportIndex + 1); if (transport.isMulticast()) { imageConnections[transportIndex] = new ImageConnection( cachedNanoClock.nanoTime(), transport.udpChannel().remoteControl()); } else if (transport.hasExplicitControl()) { imageConnections[transportIndex] = new ImageConnection( cachedNanoClock.nanoTime(), transport.explicitControlAddress()); } }
public static <T> T[] remove(final T[] oldElements, final int index) { if (index == UNKNOWN_INDEX) { return oldElements; } final int oldLength = oldElements.length; final int newLength = oldLength - 1; final T[] newElements = newArray(oldElements, newLength); for (int i = 0, j = 0; i < oldLength; i++) { if (index != i) { newElements[j++] = oldElements[i]; } } return newElements; }
/** * 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); }
void addImage(final Image image) { images = ArrayUtil.add(images, image); }
lastPacketTimestampNs = nowNs; imageConnections = ArrayUtil.ensureCapacity(imageConnections, transportIndex + 1); imageConnections[transportIndex] = new ImageConnection(nowNs, controlAddress);
public void removeSubscriber(final ReadablePosition spyPosition) { spyPositions = ArrayUtil.remove(spyPositions, spyPosition); hasSpies = spyPositions.length > 0; spyPosition.close(); }
public void addSubscriber(final ReadablePosition spyPosition) { spyPositions = ArrayUtil.add(spyPositions, spyPosition); hasSpies = true; if (spiesSimulateConnection) { LogBufferDescriptor.isConnected(metaDataBuffer, true); isConnected = true; } }
public int addDestination(final ReceiveDestinationUdpTransport transport) { int index = transports.length; for (int i = 0, length = transports.length; i < length; i++) { if (null == transports[i]) { index = i; break; } } transports = ArrayUtil.ensureCapacity(transports, index + 1); transports[index] = transport; numDestinations++; return index; }
/** * 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 addSubscriber(final ReadablePosition subscriberPosition) { LogBufferDescriptor.isConnected(metaDataBuffer, true); subscriberPositions = ArrayUtil.add(subscriberPositions, subscriberPosition); }
public int addDestination(final ReceiveDestinationUdpTransport transport) { int index = transports.length; for (int i = 0, length = transports.length; i < length; i++) { if (null == transports[i]) { index = i; break; } } transports = ArrayUtil.ensureCapacity(transports, index + 1); transports[index] = transport; numDestinations++; return index; }
/** * 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)); }