@Override protected void deallocate() { setupFrame.release(); } }
public void updateRemotePosition(int remotePosition) { if (remotePosition > currentPosition) { throw new IllegalStateException( "Remote ahead of " + lastRemotePosition + " , expected " + remotePosition); } if (remotePosition == lastRemotePosition) { return; } if (remotePosition < lastRemotePosition) { throw new IllegalStateException( "Remote position moved back from " + lastRemotePosition + " to " + remotePosition); } lastRemotePosition = remotePosition; Iterator<Map.Entry<Integer, Frame>> positions = frames.entrySet().iterator(); while (positions.hasNext()) { Map.Entry<Integer, Frame> cachePosition = positions.next(); if (cachePosition.getKey() <= remotePosition) { positions.remove(); bufferSize -= strategy.cost(cachePosition.getValue()); cachePosition.getValue().release(); } // TODO check for a bad position } }
private void handleIncomingFrames(Frame frame) { try { int streamId = frame.getStreamId(); FrameType type = frame.getType(); if (streamId == 0) { handleStreamZero(type, frame); } else { handleFrame(streamId, type, frame); } } finally { frame.release(); } }
frame.release();
@Override protected void deallocate() { setupFrame.release(); } }
public void updateRemotePosition(int remotePosition) { if (remotePosition > currentPosition) { throw new IllegalStateException( "Remote ahead of " + lastRemotePosition + " , expected " + remotePosition); } if (remotePosition == lastRemotePosition) { return; } if (remotePosition < lastRemotePosition) { throw new IllegalStateException( "Remote position moved back from " + lastRemotePosition + " to " + remotePosition); } lastRemotePosition = remotePosition; Iterator<Map.Entry<Integer, Frame>> positions = frames.entrySet().iterator(); while (positions.hasNext()) { Map.Entry<Integer, Frame> cachePosition = positions.next(); if (cachePosition.getKey() <= remotePosition) { positions.remove(); bufferSize -= strategy.cost(cachePosition.getValue()); cachePosition.getValue().release(); } // TODO check for a bad position } }
int version = Frame.Setup.version(setupFrame); if (version != SetupFrameFlyweight.CURRENT_VERSION) { setupFrame.release(); InvalidSetupException error = new InvalidSetupException(
private void handleIncomingFrames(Frame frame) { try { int streamId = frame.getStreamId(); FrameType type = frame.getType(); if (streamId == 0) { handleStreamZero(type, frame); } else { handleFrame(streamId, type, frame); } } finally { frame.release(); } }
int version = Frame.Setup.version(setupFrame); if (version != SetupFrameFlyweight.CURRENT_VERSION) { setupFrame.release(); InvalidSetupException error = new InvalidSetupException(