Skip to content

Refactor fetchNextRows() to use Action pattern #222

@rrobetti

Description

@rrobetti

Refactor: Move fetchNextRows() to Action Pattern

Summary

Refactor the fetchNextRows() method in StatementServiceImpl to follow the Action pattern, extracting the logic into a dedicated FetchNextRowsAction class.


Context

As part of the ongoing refactoring of StatementServiceImpl (a 2,528-line "God class"), we are extracting each public method into focused Action classes.

  • Reference: The connect() method has already been implemented as a pattern reference (see PR #XXX).

Task

Extract the fetchNextRows() method logic into FetchNextRowsAction.

  • Current Location: StatementServiceImpl.fetchNextRows() (line ~948)
  • Target Package: org.openjproxy.grpc.server.action.statement.FetchNextRowsAction

Implementation Steps

  1. Create FetchNextRowsAction class implementing Action<ResultSetFetchRequest, OpResult>.
  2. Extract logic from StatementServiceImpl.fetchNextRows() into the action.
  3. Handle ResultSet continuation logic within the new class.
  4. Update method to use context.getSessionManager() and other shared state.
  5. Delegate the call in StatementServiceImpl:
    public void fetchNextRows(ResultSetFetchRequest request, StreamObserver<OpResult> responseObserver) {
        new FetchNextRowsAction(actionContext).execute(request, responseObserver);
    }
  6. Compile and test to ensure no regressions.

Technical Details

Attribute Details
Complexity Medium (Estimated 80-100 lines)
Focus ResultSet fetching and pagination logic
Package org.openjproxy.grpc.server.action.statement

References


Acceptance Criteria

  • FetchNextRowsAction class created.
  • Logic successfully extracted from StatementServiceImpl.
  • ResultSet continuation handled properly.
  • StatementServiceImpl.fetchNextRows() delegates to the new action.
  • Code compiles without errors.
  • Existing tests pass.
  • No functional changes (pure refactoring).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions