Source:
public <T> List<T> stores(final StoreQueryParams storeQueryParams) { final String storeName = storeQueryParams.getStoreName(); final QueryableStoreType<T> queryableStoreType = storeQueryParams.getQueryableStoreType(); final TaskId keyTaskId = createKeyTaskId(storeName, storeQueryParams.partition()); if (streamThread.state() == StreamThread.State.DEAD) { return Collections.emptyList(); } final StreamThread.State state = streamThread.state(); if (storeQueryParams.staleStoresEnabled() ? state.isAlive() : state == StreamThread.State.RUNNING) { final Map<TaskId, ? extends Task> tasks = storeQueryParams.staleStoresEnabled() ? streamThread.allTasks() : streamThread.activeTasks(); final List<T> stores = new ArrayList<>(); for (final Task streamTask : tasks.values()) { if (keyTaskId != null && !keyTaskId.equals(streamTask.id())) { continue; } final StateStore store = streamTask.getStore(storeName); if (store != null && queryableStoreType.accepts(store)) { if (!store.isOpen()) { throw new InvalidStateStoreException( "Cannot get state store " + storeName + " for task " + streamTask + " because the store is not open. " + "The state store may have migrated to another instances."); } if (store instanceof TimestampedKeyValueStore && queryableStoreType instanceof QueryableStoreTypes.KeyValueStoreType) { stores.add((T) new ReadOnlyKeyValueStoreFacade<>((TimestampedKeyValueStore<Object, Object>) store)); } else if (store instanceof TimestampedWindowStore && queryableStoreType instanceof QueryableStoreTypes.WindowStoreType) { stores.add((T) new ReadOnlyWindowStoreFacade<>((TimestampedWindowStore<Object, Object>) store)); } else { stores.add((T) store); } } } return stores; } else { throw new InvalidStateStoreException("Cannot get state store " + storeName + " because the stream thread is " + state + ", not RUNNING" + (storeQueryParams.staleStoresEnabled() ? " or REBALANCING" : "")); } }

Target:
public <T> List<T> stores(final StoreQueryParams storeQueryParams) { final String storeName = storeQueryParams.storeName(); final QueryableStoreType<T> queryableStoreType = storeQueryParams.queryableStoreType(); final TaskId keyTaskId = createKeyTaskId(storeName, storeQueryParams.partition()); if (streamThread.state() == StreamThread.State.DEAD) { return Collections.emptyList(); } final StreamThread.State state = streamThread.state(); if (storeQueryParams.staleStoresEnabled() ? state.isAlive() : state == StreamThread.State.RUNNING) { final Map<TaskId, ? extends Task> tasks = storeQueryParams.staleStoresEnabled() ? streamThread.allTasks() : streamThread.activeTasks(); final List<T> stores = new ArrayList<>(); for (final Task streamTask : tasks.values()) { if (keyTaskId != null && !keyTaskId.equals(streamTask.id())) { continue; } final StateStore store = streamTask.getStore(storeName); if (store != null && queryableStoreType.accepts(store)) { if (!store.isOpen()) { throw new InvalidStateStoreException( "Cannot get state store " + storeName + " for task " + streamTask + " because the store is not open. " + "The state store may have migrated to another instances."); } if (store instanceof TimestampedKeyValueStore && queryableStoreType instanceof QueryableStoreTypes.KeyValueStoreType) { stores.add((T) new ReadOnlyKeyValueStoreFacade<>((TimestampedKeyValueStore<Object, Object>) store)); } else if (store instanceof TimestampedWindowStore && queryableStoreType instanceof QueryableStoreTypes.WindowStoreType) { stores.add((T) new ReadOnlyWindowStoreFacade<>((TimestampedWindowStore<Object, Object>) store)); } else { stores.add((T) store); } } } return stores; } else { throw new InvalidStateStoreException("Cannot get state store " + storeName + " because the stream thread is " + state + ", not RUNNING" + (storeQueryParams.staleStoresEnabled() ? " or REBALANCING" : "")); } }