This Confluence has been LDAP enabled, if you are an ASF Committer, please use your LDAP Credentials to login. Any problems file an INFRA jira ticket please.

Child pages
  • KIP-216: IQ should throw different exceptions for different errors

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: update for more explanation


Because of that, we should throw different exceptions for each type.

Proposed Changes

There are the new exceptions:

The main change is to introduce new exceptions that extend from InvalidStateStoreException. InvalidStateStoreException is not thrown at all anymore, but only new sub-classes.


Code Block
# Throw to user exception
public class StateStoreMigratedException extends InvalidStateStoreException
public class StateStoreRetryableException extends InvalidStateStoreException
public class StateStoreFailException extends InvalidStateStoreException

# Internal exception
public class StateStoreClosedException extends InvalidStateStoreException
public class StateStoreEmptyException extends InvalidStateStoreException
public class StreamThreadNotRunningException extends InvalidStateStoreException


Three categories exception throw to the user:


Three internal exceptions: StateStoreClosedException, StateStoreEmptyException, StreamThreadNotRunningException

The internal exception will be wrapped as user's category exception finally. The purpose of the internal exceptions is to distinguish between the different kinds of InvalidStateStoreException. For example, StreamThreadStateStoreProvider#stores() will throw StreamThreadNotRunningException(internal exception). And then the internal exception will be wrapped as StateStoreRetryableException or StateStoreFailException during the and throw to the user.


The following is the public method that users will call: