Snowflake: Failed to get query execution status on db reconnection

We are using snowflake JDBC to execute unload queries on the snowflake. As unload queries potentially take more time to complete, we are periodically checking if query execution is completed by checking with query id. It is all working well if query execution and status check happen in the same session. Due to any reason, if the service restarts and creates a new connection, it is not able to get the execution status of the query executed before restarting the service.

creating snowflake connection

private Properties getProperties() {
    Properties properties = new Properties();
    properties.put("user", snowflakeConfig.getUsername());
    properties.put("password", snowflakeConfig.getPassword());
    properties.put("CLIENT_SESSION_KEEP_ALIVE", "true");
    return properties;
private Connection getConnection() throws SQLException {
    return DriverManager.getConnection(snowflakeConfig.getUrl(), getProperties());

Executing unload query :

resultSet = statement.unwrap(SnowflakeStatement.class).executeAsyncQuery(sql_command);
queryID = resultSet.unwrap(SnowflakeResultSet.class).getQueryID();

Get query status with query ID returned in above step:

resultSet = connection.unwrap(SnowflakeConnection.class).createResultSet(queryID);
queryStatus = resultSet.unwrap(SnowflakeResultSet.class).getStatus();

Can someone help me to do it in right way.