Skip to content

Commit 56974f7

Browse files
committed
Updates from review
Signed-off-by: 이현수 <[email protected]>
1 parent f7bcc7f commit 56974f7

File tree

3 files changed

+10
-272
lines changed

3 files changed

+10
-272
lines changed

jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Connection.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@
4141
import org.eclipse.jetty.util.BufferUtil;
4242
import org.eclipse.jetty.util.Callback;
4343
import org.eclipse.jetty.util.TypeUtil;
44-
import org.eclipse.jetty.util.component.Dumpable;
4544
import org.eclipse.jetty.util.component.LifeCycle;
4645
import org.eclipse.jetty.util.thread.AutoLock;
4746
import org.eclipse.jetty.util.thread.ExecutionStrategy;
4847
import org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy;
4948
import org.slf4j.Logger;
5049
import org.slf4j.LoggerFactory;
5150

52-
public class HTTP2Connection extends AbstractConnection implements Parser.Listener, Connection.UpgradeTo, Dumpable
51+
public class HTTP2Connection extends AbstractConnection implements Parser.Listener, Connection.UpgradeTo
5352
{
5453
private static final Logger LOG = LoggerFactory.getLogger(HTTP2Connection.class);
5554

@@ -334,12 +333,6 @@ public String toConnectionString()
334333
return "%s@%x[%s]".formatted(TypeUtil.toShortName(getClass()), hashCode(), strategy);
335334
}
336335

337-
@Override
338-
public void dump(Appendable out, String indent) throws IOException
339-
{
340-
Dumpable.dumpObjects(out, indent, this, session);
341-
}
342-
343336
protected class HTTP2Producer implements ExecutionStrategy.Producer
344337
{
345338
private static final RetainableByteBuffer.Mutable STOPPED = new RetainableByteBuffer.NonRetainableByteBuffer(BufferUtil.EMPTY_BUFFER);

jetty-core/jetty-http2/jetty-http2-common/src/main/java/org/eclipse/jetty/http2/HTTP2Session.java

Lines changed: 9 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Collection;
2424
import java.util.Collections;
2525
import java.util.EventListener;
26-
import java.util.HashMap;
2726
import java.util.Iterator;
2827
import java.util.List;
2928
import java.util.Map;
@@ -35,7 +34,6 @@
3534
import java.util.concurrent.TimeoutException;
3635
import java.util.concurrent.atomic.AtomicInteger;
3736
import java.util.concurrent.atomic.AtomicLong;
38-
import java.util.concurrent.atomic.AtomicReference;
3937
import java.util.function.BiConsumer;
4038
import java.util.function.Consumer;
4139
import java.util.function.Predicate;
@@ -94,11 +92,11 @@ public abstract class HTTP2Session extends AbstractLifeCycle implements Session,
9492
private static final int MAX_TOTAL_LOCAL_STREAMS = Integer.MAX_VALUE / 2;
9593

9694
private final Map<Integer, HTTP2Stream> streams = new ConcurrentHashMap<>();
95+
private final Map<Integer, Integer> localSettings = new ConcurrentHashMap<>();
96+
private final Map<Integer, Integer> remoteSettings = new ConcurrentHashMap<>();
9797
private final Set<Integer> priorityStreams = ConcurrentHashMap.newKeySet();
9898
private final List<FrameListener> frameListeners = new CopyOnWriteArrayList<>();
9999
private final List<LifeCycleListener> lifeCycleListeners = new CopyOnWriteArrayList<>();
100-
private final AtomicReference<Map<Integer, Integer>> localSettingsSnapshot = new AtomicReference<>(Map.of());
101-
private final AtomicReference<Map<Integer, Integer>> remoteSettingsSnapshot = new AtomicReference<>(Map.of());
102100
private final AtomicLong streamsOpened = new AtomicLong();
103101
private final AtomicLong streamsClosed = new AtomicLong();
104102
private final StreamsState streamsState = new StreamsState();
@@ -304,26 +302,6 @@ public long getBytesWritten()
304302
return bytesWritten.get();
305303
}
306304

307-
/**
308-
* Returns a snapshot of the last SETTINGS that this endpoint sent
309-
* <p>The map keys are SETTINGS ids as defined in {@link SettingsFrame}.
310-
* @return local (sent) SETTINGS
311-
*/
312-
public Map<Integer, Integer> getCurrentLocalSettings()
313-
{
314-
return localSettingsSnapshot.get();
315-
}
316-
317-
/**
318-
* Returns a snapshot of the last SETTINGS that the peer sent
319-
* <p>The map keys are SETTINGS ids as defined in {@link SettingsFrame}.
320-
* @return remote (received) SETTINGS
321-
*/
322-
public Map<Integer, Integer> getCurrentRemoteSettings()
323-
{
324-
return remoteSettingsSnapshot.get();
325-
}
326-
327305
@Override
328306
public void onData(DataFrame frame)
329307
{
@@ -470,15 +448,7 @@ public void onSettings(SettingsFrame frame, boolean reply)
470448
return;
471449

472450
Map<Integer, Integer> settings = frame.getSettings();
473-
remoteSettingsSnapshot.updateAndGet(origin ->
474-
{
475-
if (settings.isEmpty())
476-
return origin;
477-
Map<Integer, Integer> updated = new HashMap<>(origin);
478-
updated.putAll(settings);
479-
return Map.copyOf(updated);
480-
});
481-
451+
remoteSettings.putAll(settings);
482452
configure(settings, false);
483453
notifySettings(this, frame);
484454

@@ -846,17 +816,8 @@ public void succeeded(Stream pushed)
846816
public void settings(SettingsFrame frame, Callback callback)
847817
{
848818
if (!frame.isReply())
849-
{
850-
Map<Integer, Integer> settings = frame.getSettings();
851-
localSettingsSnapshot.updateAndGet(origin ->
852-
{
853-
if (settings.isEmpty())
854-
return origin;
855-
Map<Integer, Integer> updated = new HashMap<>(origin);
856-
updated.putAll(settings);
857-
return Map.copyOf(updated);
858-
});
859-
}
819+
localSettings.putAll(frame.getSettings());
820+
860821
control(null, callback, frame);
861822
}
862823

@@ -1488,9 +1449,10 @@ protected static boolean isClientStream(int streamId)
14881449
@Override
14891450
public void dump(Appendable out, String indent) throws IOException
14901451
{
1491-
DumpableMap localSettings = new DumpableMap("local settings", getCurrentLocalSettings());
1492-
DumpableMap remoteSettings = new DumpableMap("remote settings", getCurrentRemoteSettings());
1493-
Dumpable.dumpObjects(out, indent, this, flowControl, flusher, new DumpableCollection("streams", streams.values()), localSettings, remoteSettings);
1452+
DumpableCollection streams = new DumpableCollection("streams", this.streams.values());
1453+
DumpableMap localSettings = new DumpableMap("local settings", this.localSettings);
1454+
DumpableMap remoteSettings = new DumpableMap("remote settings", this.remoteSettings);
1455+
Dumpable.dumpObjects(out, indent, this, flowControl, flusher, streams, localSettings, remoteSettings);
14941456
}
14951457

14961458
@Override

jetty-core/jetty-http2/jetty-http2-tests/src/test/java/org/eclipse/jetty/http2/tests/HTTP2ConnectionDumpTest.java

Lines changed: 0 additions & 217 deletions
This file was deleted.

0 commit comments

Comments
 (0)