Skip to content

Instantly share code, notes, and snippets.

@SinTeZWh1te
Created January 23, 2024 16:19
Show Gist options
  • Save SinTeZWh1te/463b5bfe74cc3794127973d4f51a3aca to your computer and use it in GitHub Desktop.
Save SinTeZWh1te/463b5bfe74cc3794127973d4f51a3aca to your computer and use it in GitHub Desktop.
package ru.test.bgbilling.kernel.scripts.global.dialup;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import ru.bitel.bgbilling.kernel.event.EventProcessor;
import ru.bitel.bgbilling.kernel.script.server.dev.GlobalScriptBase;
import ru.bitel.bgbilling.modules.dialup.server.event.bus.DialupSessionBreakEvent;
import ru.bitel.bgbilling.server.util.Setup;
import ru.bitel.common.sql.ConnectionSet;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
/**
* @author sintezwh1te
*/
public class BreakSession
extends GlobalScriptBase {
private static final Logger logger = LogManager.getLogger();
@Override
public void execute(Setup setup, ConnectionSet connectionSet)
throws Exception {
Connection con = connectionSet.getConnection();
try (PreparedStatement ps = con.prepareStatement("select id from log_session_1 where nas_id=1LIMIT 200");
ResultSet rs = ps.executeQuery()) {
while (rs.next()) {
EventProcessor.getInstance().publish(new DialupSessionBreakEvent(1, rs.getInt("id")));
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment