|
24 | 24 | import org.neo4j.driver.internal.spi.Connection;
|
25 | 25 |
|
26 | 26 | import static org.neo4j.driver.internal.DatabaseNameUtil.defaultDatabase;
|
| 27 | +import static org.neo4j.driver.internal.DatabaseNameUtil.systemDatabase; |
27 | 28 | import static org.neo4j.driver.internal.InternalBookmark.empty;
|
28 | 29 |
|
29 | 30 | /**
|
30 | 31 | * A {@link Connection} shall fulfil this {@link ImmutableConnectionContext} when acquired from a connection provider.
|
31 | 32 | */
|
32 | 33 | public class ImmutableConnectionContext implements ConnectionContext
|
33 | 34 | {
|
34 |
| - private static final ConnectionContext SIMPLE = new ImmutableConnectionContext( defaultDatabase(), empty(), AccessMode.READ ); |
| 35 | + private static final ConnectionContext SINGLE_DB_CONTEXT = new ImmutableConnectionContext( defaultDatabase(), empty(), AccessMode.READ ); |
| 36 | + private static final ConnectionContext MULTI_DB_CONTEXT = new ImmutableConnectionContext( systemDatabase(), empty(), AccessMode.READ ); |
35 | 37 |
|
36 | 38 | private final DatabaseName databaseName;
|
37 | 39 | private final AccessMode mode;
|
@@ -65,10 +67,10 @@ public Bookmark rediscoveryBookmark()
|
65 | 67 | /**
|
66 | 68 | * A simple context is used to test connectivity with a remote server/cluster.
|
67 | 69 | * As long as there is a read only service, the connection shall be established successfully.
|
68 |
| - * This context should be applicable for both bolt v4 and bolt v3 routing table rediscovery. |
| 70 | + * Depending on whether multidb is supported or not, this method returns different context for routing table discovery. |
69 | 71 | */
|
70 |
| - public static ConnectionContext simple() |
| 72 | + public static ConnectionContext simple( boolean supportsMultiDb ) |
71 | 73 | {
|
72 |
| - return SIMPLE; |
| 74 | + return supportsMultiDb ? MULTI_DB_CONTEXT : SINGLE_DB_CONTEXT; |
73 | 75 | }
|
74 | 76 | }
|
0 commit comments