Skip to content

Commit

Permalink
Removed unused generic type
Browse files Browse the repository at this point in the history
  • Loading branch information
klaren committed Mar 13, 2018
1 parent 5d19bfa commit 5803468
Show file tree
Hide file tree
Showing 16 changed files with 35 additions and 38 deletions.
Expand Up @@ -80,12 +80,12 @@ public ProtocolVersion getProtocolVersion()
}

@Override
protected boolean shouldCheckStoreId( RequestType<TheBackupInterface> type )
protected boolean shouldCheckStoreId( RequestType type )
{
return type != BackupRequestType.FULL_BACKUP;
}

public enum BackupRequestType implements RequestType<TheBackupInterface>
public enum BackupRequestType implements RequestType
{
FULL_BACKUP( (TargetCaller<TheBackupInterface, Void>) ( master, context, input, target ) ->
{
Expand Down
Expand Up @@ -103,13 +103,13 @@ public HostnamePort getServerAddress()
}

@Override
protected void responseWritten( RequestType<TheBackupInterface> type, Channel channel,
protected void responseWritten( RequestType type, Channel channel,
RequestContext context )
{
}

@Override
protected RequestType<TheBackupInterface> getRequestContext( byte id )
protected RequestType getRequestContext( byte id )
{
return contexts[id];
}
Expand Down
10 changes: 5 additions & 5 deletions enterprise/com/src/main/java/org/neo4j/com/Client.java
Expand Up @@ -282,13 +282,13 @@ public void stop()
msgLog.info( toString() + " shutdown", true );
}

protected <R> Response<R> sendRequest( RequestType<T> type, RequestContext context,
protected <R> Response<R> sendRequest( RequestType type, RequestContext context,
Serializer serializer, Deserializer<R> deserializer )
{
return sendRequest( type, context, serializer, deserializer, null, NO_OP_TX_HANDLER );
}

protected <R> Response<R> sendRequest( RequestType<T> type, RequestContext context,
protected <R> Response<R> sendRequest( RequestType type, RequestContext context,
Serializer serializer, Deserializer<R> deserializer,
StoreId specificStoreId, TxHandler txHandler )
{
Expand Down Expand Up @@ -351,12 +351,12 @@ protected <R> Response<R> sendRequest( RequestType<T> type, RequestContext conte
}
}

protected long getReadTimeout( RequestType<T> type, long readTimeout )
protected long getReadTimeout( RequestType type, long readTimeout )
{
return readTimeout;
}

protected boolean shouldCheckStoreId( RequestType<T> type )
protected boolean shouldCheckStoreId( RequestType type )
{
return true;
}
Expand All @@ -374,7 +374,7 @@ private void assertCorrectStoreId( StoreId storeId, StoreId myStoreId )
}
}

private ChannelContext acquireChannelContext( RequestType<T> type )
private ChannelContext acquireChannelContext( RequestType type )
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion enterprise/com/src/main/java/org/neo4j/com/Protocol.java
Expand Up @@ -175,7 +175,7 @@ public static void assertChunkSizeIsWithinFrameSize( int chunkSize, int frameLen
}
}

public void serializeRequest( Channel channel, ChannelBuffer buffer, RequestType<?> type, RequestContext ctx,
public void serializeRequest( Channel channel, ChannelBuffer buffer, RequestType type, RequestContext ctx,
Serializer payload ) throws IOException
{
buffer.clear();
Expand Down
Expand Up @@ -19,7 +19,7 @@
*/
package org.neo4j.com;

public interface RequestType<M>
public interface RequestType
{
TargetCaller getTargetCaller();

Expand Down
16 changes: 8 additions & 8 deletions enterprise/com/src/main/java/org/neo4j/com/Server.java
Expand Up @@ -411,7 +411,7 @@ protected void handleRequest( ChannelBuffer buffer, final Channel channel )
if ( partialRequest == null )
{
// This is the first chunk in a multi-chunk request
RequestType<T> type = getRequestContext( buffer.readByte() );
RequestType type = getRequestContext( buffer.readByte() );
RequestContext context = readContext( buffer );
ChannelBuffer targetBuffer = mapSlave( channel, context );
partialRequest = new PartialRequest( type, context, targetBuffer );
Expand All @@ -422,7 +422,7 @@ protected void handleRequest( ChannelBuffer buffer, final Channel channel )
else
{
PartialRequest partialRequest = partialRequests.remove( channel );
RequestType<T> type;
RequestType type;
RequestContext context;
ChannelBuffer targetBuffer;
ChannelBuffer bufferToReadFrom;
Expand Down Expand Up @@ -488,7 +488,7 @@ protected void writeFailureResponse( Throwable exception, ChunkingChannelBuffer
}
}

protected void responseWritten( RequestType<T> type, Channel channel, RequestContext context )
protected void responseWritten( RequestType type, Channel channel, RequestContext context )
{
}

Expand All @@ -511,7 +511,7 @@ protected RequestContext readContext( ChannelBuffer buffer )
return readRequestContext;
}

protected abstract RequestType<T> getRequestContext( byte id );
protected abstract RequestType getRequestContext( byte id );

protected ChannelBuffer mapSlave( Channel channel, RequestContext slave )
{
Expand Down Expand Up @@ -551,13 +551,13 @@ protected ChunkingChannelBuffer newChunkingBuffer( ChannelBuffer bufferToWriteTo

private class TargetCaller implements Response.Handler, Runnable
{
private final RequestType<T> type;
private final RequestType type;
private final Channel channel;
private final RequestContext context;
private final ChunkingChannelBuffer targetBuffer;
private final ChannelBuffer bufferToReadFrom;

TargetCaller( RequestType<T> type, Channel channel, RequestContext context,
TargetCaller( RequestType type, Channel channel, RequestContext context,
ChunkingChannelBuffer targetBuffer, ChannelBuffer bufferToReadFrom )
{
this.type = type;
Expand Down Expand Up @@ -621,9 +621,9 @@ private class PartialRequest
{
final RequestContext context;
final ChannelBuffer buffer;
final RequestType<T> type;
final RequestType type;

PartialRequest( RequestType<T> type, RequestContext context, ChannelBuffer buffer )
PartialRequest( RequestType type, RequestContext context, ChannelBuffer buffer )
{
this.type = type;
this.context = context;
Expand Down
Expand Up @@ -26,7 +26,7 @@

public interface RequestMonitor
{
void beginRequest( SocketAddress remoteAddress, RequestType<?> requestType, RequestContext requestContext );
void beginRequest( SocketAddress remoteAddress, RequestType requestType, RequestContext requestContext );

void endRequest( Throwable t );
}
6 changes: 3 additions & 3 deletions enterprise/com/src/test/java/org/neo4j/com/MadeUpServer.java
Expand Up @@ -76,7 +76,7 @@ public HostnamePort getServerAddress()
}

@Override
protected void responseWritten( RequestType<MadeUpCommunicationInterface> type, Channel channel,
protected void responseWritten( RequestType type, Channel channel,
RequestContext context )
{
responseWritten = true;
Expand All @@ -96,7 +96,7 @@ protected byte getInternalProtocolVersion()
}

@Override
protected RequestType<MadeUpCommunicationInterface> getRequestContext( byte id )
protected RequestType getRequestContext( byte id )
{
return MadeUpRequestType.values()[id];
}
Expand All @@ -116,7 +116,7 @@ public boolean responseFailureEncountered()
return responseFailureEncountered;
}

enum MadeUpRequestType implements RequestType<MadeUpCommunicationInterface>
enum MadeUpRequestType implements RequestType
{
MULTIPLY( ( master, context, input, target ) ->
{
Expand Down
2 changes: 1 addition & 1 deletion enterprise/com/src/test/java/org/neo4j/com/ServerTest.java
Expand Up @@ -138,7 +138,7 @@ private Server<Object,Object> newServer( final TxChecksumVerifier checksumVerifi
mock( ByteCounterMonitor.class ), mock( RequestMonitor.class ) )
{
@Override
protected RequestType<Object> getRequestContext( byte id )
protected RequestType getRequestContext( byte id )
{
return mock( RequestType.class );
}
Expand Down
Expand Up @@ -22,7 +22,6 @@
import org.neo4j.com.ObjectSerializer;
import org.neo4j.com.RequestType;
import org.neo4j.com.TargetCaller;
import org.neo4j.kernel.ha.com.master.Master;

abstract class AbstractHaRequestTypes implements HaRequestTypes
{
Expand All @@ -40,13 +39,13 @@ protected <A,B,C> void register( Type type, TargetCaller<A,B> targetCaller, Obje
}

@Override
public RequestType<Master> type( Type type )
public RequestType type( Type type )
{
return type( (byte) type.ordinal() );
}

@Override
public RequestType<Master> type( byte id )
public RequestType type( byte id )
{
HaRequestType requestType = types[id];
if ( requestType == null )
Expand Down
Expand Up @@ -22,9 +22,8 @@
import org.neo4j.com.ObjectSerializer;
import org.neo4j.com.RequestType;
import org.neo4j.com.TargetCaller;
import org.neo4j.kernel.ha.com.master.Master;

public class HaRequestType implements RequestType<Master>
public class HaRequestType implements RequestType
{
private final TargetCaller targetCaller;
private final ObjectSerializer objectSerializer;
Expand Down
Expand Up @@ -20,7 +20,6 @@
package org.neo4j.kernel.ha;

import org.neo4j.com.RequestType;
import org.neo4j.kernel.ha.com.master.Master;

public interface HaRequestTypes
{
Expand All @@ -43,13 +42,13 @@ enum Type
CREATE_PROPERTY_KEY,
CREATE_LABEL;

public boolean is( RequestType<?> type )
public boolean is( RequestType type )
{
return type.id() == ordinal();
}
}

RequestType<Master> type( Type type );
RequestType type( Type type );

RequestType<Master> type( byte id );
RequestType type( byte id );
}
Expand Up @@ -151,7 +151,7 @@ public Deserializer<LockResult> createLockResultDeserializer()
}

@Override
protected long getReadTimeout( RequestType<Master> type, long readTimeout )
protected long getReadTimeout( RequestType type, long readTimeout )
{
if ( HaRequestTypes.Type.ACQUIRE_EXCLUSIVE_LOCK.is( type ) ||
HaRequestTypes.Type.ACQUIRE_SHARED_LOCK.is( type ) )
Expand All @@ -166,7 +166,7 @@ protected long getReadTimeout( RequestType<Master> type, long readTimeout )
}

@Override
protected boolean shouldCheckStoreId( RequestType<Master> type )
protected boolean shouldCheckStoreId( RequestType type )
{
return !HaRequestTypes.Type.COPY_STORE.is( type );
}
Expand Down
Expand Up @@ -57,7 +57,7 @@ public MasterServer( Master requestTarget, LogProvider logProvider, Configuratio
}

@Override
protected RequestType<Master> getRequestContext( byte id )
protected RequestType getRequestContext( byte id )
{
return requestTypes.type( id );
}
Expand Down
Expand Up @@ -75,7 +75,7 @@ public ProtocolVersion getProtocolVersion()
return SlaveServer.SLAVE_PROTOCOL_VERSION;
}

public enum SlaveRequestType implements RequestType<Slave>
public enum SlaveRequestType implements RequestType
{
PULL_UPDATES( (TargetCaller<Slave,Void>) ( master, context, input, target ) ->
{
Expand Down
Expand Up @@ -48,7 +48,7 @@ public SlaveServer( Slave requestTarget, Configuration config, LogProvider logPr
}

@Override
protected RequestType<Slave> getRequestContext( byte id )
protected RequestType getRequestContext( byte id )
{
return SlaveRequestType.values()[id];
}
Expand Down

0 comments on commit 5803468

Please sign in to comment.