Skip to content
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

Move server info into result summary #272

Merged
merged 2 commits into from
Nov 18, 2016

Conversation

zhenlineo
Copy link
Contributor

Replaced session.server with resultSummary.server.version
Replaced session.address with resultSummary.server.address

@zhenlineo zhenlineo force-pushed the 1.1-server-info-in-result branch from 7de9ef9 to be8b568 Compare November 15, 2016 14:52
Replaced session.server with resultSummary.server.version
Replaced session.address with resultSummary.server.address
@zhenlineo zhenlineo force-pushed the 1.1-server-info-in-result branch from be8b568 to efdf8bd Compare November 15, 2016 14:55
Copy link
Contributor

@lutovich lutovich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhenlineo made couple small comments.

this.socket = socket;
this.logger = logger;

if( logger.isDebugEnabled() )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe extract this if-else in a method like createResponseHandler(Logger), otherwise it is duplicated in both constructors.

queueMessage( new InitMessage( clientName, authToken ), initCollector );
sync();
this.serverInfo = new InternalServerInfo( socket.address(), initCollector.server() );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InternalServerInfo constructor's second arg is called String version but here we pass initCollector.server() for it. This is a bit confusing. Maybe InitCollector#server() can be renamed to #serverVersion()?


public class InternalServerInfo implements ServerInfo
{
private BoltServerAddress address;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fields can be final


/**
* Returns a string telling which version of the server the query was executed.
* @return The server version of <code>null</code> if not available.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible for the version to not be available while address is available?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is possible. The version is not supported before server 3.1. I will add a line in the doc

System.out.println( session.server() );
assumeTrue( ServerVersion.version( session.server() ).greaterThanOrEqual( v3_1_0 ) );
String version = session.run( "RETURN 1" ).consume().server().version();
System.out.println( version );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This println can probably be removed.

@technige technige merged commit 94f39b6 into neo4j:1.1 Nov 18, 2016
@zhenlineo zhenlineo deleted the 1.1-server-info-in-result branch January 19, 2017 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants