-
Notifications
You must be signed in to change notification settings - Fork 356
Move RSocketFactory implementation to core sub-package to avoid dependencies from top-level package #770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Move RSocketFactory implementation to core sub-package to avoid dependencies from top-level package #770
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
142 changes: 13 additions & 129 deletions
142
rsocket-core/src/main/java/io/rsocket/ConnectionSetupPayload.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,159 +1,43 @@ | ||
/* | ||
* Copyright 2015-2018 the original author or authors. | ||
* Copyright 2015-2020 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.rsocket; | ||
|
||
import io.netty.buffer.ByteBuf; | ||
import io.netty.util.AbstractReferenceCounted; | ||
import io.rsocket.frame.FrameHeaderFlyweight; | ||
import io.rsocket.frame.SetupFrameFlyweight; | ||
import io.netty.util.ReferenceCounted; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Exposed to server for determination of ResponderRSocket based on mime types and SETUP | ||
* metadata/data | ||
* Exposes information from the {@code SETUP} frame to a server, as well as to client responders. | ||
*/ | ||
public abstract class ConnectionSetupPayload extends AbstractReferenceCounted implements Payload { | ||
|
||
public static ConnectionSetupPayload create(final ByteBuf setupFrame) { | ||
return new DefaultConnectionSetupPayload(setupFrame); | ||
} | ||
public interface ConnectionSetupPayload extends ReferenceCounted, Payload { | ||
|
||
public abstract int keepAliveInterval(); | ||
String metadataMimeType(); | ||
|
||
public abstract int keepAliveMaxLifetime(); | ||
String dataMimeType(); | ||
|
||
public abstract String metadataMimeType(); | ||
int keepAliveInterval(); | ||
|
||
public abstract String dataMimeType(); | ||
int keepAliveMaxLifetime(); | ||
|
||
public abstract int getFlags(); | ||
int getFlags(); | ||
|
||
public abstract boolean willClientHonorLease(); | ||
boolean willClientHonorLease(); | ||
|
||
public abstract boolean isResumeEnabled(); | ||
boolean isResumeEnabled(); | ||
|
||
@Nullable | ||
public abstract ByteBuf resumeToken(); | ||
|
||
@Override | ||
public ConnectionSetupPayload retain() { | ||
super.retain(); | ||
return this; | ||
} | ||
|
||
@Override | ||
public ConnectionSetupPayload retain(int increment) { | ||
super.retain(increment); | ||
return this; | ||
} | ||
|
||
@Override | ||
public abstract ConnectionSetupPayload touch(); | ||
|
||
@Override | ||
public abstract ConnectionSetupPayload touch(Object hint); | ||
|
||
private static final class DefaultConnectionSetupPayload extends ConnectionSetupPayload { | ||
private final ByteBuf setupFrame; | ||
|
||
public DefaultConnectionSetupPayload(ByteBuf setupFrame) { | ||
this.setupFrame = setupFrame; | ||
} | ||
|
||
@Override | ||
public boolean hasMetadata() { | ||
return FrameHeaderFlyweight.hasMetadata(setupFrame); | ||
} | ||
|
||
@Override | ||
public int keepAliveInterval() { | ||
return SetupFrameFlyweight.keepAliveInterval(setupFrame); | ||
} | ||
|
||
@Override | ||
public int keepAliveMaxLifetime() { | ||
return SetupFrameFlyweight.keepAliveMaxLifetime(setupFrame); | ||
} | ||
|
||
@Override | ||
public String metadataMimeType() { | ||
return SetupFrameFlyweight.metadataMimeType(setupFrame); | ||
} | ||
|
||
@Override | ||
public String dataMimeType() { | ||
return SetupFrameFlyweight.dataMimeType(setupFrame); | ||
} | ||
|
||
@Override | ||
public int getFlags() { | ||
return FrameHeaderFlyweight.flags(setupFrame); | ||
} | ||
|
||
@Override | ||
public boolean willClientHonorLease() { | ||
return SetupFrameFlyweight.honorLease(setupFrame); | ||
} | ||
|
||
@Override | ||
public boolean isResumeEnabled() { | ||
return SetupFrameFlyweight.resumeEnabled(setupFrame); | ||
} | ||
|
||
@Override | ||
public ByteBuf resumeToken() { | ||
return SetupFrameFlyweight.resumeToken(setupFrame); | ||
} | ||
|
||
@Override | ||
public ConnectionSetupPayload touch() { | ||
setupFrame.touch(); | ||
return this; | ||
} | ||
|
||
@Override | ||
public ConnectionSetupPayload touch(Object hint) { | ||
setupFrame.touch(hint); | ||
return this; | ||
} | ||
|
||
@Override | ||
protected void deallocate() { | ||
setupFrame.release(); | ||
} | ||
|
||
@Override | ||
public ByteBuf sliceMetadata() { | ||
return SetupFrameFlyweight.metadata(setupFrame); | ||
} | ||
|
||
@Override | ||
public ByteBuf sliceData() { | ||
return SetupFrameFlyweight.data(setupFrame); | ||
} | ||
|
||
@Override | ||
public ByteBuf data() { | ||
return sliceData(); | ||
} | ||
|
||
@Override | ||
public ByteBuf metadata() { | ||
return sliceMetadata(); | ||
} | ||
} | ||
ByteBuf resumeToken(); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.