/** * Gets a session. Returns `NOT_FOUND` if the session does not exist. This is mainly useful for * determining whether a session is still alive. * * <p>Sample code: * * <pre><code> * try (SpannerClient spannerClient = SpannerClient.create()) { * SessionName name = SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); * Session response = spannerClient.getSession(name); * } * </code></pre> * * @param name Required. The name of the session to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Session getSession(SessionName name) { GetSessionRequest request = GetSessionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getSession(request); }
/** * Gets a session. Returns `NOT_FOUND` if the session does not exist. This is mainly useful for * determining whether a session is still alive. * * <p>Sample code: * * <pre><code> * try (SpannerClient spannerClient = SpannerClient.create()) { * SessionName name = SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); * Session response = spannerClient.getSession(name.toString()); * } * </code></pre> * * @param name Required. The name of the session to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Session getSession(String name) { GetSessionRequest request = GetSessionRequest.newBuilder().setName(name).build(); return getSession(request); }
/** * Gets a session. Returns `NOT_FOUND` if the session does not exist. This is mainly useful for * determining whether a session is still alive. * * <p>Sample code: * * <pre><code> * try (SpannerClient spannerClient = SpannerClient.create()) { * SessionName name = SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); * Session response = spannerClient.getSession(name); * } * </code></pre> * * @param name Required. The name of the session to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Session getSession(SessionName name) { GetSessionRequest request = GetSessionRequest.newBuilder().setName(name == null ? null : name.toString()).build(); return getSession(request); }
/** * Gets a session. Returns `NOT_FOUND` if the session does not exist. This is mainly useful for * determining whether a session is still alive. * * <p>Sample code: * * <pre><code> * try (SpannerClient spannerClient = SpannerClient.create()) { * SessionName name = SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); * Session response = spannerClient.getSession(name.toString()); * } * </code></pre> * * @param name Required. The name of the session to retrieve. * @throws com.google.api.gax.rpc.ApiException if the remote call fails */ public final Session getSession(String name) { GetSessionRequest request = GetSessionRequest.newBuilder().setName(name).build(); return getSession(request); }