Created
January 23, 2024 16:19
-
-
Save SinTeZWh1te/463b5bfe74cc3794127973d4f51a3aca to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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