This file contains hidden or 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
| <?xml version="1.0" encoding="UTF-8"?> | |
| <project xmlns="http://maven.apache.org/POM/4.0.0" | |
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| <modelVersion>4.0.0</modelVersion> | |
| <parent> | |
| <groupId>org.springframework.boot</groupId> | |
| <artifactId>spring-boot-starter-parent</artifactId> | |
| <version>3.2.0</version> | |
| <relativePath/> |
This file contains hidden or 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
| @echo off | |
| setlocal enabledelayedexpansion | |
| echo Getting JVM parameters from ConfigClient... | |
| for /f "delims=" %%A in ('java -jar C:\scripts\ConfigClient.jar project-1') do ( | |
| set JVM_PARAMS=%%A | |
| ) | |
| echo JVM Params: !JVM_PARAMS! |
This file contains hidden or 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
| import java.util.concurrent.*; | |
| public class InternalQueue { | |
| private final String queueName; | |
| private final BlockingQueue<Message> queue = new LinkedBlockingQueue<>(); | |
| private final ExecutorService executorService; | |
| private final MessageListener listener; | |
| private final int concurrentConsumers; | |
| public InternalQueue(String queueName, MessageListener listener, int concurrentConsumers) { |
This file contains hidden or 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
| import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate; | |
| import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; | |
| import org.springframework.jdbc.core.RowMapper; | |
| import org.springframework.jdbc.core.ColumnMapRowMapper; | |
| import org.slf4j.Logger; | |
| import org.slf4j.LoggerFactory; | |
| import javax.sql.DataSource; | |
| import java.sql.Connection; | |
| import java.sql.PreparedStatement; |
This file contains hidden or 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
| SELECT s.session_id, s.status, s.login_name, s.host_name, r.cpu_time, r.start_time, r.total_elapsed_time, | |
| r.blocking_session_id, q.text AS sql_text | |
| FROM sys.dm_exec_sessions s | |
| LEFT JOIN sys.dm_exec_requests r ON s.session_id = r.session_id | |
| CROSS APPLY sys.dm_exec_sql_text(s.most_recent_sql_handle) AS q | |
| WHERE s.session_id IN (SELECT session_id FROM sys.dm_exec_requests) | |
| ORDER BY r.start_time DESC; |
This file contains hidden or 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
| private int getSessionId(Connection connection) throws Exception { | |
| try (PreparedStatement ps = connection.prepareStatement("SELECT @@SPID"); | |
| ResultSet rs = ps.executeQuery()) { | |
| if (rs.next()) { | |
| return rs.getInt(1); | |
| } | |
| } | |
| throw new RuntimeException("Failed to retrieve session ID."); | |
| } |
This file contains hidden or 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
| <build> | |
| <plugins> | |
| <plugin> | |
| <groupId>org.openrewrite.maven</groupId> | |
| <artifactId>rewrite-maven-plugin</artifactId> | |
| <version>5.40.0</version> <!-- Use latest version --> | |
| <configuration> | |
| <activeRecipes> | |
| <!-- Upgrade to Java 21 --> | |
| <recipe>org.openrewrite.java.migrate.Java8toJava21</recipe> |
This file contains hidden or 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
| SELECT | |
| t.resource_type, | |
| t.resource_database_id, | |
| t.resource_description, | |
| t.request_mode, | |
| t.request_status, | |
| t.request_session_id, | |
| s.login_name, | |
| s.host_name, | |
| s.program_name, |
This file contains hidden or 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
| public class StringReplaceByIndex { | |
| public static void main(String[] args) { | |
| String original = "Hello, World!"; | |
| int startIndex = 7; // starting index of the substring to replace | |
| int endIndex = 12; // ending index (exclusive) of the substring to replace | |
| String replacement = "Java"; | |
| String result = replaceSubstring(original, startIndex, endIndex, replacement); | |
| System.out.println(result); // Output: Hello, Java! | |
| } |
This file contains hidden or 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
| SELECT | |
| p.name AS ParameterName, | |
| t.name AS DataType, | |
| p.max_length AS MaxLength, | |
| p.precision AS Precision, | |
| p.scale AS Scale, | |
| p.is_output AS IsOutputParameter, | |
| CASE | |
| WHEN p.is_nullable = 1 THEN 'Optional' | |
| ELSE 'Mandatory' |
NewerOlder