Skip to content

Commit

Permalink
restructure packages (#132)
Browse files Browse the repository at this point in the history
  • Loading branch information
kortemik authored Apr 10, 2024
1 parent 2d79491 commit 115842e
Show file tree
Hide file tree
Showing 104 changed files with 302 additions and 239 deletions.
13 changes: 7 additions & 6 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,16 @@ Dependencies for examples

Server with shared handler for all connections. See ExampleRelpClient.java for client.

[source, java]
[source,java]
----
package com.teragrep.rlp_03.readme;
import com.teragrep.rlp_03.FrameContext;
import com.teragrep.rlp_03.Server;
import com.teragrep.rlp_03.ServerFactory;
import com.teragrep.rlp_03.context.channel.PlainFactory;
import com.teragrep.rlp_03.delegate.*;
import com.teragrep.rlp_03.frame.delegate.DefaultFrameDelegate;
import com.teragrep.rlp_03.frame.delegate.FrameContext;
import com.teragrep.rlp_03.frame.delegate.FrameDelegate;
import com.teragrep.rlp_03.server.Server;
import com.teragrep.rlp_03.server.ServerFactory;
import com.teragrep.rlp_03.channel.socket.PlainFactory;
import org.junit.jupiter.api.Test;
import java.io.IOException;
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/com/teragrep/rlp_03/EventLoop.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@
*/
package com.teragrep.rlp_03;

import com.teragrep.rlp_03.context.EstablishedContext;
import com.teragrep.rlp_03.context.Context;
import com.teragrep.rlp_03.channel.context.ConnectContext;
import com.teragrep.rlp_03.channel.context.EstablishedContext;
import com.teragrep.rlp_03.channel.context.Context;
import com.teragrep.rlp_03.channel.context.ListenContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -95,10 +97,6 @@ private void registerPendingRegistrations() {
}
}

public Selector selector() {
return selector;
}

public void poll() throws IOException {
int readyKeys = selector.select();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel;

public interface InterestOps {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.buffer;
package com.teragrep.rlp_03.channel.buffer;

import java.nio.ByteBuffer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.buffer;
package com.teragrep.rlp_03.channel.buffer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.buffer;
package com.teragrep.rlp_03.channel.buffer;

import java.nio.ByteBuffer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.buffer;
package com.teragrep.rlp_03.channel.buffer;

import java.nio.ByteBuffer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.buffer;
package com.teragrep.rlp_03.channel.buffer;

import java.nio.ByteBuffer;
import java.util.concurrent.Phaser;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.buffer;
package com.teragrep.rlp_03.channel.buffer;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.buffer;
package com.teragrep.rlp_03.channel.buffer;

import java.nio.ByteBuffer;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_03.context.*;
import com.teragrep.rlp_03.context.channel.SocketFactory;
import com.teragrep.rlp_03.delegate.FrameDelegate;
import com.teragrep.rlp_03.channel.InterestOps;
import com.teragrep.rlp_03.channel.InterestOpsImpl;
import com.teragrep.rlp_03.channel.socket.SocketFactory;
import com.teragrep.rlp_03.frame.delegate.FrameDelegate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_03.context.EstablishedContext;
import com.teragrep.rlp_03.context.channel.SocketFactory;
import com.teragrep.rlp_03.delegate.FrameDelegate;
import com.teragrep.rlp_03.channel.socket.SocketFactory;
import com.teragrep.rlp_03.frame.delegate.FrameDelegate;

import java.io.IOException;
import java.net.InetSocketAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel.context;

import java.io.Closeable;
import java.nio.channels.SelectionKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_03.context.channel.Socket;
import com.teragrep.rlp_03.channel.InterestOps;
import com.teragrep.rlp_03.channel.socket.Socket;

public interface EstablishedContext extends Context {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_03.delegate.FrameDelegate;
import com.teragrep.rlp_03.context.buffer.BufferLeasePool;
import com.teragrep.rlp_03.context.channel.Socket;
import com.teragrep.rlp_03.channel.*;
import com.teragrep.rlp_03.frame.delegate.FrameDelegate;
import com.teragrep.rlp_03.channel.buffer.BufferLeasePool;
import com.teragrep.rlp_03.channel.socket.Socket;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_03.context.channel.Socket;
import com.teragrep.rlp_03.channel.InterestOps;
import com.teragrep.rlp_03.channel.socket.Socket;

import java.nio.channels.SelectionKey;
import java.nio.channels.spi.AbstractSelectableChannel;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_03.context.*;
import com.teragrep.rlp_03.context.channel.Socket;
import com.teragrep.rlp_03.context.channel.SocketFactory;
import com.teragrep.rlp_03.delegate.FrameDelegate;
import com.teragrep.rlp_03.channel.InterestOps;
import com.teragrep.rlp_03.channel.InterestOpsImpl;
import com.teragrep.rlp_03.channel.socket.Socket;
import com.teragrep.rlp_03.channel.socket.SocketFactory;
import com.teragrep.rlp_03.frame.delegate.FrameDelegate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_03.context.channel.SocketFactory;
import com.teragrep.rlp_03.delegate.FrameDelegate;
import com.teragrep.rlp_03.channel.socket.SocketFactory;
import com.teragrep.rlp_03.frame.delegate.FrameDelegate;

import java.io.IOException;
import java.net.InetSocketAddress;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel.context;

import java.util.concurrent.atomic.AtomicBoolean;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,15 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_03.FrameContext;
import com.teragrep.rlp_03.delegate.FrameDelegate;
import com.teragrep.rlp_03.context.buffer.BufferLease;
import com.teragrep.rlp_03.context.buffer.BufferLeasePool;
import com.teragrep.rlp_03.context.frame.RelpFrameAccess;
import com.teragrep.rlp_03.context.frame.RelpFrameImpl;
import com.teragrep.rlp_03.context.frame.RelpFrameLeaseful;
import com.teragrep.rlp_03.frame.delegate.FrameContext;
import com.teragrep.rlp_03.frame.delegate.FrameDelegate;
import com.teragrep.rlp_03.channel.buffer.BufferLease;
import com.teragrep.rlp_03.channel.buffer.BufferLeasePool;
import com.teragrep.rlp_03.frame.RelpFrameAccess;
import com.teragrep.rlp_03.frame.RelpFrameImpl;
import com.teragrep.rlp_03.frame.RelpFrameLeaseful;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import tlschannel.NeedsReadException;
Expand Down Expand Up @@ -122,7 +122,7 @@ public void run() {
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("resuming buffer <{}>, activeBuffers <{}>", activeBuffers.get(0), activeBuffers);
}
complete = innerLoop(relpFrame, true);
complete = innerLoop(relpFrame);
}

while (activeBuffers.isEmpty() && !complete) {
Expand All @@ -135,7 +135,7 @@ public void run() {
return; // TODO this is quite ugly return, single point of return is preferred!
}

if (innerLoop(relpFrame, false)) {
if (innerLoop(relpFrame)) {
break;
}

Expand Down Expand Up @@ -164,7 +164,7 @@ public void run() {
}
}

private boolean innerLoop(RelpFrameLeaseful relpFrame, boolean hasRef) {
private boolean innerLoop(RelpFrameLeaseful relpFrame) {
boolean rv = false;
while (!activeBuffers.isEmpty()) {
// TODO redesign this, very coupled design here !
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_01.RelpFrameTX;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context;
package com.teragrep.rlp_03.channel.context;

import com.teragrep.rlp_01.RelpCommand;
import com.teragrep.rlp_01.RelpFrameTX;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.info;

import javax.net.ssl.SSLPeerUnverifiedException;
import javax.security.cert.X509Certificate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.info;

import javax.net.ssl.SSLPeerUnverifiedException;
import javax.security.cert.X509Certificate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.info;

import tlschannel.TlsChannel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.info;

public interface TransportInfo {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03;
package com.teragrep.rlp_03.channel.info;

import java.nio.channels.SocketChannel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.channel;
package com.teragrep.rlp_03.channel.socket;

import java.nio.channels.SocketChannel;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/
package com.teragrep.rlp_03.context.channel;
package com.teragrep.rlp_03.channel.socket;

import com.teragrep.rlp_03.EncryptionInfo;
import com.teragrep.rlp_03.EncryptionInfoStub;
import com.teragrep.rlp_03.TransportInfo;
import com.teragrep.rlp_03.TransportInfoImpl;
import com.teragrep.rlp_03.channel.info.EncryptionInfo;
import com.teragrep.rlp_03.channel.info.EncryptionInfoStub;
import com.teragrep.rlp_03.channel.info.TransportInfo;
import com.teragrep.rlp_03.channel.info.TransportInfoImpl;

import java.io.IOException;
import java.nio.ByteBuffer;
Expand Down
Loading

0 comments on commit 115842e

Please sign in to comment.