Skip to content

Commit

Permalink
HSEARCH-5284 Use SessionEventListener instead of the deprecated BaseS…
Browse files Browse the repository at this point in the history
…essionEventListener
  • Loading branch information
marko-bekhta committed Dec 6, 2024
1 parent 5fcee57 commit bbf100b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import jakarta.persistence.Entity;
import jakarta.persistence.Id;

import org.hibernate.BaseSessionEventListener;
import org.hibernate.SessionEventListener;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.search.engine.backend.work.execution.DocumentCommitStrategy;
Expand Down Expand Up @@ -585,7 +585,7 @@ protected static class SimulatedError extends Error {
}
}

public static class JdbcStatementErrorOnIdLoadingThreadListener extends BaseSessionEventListener {
public static class JdbcStatementErrorOnIdLoadingThreadListener implements SessionEventListener {
private static final String MESSAGE = "Simulated JDBC statement error on ID loading";

@Override
Expand All @@ -596,7 +596,7 @@ public void jdbcExecuteStatementStart() {
}
}

public static class JdbcStatementErrorOnEntityLoadingThreadListener extends BaseSessionEventListener {
public static class JdbcStatementErrorOnEntityLoadingThreadListener implements SessionEventListener {
private static final String MESSAGE = "Simulated JDBC statement error on entity loading";

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import jakarta.persistence.Entity;
import jakarta.persistence.Id;

import org.hibernate.BaseSessionEventListener;
import org.hibernate.SessionEventListener;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.search.engine.backend.work.execution.DocumentCommitStrategy;
Expand Down Expand Up @@ -888,7 +888,7 @@ protected static class SimulatedFailure extends RuntimeException {
}
}

public static class JdbcStatementFailureOnIdLoadingThreadListener extends BaseSessionEventListener {
public static class JdbcStatementFailureOnIdLoadingThreadListener implements SessionEventListener {
private static final String MESSAGE = "Simulated JDBC statement failure on ID loading";

@Override
Expand All @@ -899,7 +899,7 @@ public void jdbcExecuteStatementStart() {
}
}

public static class JdbcStatementFailureOnEntityLoadingThreadListener extends BaseSessionEventListener {
public static class JdbcStatementFailureOnEntityLoadingThreadListener implements SessionEventListener {
private static final String MESSAGE = "Simulated JDBC statement failure on entity loading";

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.util.function.BiConsumer;
import java.util.stream.Collectors;

import org.hibernate.BaseSessionEventListener;
import org.hibernate.Session;
import org.hibernate.SessionEventListener;
import org.hibernate.SessionFactory;
Expand Down Expand Up @@ -45,7 +44,7 @@ private OrmSoftAssertions(SessionFactory sessionFactory) {
statistics = sessionFactory.getStatistics();
statistics.setStatisticsEnabled( true );
statistics.clear();
sessionEventListener = new BaseSessionEventListener() {
sessionEventListener = new SessionEventListener() {
@Override
public void jdbcPrepareStatementStart() {
++statementExecutionCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

import static org.assertj.core.api.Assertions.fail;

import org.hibernate.BaseSessionEventListener;
import org.hibernate.Session;
import org.hibernate.SessionEventListener;
import org.hibernate.engine.spi.SessionImplementor;

public class SlowerLoadingListener extends BaseSessionEventListener {
public class SlowerLoadingListener implements SessionEventListener {

public static void registerSlowerLoadingListener(Session session, long delay) {
session.unwrap( SessionImplementor.class ).addEventListeners( new SlowerLoadingListener( delay ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
*/
package org.hibernate.search.util.impl.integrationtest.mapper.orm;

import org.hibernate.BaseSessionEventListener;
import org.hibernate.QueryTimeoutException;
import org.hibernate.Session;
import org.hibernate.SessionEventListener;
import org.hibernate.engine.spi.SessionImplementor;

public class TimeoutLoadingListener extends BaseSessionEventListener {
public class TimeoutLoadingListener implements SessionEventListener {

public static void registerTimingOutLoadingListener(Session session) {
session.unwrap( SessionImplementor.class ).addEventListeners( new TimeoutLoadingListener() );
Expand Down

0 comments on commit bbf100b

Please sign in to comment.